Commit graph

54472 commits

Author SHA1 Message Date
Aliaksandr Kalenik 6522fa8933 LibWeb: Use DocumentLoadEventDelayer to delay load event in Navigable
Use a delayer object that actually delays load event for child
navigables instead of boolean flag that does nothing.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik b398d6a35c LibWeb: Determine origin while populating navigation params from srcdoc
Address the FIXMEs by implementing the missing parts of the procedure
from the specification.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik 7ad2dd2693 LibWeb: Exit navigation process if navigation id has changed
Change of navigation id means that it has been aborted, and we should
return early.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik b7c93cae7f LibWeb: Set document content type in load_document()
Fixes regression in `load_document()` compared to FrameLoader.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik c437f16cc1 LibWeb: Early return navigation process if navigable has been destroyed
If a navigable has been destroyed during a navigation process, we
should early return from it. The introduced checks are not in
the spec because, as explained in
https://github.com/whatwg/html/issues/9690 the spec is not written
with such a level of detail.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik c20123378d LibWeb: Add unloading of child navigables in "apply the history step"
Implements missing step from the spec.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik 2445205e9d LibWeb: Align session history step application code with latest spec
Replaces direct "apply the history step" calls with new functions from
the spec:
- "update for navigable creation/destruction"
- "apply the push/replace history step"
- "apply the reload history step"
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik d3d2e56a68 LibWeb: Call set_ongoing_navigation() on navigable instead of this
This fixes incorrectly implemented spec when `set_ongoing_navigation()`
is called on `this` (=traversable) instead of `navigable` variable.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik 799b465fac LibWeb: Compare urls excluding fragments in Navigable::navigate() 2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik fbc95440a4 LibWeb: Only return initialized navigables from child_navigables()
Fixes a crash in `get_session_history_entries()` that happens when
it attempts to find entries for a navigable that hasn't been fully
initialized and therefore doesn't have a nested history entry yet.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik 15d265da65 LibWeb: Fix "stack-use-after-return" in navigate_to_a_fragmement()
Callback running on the session history queue should capture necessary
pointers by value instead of reference, because navigate_to_a_fragment
stack will have been destroyed by the time it will be executed.
2023-09-15 18:27:17 +02:00
Andreas Kling 23569f8690 LibWeb: Allow fractional font sizes in CSS
Fixes an issue where relative font sizes would "snap" to integer sizes
in an unpleasant-looking way while resizing on some websites.
2023-09-15 18:26:37 +02:00
Ali Mohammad Pur 4d71f4edc4 LibRegex: Don't add the Repeat instruction size to its jump target
This was causing the calculated jump target to become invalid, leading
to possibly invalid optimisations and (more likely) crashes.
Fixes #21047.
2023-09-15 18:07:23 +03:30
Andreas Kling 9220c68408 LibJS: Avoid pointless HashTable copying during GC mark phase
for_each_cell_among_possible_pointers() was taking HashTable by value
instead of by const reference for no reason.

The copying was soaking up ~4% of CPU time while loading https://x.com/
2023-09-15 12:12:54 +02:00
Luke Wilde 56f0b10d14 LibWeb: Fix setTimeout() when there's no active script
Implements https://github.com/whatwg/html/pull/9712
Fixes https://github.com/SerenityOS/serenity/issues/20970
2023-09-15 08:53:21 +02:00
Luke Wilde 9335524f15 LibWeb: Default ScriptFetchOptions parser metadata to NotParserInserted
See: https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options
2023-09-15 08:53:21 +02:00
Aliaksandr Kalenik 6f8be44c0e LibWeb+WebContent+headless-browser: Support async text tests
Previously, we used `on_load_finish` to determine when the text test
was completed. This method did not allow testing of async functions
because there was no way to indicate that the runner should wait for
the async call to end.

This change introduces a function in the `internals` object that is
intended to be called when the text test execution is completed. The
text test runner will now ignore `on_load_finish` which means a test
will timeout if this new function is never called.

`test(f)` function in `include.js` has been modified to automatically
terminate a test once `load` event is fired on `window`.
new `asyncTest(f)` function has been introduces. `f` receives function
that will terminate a test as a first argument.

