Commit Graph

39 Commits

Author SHA1 Message Date
Sam Atkins
6c5450f9ce LibWeb: Report if anything is delaying load event, not the count
Some elements that delay the load event are more complicated than a
simple count will allow for. We'll implement those in a bit!
2023-12-01 10:28:02 +01:00
Andreas Kling
bfd354492e LibWeb: Put most LibWeb GC objects in type-specific heap blocks
With this change, we now have ~1200 CellAllocators across both LibJS and
LibWeb in a normal WebContent instance.

This gives us a minimum heap size of 4.7 MiB in the scenario where we
only have one cell allocated per type. Of course, in practice there will
be many more of each type, so the effective overhead is quite a bit
smaller than that in practice.

I left a few types unconverted to this mechanism because I got tired of
doing this. :^)
2023-11-19 22:00:48 +01:00
Aliaksandr Kalenik
44f7d7406c LibWeb: Use struct to pass Navigable::navigate() params
Using structs makes the navigate() calls looks cleaner. No change
in behavior is intended.
2023-10-12 03:25:06 +02:00
Andrew Kaster
dc0f7c4c54 LibWeb: Align NavigationParams and the creation AOs to the spec
And remove assorted spec FIXMEs along the way. Also align
populate_session_history_entry_document to the spec, with a bonus spec
bug to be filed.

This involves creating a new NonFetchSchemeNavigationParams spec, and
having the associated AOs take a Variant rather than Optional to
accomodate the fact that this extra struct could be returned by the
algorithm. We don't actually *do* anything with these params, but the
scaffolding is there now, with less TODOs.
2023-09-22 19:45:11 -06:00
Andrew Kaster
f296382e1a LibWeb: Implement inform the navigation api about aborting navigation
This also requires implementing the abort the ongoing navigation AO on
Navigation, which will be used from other NavigateEvent AOs.
2023-09-22 19:45:11 -06:00
Andrew Kaster
25ffe6becb LibWeb: Correct spelling of UserNavigationTiming enum
With luck we can Naviagate these typo-filled waters.
2023-09-22 19:45:11 -06:00
Andreas Kling
93e4a0de16 LibWeb: Move has_a_rendering_opportunity() to Navigable 2023-09-20 18:29:17 +02:00
Aliaksandr Kalenik
3634749d98 LibWeb: Update Window::open_impl() to use navigables 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
dd7bba66ed LibWeb: Change viewport ownership from BrowsingContext to Navigable 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
ee50d9b2b5 LibWeb: Update Page to use navigables 2023-09-16 16:53:32 +02:00
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
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
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
Andrew Kaster
6cfe19e5be LibWeb: Update Navigable::navigate() to the current state of the spec
A few parameters and step renumberings have happened since we first
implemented this algorithm.
2023-08-29 09:39:57 +02:00
Andrew Kaster
0ed67fc0ce LibWeb: Add virtual to check if a Navigable is a top level traversable
This avoids some AK::is casting when we need to check this property in
upcoming algorithms.
2023-08-29 09:39:57 +02:00
Andrew Kaster
34ea470d4f LibWeb: Add AO for navigation_must_be_a_replace to Navigable
This is used by both Navigable and Navigation, so let's put it in
Navigable. Also add a missing AK/String include to make clangd happier
with the Navigable file.
2023-08-25 19:51:13 +02:00
Aliaksandr Kalenik
38c7703fe8 LibWeb: Add allowPOST param in populate_session_history_entry_document 2023-08-14 17:46:46 +02:00
Timothy Flynn
c911781c21 Everywhere: Remove needless trailing semi-colons after functions
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Andreas Kling
406e3ed849 LibWeb: Implement getting the container document of a navigable
Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-06-23 16:20:29 +02:00
Aliaksandr Kalenik
d85bdd3ac5 LibWeb: Add API for finding NavigableContainer by content navigable
This is only needed because currently spec doesn't explicitly define
that navigable should have a pointer to associated container and when
this pointer should be set.
2023-06-23 16:20:29 +02:00
Aliaksandr Kalenik
2cbc9a6642 LibWeb: Start fleshing out Navigable::choose_a_navigable()
Equivalent of `choose_a_browsing_context` for navigables.
2023-06-22 18:18:50 +02:00
Aliaksandr Kalenik
ffd5b3da16 LibWeb: Implement reload for navigables 2023-06-20 18:30:27 +02:00
Aliaksandr Kalenik
09cb266cb8 LibWeb: Implement "activate history entry" for navigables 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
0285a363e2 LibWeb: Add set_current_session_history_entry setter for Navigable 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
eb4db6057d LibWeb: Implement child_navigables() for navigables 2023-06-19 21:28:20 +02:00
Timothy Flynn
872e18f660 LibWeb: Convert Navigable::navigate's csp_navigation_type to an enum
Some versions of clang will have an issue using a consteval function to
set the optional parameter's default value. For example, see:
https://stackoverflow.com/questions/68789984/immediate-function-as-default-function-argument-initializer-in-clang

This doesn't need to be a String anyways, so let's make it an enum.
2023-05-08 20:54:31 -06:00
Aliaksandr Kalenik
de2c016556 LibWeb: Implement "attempt to populate the history entry's document"
Implements:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document

This is going to be a replacement for `FrameLoader::load()` after
switching to navigables.

Brief description of `populate_session_history_entry_document`:
- If navigation params have url with fetch scheme then DOM document
  will be populated by fetching url and parsing response. This
  is going to be a replacement for `FrameLoader::load(AK::URL&)`.
- If url in navigation params is abort:srcdoc then DOM document
  will be populated by parsing HTML text passed in document resource.
  This is going to be a replacement for `FrameLoader::load_html()`
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
6ec88b36b9 LibWeb: Implement "get the target history entry" for navigables 2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
d9d8896380 LibWeb: Implement "get session history entries" for navigables
https://html.spec.whatwg.org/multipage/browsing-the-web.html#getting-session-history-entries
2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
c9c8f2413f LibWeb: Change Navigable::traversable_navigable() to be const 2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
9a19bdbfcf LibWeb: Implement Navigable::initialize_navigable() 2023-04-26 15:51:50 +02:00
Aliaksandr Kalenik
ce9d9a10b8 LibWeb: Start fleshing out Navigable::navigate()
Start implementation of https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate

Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-04-25 12:54:01 +02:00
Aliaksandr Kalenik
1ee4a3e310 LibWeb: Add m_ongoing_navigation in Navigable 2023-04-25 12:54:01 +02:00
Andreas Kling
6e416284b9 LibWeb: Add API for finding Navigable with a given active document
This will be used to look up a document's node navigable. It might be
nice to have a direct pointer from Document to its Navigable, but at
the moment I don't understand the algorithms well enough to maintain
that linkage.
2023-04-23 15:41:05 +02:00
Andreas Kling
54e01824c7 LibWeb: Implement getting the top-level traversable of a navigable 2023-04-23 14:18:57 +02:00
Andreas Kling
05dc1da321 LibWeb: Implement getting the traversable navigable of a navigable 2023-04-23 14:18:57 +02:00
Andreas Kling
2d602dcb34 LibWeb: Add HTML::Navigable
This is the first step towards implementing the new "navigable" concept
from the HTML spec.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-19 18:26:45 +02:00