Commit graph

34057 commits

Author SHA1 Message Date
electrikmilk
4263dad838 Base: Change JSON file icon to add CSS file icon
Add CSS icon and add replacement JSON icon as the colors conflict.

Update HackStudioWidget.cpp
2022-02-08 22:42:47 +00:00
Jackson
d55978c254 Ports: Fix lua not building 2022-02-08 22:21:00 +00:00
Kenneth Myhra
bf7f6a9e98 LibWeb: Implement EventHandler::focus_previous_element()
This implements EventHandler::focus_previous_element() so we can cycle
backwards through focusable elements on a web page with Shift+Tab.
2022-02-08 22:15:10 +00:00
Andreas Kling
3f9fc0f690 Browser+LibWeb: Add "Dump Local Storage" item to Browser's Debug menu 2022-02-08 21:53:20 +01:00
Andreas Kling
47979996e8 LibWeb: Add Storage interface and window.localStorage
This is a naive-but-somewhat-functional initial implementation of
HTML Storage.

Note that there is no persistence yet, everything is in-process only,
and one local Storage object per origin.
2022-02-08 21:53:20 +01:00
Andreas Kling
a856cf8d4c LibWeb: Allow using Origin as a HashMap key 2022-02-08 21:53:20 +01:00
Ali Mohammad Pur
5dceba29a4 RequestServer: Avoid Vector OOB access in ConnectionCache
`it.is_end()` could be updated to return false for a previously-invalid
iterator after we append a new socket, copy its value out to a local
variable to not hit this behaviour.
2022-02-08 18:47:19 +00:00
Linus Groh
fd0f1d0c1a LibJS: Fix two typos in comments 2022-02-08 18:17:12 +00:00
Luke Wilde
17aeb99e9e LibWeb: Implement the JS host hooks for promises, job callbacks and more
This overrides the JS host hooks to follow the spec for queuing
promises, making/calling job callbacks, unhandled promise rejection
handling and FinalizationRegistry queuing.

This also allows us to drop the on_call_stack_emptied hook in
Document::interpreter().
2022-02-08 17:47:44 +00:00
Luke Wilde
4c1c6ef91c LibJS: Setup host hooks and have promise jobs work out the realm
This allows the host of LibJS (notably LibWeb in this case) to override
certain functions such as HostEnqueuePromiseJob, so it can do it's own
thing in certain situations. Notably, LibWeb will override
HostEnqueuePromiseJob to put promise jobs on the microtask queue.

This also makes promise jobs use AK::Function instead of
JS::NativeFunction. This removes the need to go through a JavaScript
function and it more closely matches the spec's idea of "abstract
closures"
2022-02-08 17:47:44 +00:00
Luke Wilde
5aacec65ab LibWeb: Rewrite EventTarget to more closely match the spec
This isn't perfect (especially the global object situation in
activate_event_handler), but I believe it's in a much more complete
state now :^)

This fixes the issue of crashing in prepare_for_ordinary_call with the
`i < m_size` crash, as it now uses the IDL callback functions which
requires the Environment Settings Object. The environment settings
object for the callback is fetched at the time the callback is created,
for example, WrapperGenerator gets the incumbent settings object for
the callback at the time of wrapping. This allows us to remove passing
in ScriptExecutionContext into EventTarget's constructor.

With this, we can now drop ScriptExecutionContext.
2022-02-08 17:47:44 +00:00
Luke Wilde
3bb5c6207f LibWeb: Make FormAssociatedElement inherit from HTMLElement
The new event target implementation requires us to downcast an
EventTarget to a FormAssociatedElement to check if the current Element
EventTarget has a form owner to setup a with scope for the form owner.

This also makes all form associated elements inherit from
FormAssociatedElement where it was previously missing.

https://html.spec.whatwg.org/#form-associated-element
2022-02-08 17:47:44 +00:00
Luke Wilde
f71f404e0c LibWeb: Introduce the Environment Settings Object
The environment settings object is effectively the context a piece of
script is running under, for example, it contains the origin,
responsible document, realm, global object and event loop for the
current context. This effectively replaces ScriptExecutionContext, but
it cannot be removed in this commit as EventTarget still depends on it.