Every test is expected to call either `test()` or `asyncTest()` to
complete. If not, it will remain hanging until a timeout occurs.
2023-09-15 08:52:25 +02:00
Tim Ledbetter c74f7e5f2a Userland: Don't use String::from_utf8() for literal strings 2023-09-15 08:44:52 +02:00
Zaggy1024 4cc3c41269 LibWeb: Allow calculated values for background-size dimensions
This fixes the sizing of the arrow icons displayed to the left of
parent sections on a table of contents on Wikipedia articles, which
are sized using the equation `calc(max(0.75em, 12px))`. Now, the icon
will not expand past the edges of the box they are within, avoiding
clipping the edges of the arrows.
2023-09-15 08:40:10 +02:00
Maxim Solovyov bdb311a434 Documentation: Update clang-format version where it was missed
It seems that it was supposed to be updated in
388d455575 but was missed.
2023-09-14 22:45:15 -04:00
Bastiaan van der Plaat 222cc29c5c LibWeb: Add XMLHttpRequest Document response type 2023-09-14 22:58:42 +02:00
Nicolas Ramz b8f8b22aa5 LibGfx/ILBM: Add support for uncompressed files 2023-09-14 21:00:54 +01:00
Andreas Kling 80a78c4deb LibWeb: Don't generate ::before/::after for BR elements
We shouldn't be putting generated pseudo elements inside elements that
can't have children in the first place.

This patch fixes two issues:
- We stop generating pseudo elements for layout nodes that can't have
  children anyway.
- We mark Layout::BreakNode as not being able to have children.
2023-09-14 21:46:28 +02:00
Andreas Kling a7c1af08ca LibJS: Store bytecode instruction length in instruction itself
Instead of running a big switch statement on the opcode when checking
how long an instruction is, we now simply store that in a member
variable at construction time for instant access.