https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
2022-02-08 17:47:44 +00:00
Andreas Kling
4db5406d62 LibWeb: Support passing more parameter types to HTML::report_exception()
We now allow any JS::ThrowCompletion<T>, as well as JS::Completion
directly (although we'll VERIFY() that it's a throw completion.)
2022-02-08 17:47:44 +00:00
Rafał Babiarz
3383ae1598 LibWeb: Fixed disabled checkbox input behaviour
Previously disabled checkbox could be checked by clicking on it's label
2022-02-08 17:51:33 +01:00
Sam Atkins
103613a3a9 LibWeb: Incorporate spread-distance into box-shadow rendering
We also pass whether the shadow goes inside or outside the element. Only
outer shadows are rendered currently, and inner ones may want to be
handled separately from them, as they will never interfere with each
other.
2022-02-08 17:45:51 +01:00
Sam Atkins
10c6c77b5c LibWeb: Render multiple box-shadows
Because why not? :^)
2022-02-08 17:45:51 +01:00
Sam Atkins
b51f428165 LibWeb: Parse multiple box-shadows :^)
Again, we don't yet render these (we render nothing) but this gets rid
of a decent amount of CSS spam on Discord.
2022-02-08 17:45:51 +01:00
Sam Atkins
e5b0369dfd LibWeb: Parse spread-distance and inset parts of box-shadow
We do not actually use these when rendering the shadow yet.
2022-02-08 17:45:51 +01:00
Sam Atkins
c547bed13b LibWeb: Reorganize box-shadow parsing code
The pattern we've adopted for other multi-value properties is to run in
a loop like this, since that makes it easier to cater for values
appearing in different orders.
2022-02-08 17:45:51 +01:00
thankyouverycool
1cd77fd1b4 WindowServer: Preserve cursor position when dragging between states
Previously windows would end up in awkward positions relative to
the move cursor when dragging between tile types or unmaximizing.
This feels a bit more ergonomic.
2022-02-08 16:37:46 +01:00
thankyouverycool
ee637b44fb WindowServer: Add Vertically/HorizontallyMaximized WindowTileTypes
VerticallyMaximized tiling replaces set_vertically_maximized() to
take advantage of tiling ergonomics.

Middle-clicking a window's maximize button now tiles vertically;
secondary-clicking tiles horizontally.

Adds Super+Alt+Arrow shortcuts for both. Super+Left/Right tiling
shortcuts now let windows shift between tile types directly.
2022-02-08 16:37:46 +01:00
thankyouverycool
32be05957a WindowServer: Fix comments in WindowManager 2022-02-08 16:37:46 +01:00
thankyouverycool
1607fd511f WindowServer: Unify Window restore rects
Previously, different rects were used to restore tiled and maximized
windows, creating edge cases for inconsistent restoration. All states
now restore m_floating_rect, which saves the last valid size and
location of a window while free-floating.
2022-02-08 16:37:46 +01:00
thankyouverycool
3d7e701451 WindowServer: Rename Window::tiled() => tile_type() and add is_tiled()
This seems more consistent with naming conventions across the system
and makes conditionals easier to read.
2022-02-08 16:37:46 +01:00
Ali Mohammad Pur
d3c25b8ea2 LibCore: Make BufferedHelper::read() block at most once per read
The previous method could block multiple times, leading to a completely
stuck/deadlocked read() call, and it could also consume data without
telling the user about it, which is Not A Good Thing ™️.
This patch makes it block at most once, and fixes loading HTTP pages
with LibHTTP :^)
2022-02-08 15:43:20 +01:00
Lady Gegga
17a3dd23f4 Base: Add Sinhala character to font Katica Regular 10
0D9E https://www.unicode.org/charts/PDF/U0D80.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
2768f6cfbc Base: Add Transport and Map Symbols to font Katica Regular 10
1F6E0 https://www.unicode.org/charts/PDF/U1F680.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
c8ae84fd5c Base: Add Miscellaneous Symbols and Pictographs to Katica Regular 10
1F519, 1F51A, 1F51B, 1F51C, 1F51D, 1F52C, 1F52D, 1F53E, 1F53F, 1F5A5
https://www.unicode.org/charts/PDF/U1F300.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
5aa1f55150 Base: Add Enclosed Alphanumeric Supplement to font Katica Regular 10
1F12A, 1F12F, 1F130, 1F131, 1F132, 1F133, 1F134, 1F135, 1F136, 1F137,
1F138, 1F139, 1F13A, 1F13B, 1F13C, 1F13D, 1F13E, 1F13F, 1F140, 1F141,
1F142, 1F143, 1F144, 1F145, 1F146, 1F147, 1F148, 1F149, 1F150, 1F151,
1F152, 1F153, 1F154, 1F155, 1F156, 1F157, 1F158, 1F159, 1F15A, 1F15B,
1F15C, 1F15D, 1F15E, 1F15F, 1F160, 1F161, 1F162, 1F163, 1F164, 1F165,
1F166, 1F167, 1F168, 1F169, 1F16A, 1F16B, 1F16C, 1F16D, 1F16E, 1F16F,
1F170, 1F171, 1F172, 1F173, 1F174, 1F175, 1F176, 1F177, 1F178, 1F179,
1F17A, 1F17B, 1F17C, 1F17D, 1F17E, 1F17F, 1F180, 1F181, 1F182, 1F183,
1F184, 1F185, 1F186, 1F187, 1F188, 1F189, 1F1E6, 1F1E7, 1F1E8, 1F1E9,
1F1EA, 1F1EB, 1F1EC, 1F1ED, 1F1EE, 1F1EF, 1F1F0, 1F1F1, 1F1F2, 1F1F3,
1F1F4, 1F1F5, 1F1F6, 1F1F7, 1F1F8, 1F1F9, 1F1FA, 1F1FB, 1F1FC, 1F1FD,
1F1FE, 1F1FF
https://www.unicode.org/charts/PDF/U1F100.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
6ad0e0a99f Base: Add Miscellaneous Symbols and Arrows to font Katica Regular 10
2B05, 2B08, 2B09, 2B0A, 2B0B, 2B12, 2B13, 2B14, 2B15, 2B16,
2B17, 2B18, 2B19, 2B1A, 2B24, 2B25, 2B26, 2B45, 2B46, 2BD0,
2BD1, 2BD2
https://www.unicode.org/charts/PDF/U2B00.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
d32c519da6 Base: Add Dingbats to Katica Regular 10
2754, 2776, 2777, 2778, 2779, 277A, 277B, 277C, 277D, 277E,
277F, 27A0, 27A1, 27A5, 27A6, 27A7, 27AF, 27B0, 27B1, 27B2,
27B3, 27BE, 27BF
https://www.unicode.org/charts/PDF/U2700.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
38bd0ef254 Base: Add Miscellaneous Symbols to font Katica Regular 10
2642, 269C, 269E, 269F, 26C5, 26E2, 26E3, 26EB, 26EC, 26ED,
26EE, 26EF, 26F0, 26F1, 26F3, 26FE, 26FF
https://www.unicode.org/charts/PDF/U2600.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
ab63b9fc01 Base: Add Mathematical Operators to font Katica Regular 10
2200, 2210, 2240, 2242, 2243, 2245, 2248, 224A, 224B, 224C,
224D, 2264, 2265, 2266, 2267, 2268, 2269, 226A, 226B, 226C,
22BE, 22C0, 22C1, 22C2, 22C3, 22C6, 22C7, 22CB, 22CC, 22CD
https://www.unicode.org/charts/PDF/U2200.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
b2db0712ad Base: Add Letterlike Symbols to font Katica Regular 10
2102, 2103, 2115, 2116, 2117, 211D, 2120, 2121, 2124, 212B,
2133, 2141, 2142, 2143, 2144, 214B, 214D
https://www.unicode.org/charts/PDF/U2100.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
0edba54b7b Base: Add Combining Diacritical Marks to Katica Regular 10
0300, 0301, 0303, 0304, 0305, 0312, 0313, 0314, 0325, 0326,
032A, 0332, 0333, 0334, 0335, 0336, 0337, 0338, 033A, 033F,
0340, 0341, 0342, 0346, 0347, 0363, 0364, 0365, 0366, 0367,
0368, 0369, 036A, 036B, 036C, 036D, 036E, 036F
https://www.unicode.org/charts/PDF/U0300.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
fb7fadc38f Base: Add Spacing Modifier Letters to font Katica Regular 10
02B0, 02B1, 02B2, 02B3, 02B4, 02E2
https://www.unicode.org/charts/PDF/U02B0.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
943357e311 Base: Adjust 00A9 and 00AE in font Katica Regular 10
These glyphs are now closer to the Unicode charts.
https://www.unicode.org/charts/PDF/U0080.pdf
2022-02-08 10:48:30 +00:00
Lady Gegga
7ad8e4874a Base: Add General Punctuation to font Csilla Regular 10
2010, 2013, 2014 https://www.unicode.org/charts/PDF/U2000.pdf
2022-02-08 10:48:30 +00:00
davidot
1c4c251be3 LibJS+Everywhere: Remove all VM::clear_exception() calls
Since VM::exception() no longer exists this is now useless. All of these
calls to clear_exception were just to clear the VM state after some
(potentially) failed evaluation and did not use the exception itself.
2022-02-08 09:12:42 +00:00
davidot
9264f9d24e LibJS+Everywhere: Remove VM::exception() and most related functions
This commit removes all exception related code:
Remove VM::exception(), VM::throw_exception() etc. Any leftover
throw_exception calls are moved to throw_completion.
The one method left is clear_exception() which is now a no-op. Most of
these calls are just to clear whatever exception might have been thrown
when handling a Completion. So to have a cleaner commit this will be
removed in a next commit.