This yields a 10.2% speed-up on Kraken/ai-astar :^)
2023-09-14 16:11:14 +02:00
Shannon Booth d7c1cc0276 LibWeb: Fix missing 'get an output encoding' step in HTMLFormElement
This could mean that the picked encoding was not being set to UTF-8 if
the documents encoding was 'replacement', 'utf-16le' or 'utf-16be'.
2023-09-14 06:49:57 -04:00
Tim Schumacher b0c1dc14f3 Meta: Download pnp_ids.html to the cache directory 2023-09-14 08:05:00 +01:00
Tim Schumacher cc6054ae3b Meta: Download commonmark.spec.json to the cache directory 2023-09-14 08:05:00 +01:00
implicitfield bac4fc1b73 Ladybird: Add more items to the debug menu of the AppKit chrome 2023-09-13 19:33:07 -04:00
implicitfield 63d09f6daf Browser+Ladybird: Let the list of user agent strings be shared 2023-09-13 19:33:07 -04:00
Andrew Kaster d93911928b Ladybird/Android: Add EventLoopImplementation for ALooper
Timers run in their own thread, to take advantage of existing Java
Executor features. By hooking into ALooper, we can spin the main
Activity's UI thread event loop without causing a fuss, or spinning the
CPU by just polling our event loop constantly.
2023-09-13 15:00:56 -06:00
Bastiaan van der Plaat d63fb8fa61 Maps: Add show SerenityOS users feature 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat dfb54083ee Maps: Add markers to map widget 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat 599a37aa0c Maps: Add panels to map widget 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat 048e8d7744 Maps: Add toolbar and frame border to map widget 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat b5f91e3365 Maps: Remember last window position and size 2023-09-13 21:41:37 +02:00
Aliaksandr Kalenik 84139a10d2 LibWeb: Implement navigation to javascript: URLs for navigables
Implements following algorithms from the specification:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-to-a-javascript:-url
https://html.spec.whatwg.org/multipage/browsing-the-web.html#evaluate-a-javascript:-url
2023-09-13 21:35:52 +02:00
Aliaksandr Kalenik 09013583f2 LibWeb: Add Navigable::set_ongoing_navigation() 2023-09-13 21:35:52 +02:00
Aliaksandr Kalenik aa0d254fa3 LibWeb: Start fleshing out "URL and history update steps" 2023-09-13 21:35:52 +02:00
Sam Atkins 6bf107fc16 LibWeb: Implement the :open and :closed pseudo-classes
These apply to any elements that have some kind of open/closed state.
The spec suggests `<details>`, `<dialog>`, and `<select>`, so that's
what I've supported here. Only `<details>` is fleshed out right now,
but once the others are, these pseudo-classes should work
automatically. :^)
2023-09-13 19:55:22 +02:00
Sam Atkins 29bb0f0ae6 LibWeb: Stub out an "open" state on <select> elements
The CSS Selectors-4 spec suggests that `:open` and `:closed` should
apply to `<select>` elements, so let's add a way of storing and
exposing that state. We don't yet actually generate any layout for
`<select>` elements, so they will always report that they are closed.
2023-09-13 19:55:22 +02:00
Timothy Flynn b1632c58bf LibWeb: Create a shadow tree for details elements with manual slots
The spec requires that details elements be assigned a shadow tree with
two slots. The first slot is assigned the first summary child element of
the details element. The second slot is assigned all other children.
2023-09-13 13:45:47 +02:00
Timothy Flynn bdf2323b3f LibWeb: Perform layout of a slot's assigned nodes 2023-09-13 13:45:47 +02:00
Timothy Flynn e4d3a9aa68 LibWeb: Ensure DOM events on slottables are properly propagated
Most events on a slottable are composed, meaning they propagate from the
slottable and through its shadow tree before bubbling up to the parent
of the slottable.
2023-09-13 13:45:47 +02:00
Timothy Flynn d67d93f870 LibWeb: Handle reassigning slottables on node insertion and removal 2023-09-13 13:45:47 +02:00
Timothy Flynn 683ce8e615 LibWeb: Implement (most of) the assigned slot/slottable lookup APIs
This implements looking up a slottable's assigned slot, and a slot's
list of assigned slottables. For the latter, only unflattened lookups
are implemented so far.
2023-09-13 13:45:47 +02:00
Timothy Flynn b602ee7ddd LibWeb: Implement automatic slottable assignment
This implements automatic slottable assignment by way of hooking into
the element attribute change steps. When the `name` attribute of a slot
or the `slot` attribute of a slottable changes, assignment is performed.
2023-09-13 13:45:47 +02:00
Timothy Flynn e9da74ebe0 LibWeb: Implement manual slottable assignment
This implements manual slottable assignment by way of HTMLSlotElement's
`assign` API. This includes all of the slottable-related AOs needed to
perform the assignment.
2023-09-13 13:45:47 +02:00
Timothy Flynn 7870f10aa8 LibWeb: Introduce the slot concept for HTML slot elements
A slot is an HTMLSlotElement. It may have any number of slottable nodes
assigned to it.
2023-09-13 13:45:47 +02:00
Timothy Flynn 45b36bd08a LibWeb: Introduce the slottable concept for DOM elements and text nodes
A slottable is either a DOM element or a DOM text node. They may be
assigned to slots (HTMLSlotElement) either automatically or manually.
Automatic assignment occurs by matching a slot's `name` attribute to
a slottable's `slot` attribute. Manual assignment occurs by using the
slot's (not yet implemented) `assign` API.

This commit does not perform the above assignments. It just sets up the
slottable concept via IDL and hooks the slottable mixin into the element
and text nodes.
2023-09-13 13:45:47 +02:00
Timothy Flynn b85a252753 LibWeb: Implement the attribute-change-steps extension
This is similar to the run activation behavior in that elements may
define these steps themselves. HTMLSlotElement is one such element. The
existing (ad-hoc) Element::attribute_changed() method is not sufficient
there as the steps require knowledge of the attribute's old value and
its namespace, which this extension provides.

Unlike the run activation behavior, we store these steps in a list. An
element may end up defining multiple attribute change steps. For example
all DOM elements must define steps to handle the "slot" attribute, and
HTMLSlotElement must define steps to handle the "name" attribute.
2023-09-13 13:45:47 +02:00