It also removes the actual Exception and TemporaryClearException classes
since these are no longer used.

In any spot where the exception was actually used an attempt was made to
preserve that behavior. However since it is no longer tracked by the VM
we cannot access exceptions which were thrown in previous calls.
There are two such cases which might have different behavior:
- In Web::DOM::Document::interpreter() the on_call_stack_emptied hook
  used to print any uncaught exception but this is now no longer
  possible as the VM does not store uncaught exceptions.
- In js the code used to be interruptable by throwing an exception on
  the VM. This is no longer possible but was already somewhat fragile
  before as you could happen to throw an exception just before a VERIFY.
2022-02-08 09:12:42 +00:00
davidot
4ef1e8f226 Spreadsheet: No longer use vm.exception() to signal exception state
Instead, use the completions which are returned directly. This means we
no longer have to worry about the global VM state when running code.
2022-02-08 09:12:42 +00:00
davidot
e160f508a8 LibJS: Add a traceback to Error
Since we have the traceback we now also generate the stack string on
demand instead of immediately on construction.
2022-02-08 09:12:42 +00:00
davidot
f324d91106 LibJS: Convert FinalizationRegistry::cleanup to ThrowCompletionOr 2022-02-08 09:12:42 +00:00
davidot
dcc284705b LibJS: Always pop the execution context if we pushed one for bytecode 2022-02-08 09:12:42 +00:00
davidot
8108fc7f9c LibJS: Convert Instruction::execute in bytecode to ThrowCompletionOr
This allows us to use TRY in these functions :^).
2022-02-08 09:12:42 +00:00
davidot
de90d54be0 LibJS: Convert ArrayBuffer construction to ThrowCompletionOr
This also allows us to create TypedArrays with an existing buffer thus
clearing up an additional FIXME in TextEncoder.
2022-02-08 09:12:42 +00:00
davidot
4136cbdb09 LibJS: Convert ScopeNode declaration functions to ThrowCompletionOr
This removes a number of vm.exception() checks which are now caught
directly by TRY. Make use of these checks in
{Global, Eval}DeclarationInstantiation and while we're here add spec
comments.
2022-02-08 09:12:42 +00:00
Andreas Kling
cc7a117f0f LibJS: Add missing include to ShadowRealm.h 2022-02-07 22:39:57 +01:00
Sam Atkins
6df0b8e889 LibWeb: Parse display: inline-flex
This was already handled in the CSS machinery, we just never parsed it.
2022-02-07 21:55:12 +01:00