Commit Graph

168 Commits

Author SHA1 Message Date
Shannon Booth
e800605ad3 AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of
the system, as LibCore depends on LibURL.

This change has two main benefits:
 * Moving AK back more towards being an agnostic library that can
   be used between the kernel and userspace. URL has never really fit
   that description - and is not used in the kernel.
 * URL _should_ depend on LibUnicode, as it needs punnycode support.
   However, it's not really possible to do this inside of AK as it can't
   depend on any external library. This change brings us a little closer
   to being able to do that, but unfortunately we aren't there quite
   yet, as the code generators depend on LibCore.
2024-03-18 14:06:28 -04:00
Andreas Kling
94e55768f6 LibWeb: Ensure layout is up-to-date before blinking the input cursor 2024-03-18 13:42:16 +01:00
Shannon Booth
9ce8189f21 Everywhere: Use unqualified AK::URL
Now possible in LibWeb now that there is no longer a Web::URL.
2024-02-25 08:54:31 +01:00
Shannon Booth
f9e5b43b7a LibWeb: Rename URL platform object to DOMURL
Along with putting functions in the URL namespace into a DOMURL
namespace.

This is done as LibWeb is in an awkward situation where it needs
two URL classes. AK::URL is the general purpose URL class which
is all that is needed in 95% of cases. URL in the Web namespace
is needed predominantly for interfacing with the javascript
interfaces.

Because of two URLs in the same namespace, AK::URL has had to be
used throughout LibWeb. If we move AK::URL into a URL namespace,
this becomes more painful - where ::URL::URL is required to
specify the constructor (and something like
::URL::create_with_url_or_path in other places).

To fix this problem - rename the class in LibWeb implementing the
URL IDL interface to DOMURL, along with moving the other Web URL
related classes into this DOMURL folder.

One could argue that this name also makes the situation a little
more clear in LibWeb for why these two URL classes need be used
in the first place.
2024-02-25 08:54:31 +01:00
Timothy Flynn
747fd86f26 LibWeb: Make WebDriver check if the BC's navigable has been destroyed
The spec steps to check if a browsing context is open have been updated
for navigables.
2024-02-06 08:40:27 +01:00
Andrew Kaster
888e67992a LibWeb: Remove unused BrowsingContext functions and data members
This aligns it better with the current state of the spec.

There's still some functions and data members that need moved into
Navigable or TraversableNavigable, but we can leave those for the next
cleanup PR.
2024-02-05 08:05:48 -07:00
Andrew Kaster
9645daaf6c LibWeb: Remove RemoteBrowsingContext and AbstractBrowsingContext
With the transition to Navigables, and a working implementation of
window.open(), we no longer need this abstraction layer.
2024-02-05 08:05:48 -07:00
Andrew Kaster
6e75440d5a LibWeb: Bring Document::fallback_base_url closer to the spec 2024-02-05 08:05:48 -07:00
Andrew Kaster
677bdc2a4f Ladybird: Add IPC call for creating a new child tab
This will be used for choosing a navigable that requires opening a new
tab or new window. Such as calls to window.open(), or specific WebDriver
calls.
2024-02-03 20:51:37 -05:00
Aliaksandr Kalenik
7ad0767aa0 LibWeb: Remove BrowsingContext::scroll_to()
Let's use navigable directly instead of going through browsing context
to request a scroll.
2024-02-03 19:00:26 +01:00
Aliaksandr Kalenik
bf14de4118 LibWeb: Remove direct calls of page_did_request_scroll_to()
By replacing the `page_did_request_scroll_to()` calls with a request
to perform scrolling in the corresponding navigable, we ensure that
the scrolling of iframes will scroll within them instead of triggering
scroll of top level document.
2024-02-03 19:00:26 +01:00
Andreas Kling
92b6edb35a LibWeb: Go directly from DOM node to paintable in cursor blink timer
No need to go via the layout tree anymore.
2024-01-16 12:02:02 +01:00
Aliaksandr Kalenik
7c2713c14f LibWeb: Move set_needs_display() from layout node to paintable
For this method, there is no need to go through the layout node when we
can directly reach the paintable.
2024-01-15 09:00:35 +01:00
Aliaksandr Kalenik
814bed33b4 LibWeb: Move box_type_agnostic_position() from layout node to paintable
For this method, there is no need to go through the layout node when we
can directly reach the paintable.
2024-01-15 09:00:35 +01:00
Aliaksandr Kalenik
31e5b5f5de LibWeb: Use paintable to represent event tracking node
The use of layout nodes likely predated the paintable tree, but now
there is no point in introducing another level of indirection.
2024-01-15 09:00:35 +01:00
Shannon Booth
0b7c8e0de5 LibWeb: Port BrowsingContext from ByteString
Also removing an unused m_name member.
2023-12-24 13:26:50 +01:00
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Andreas Kling
70193c0009 LibWeb: Let Document have a direct GCPtr to its containing Web::Page
With this change, Document now always has a Web::Page. This means we no
longer rely on the breakable link between Document and BrowsingContext
to find a relevant Web::Page.

Fixes #22290
2023-12-15 22:04:46 +01:00
Andreas Kling
bf4c8f4a09 LibWeb: Make BrowsingContext store Page member as NonnullGCPtr
No need to use WeakPtr anymore.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00
Shannon Booth
f976ec005c LibWeb: Port DOM::Document from DeprecatedString 2023-12-02 22:54:53 +01:00
Timothy Flynn
5913efbb45 LibWeb: Add a visit_edges() override to AbstractBrowsingContext
AbstractBrowsingContext has a subclass RemoteBrowsingContext without a
visit_edges() override (and it doesn't really need one). But currently,
we rely on subclasses visiting AbstractBrowsingContext's opener BC.

This adds a visit_edges() to AbstractBrowsingContext to explicitly visit
the opener BC itself.
2023-11-30 08:49:15 +00:00
Andrew Kaster
0104c8d052 LibWeb: Handle window.open() when passed a navigable name 2023-11-29 23:07:37 +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
Andreas Kling
3ff81dcb65 LibWeb: Make Web::Namespace::Foo strings be FlyString
This required dealing with a *lot* of fallout, but it's all basically
just switching from DeprecatedFlyString to either FlyString or
Optional<FlyString> in a hundred places to accommodate the change.
2023-11-04 21:28:30 +01:00
Andreas Kling
f052823f5f LibWeb: Use FlyString for create_element() namespace strings 2023-11-04 21:28:30 +01:00
Aliaksandr Kalenik
895ec6ad09 LibWeb: Remove unused append_child and remove_child in BrowsingContext
A part of post navigables cleanup.
2023-10-27 07:14:04 +02:00
Aliaksandr Kalenik
46254101f7 LibWeb: Change DOM::Position to be GC-allocated 2023-09-26 21:25:54 +02:00
Andrew Kaster
7e277797ad LibWeb: Add about base url to the various AOs that construct documents
And some assorted cleanup along the way. The browsing context and
document AOs in particular need re-alignment with the spec.
2023-09-22 19:45:11 -06:00
Andreas Kling
413cc1774e LibWeb: Remove unused BrowsingContext::scroll_offset_did_change() 2023-09-20 18:29:17 +02:00
Andreas Kling
93e4a0de16 LibWeb: Move has_a_rendering_opportunity() to Navigable 2023-09-20 18:29:17 +02:00
Andreas Kling
8e669c14c8 LibWeb: Remove unused BrowsingContext::document_family*() 2023-09-20 18:29:17 +02:00
Andreas Kling
38cb15ff49 LibWeb: Move system visibility state to TraversableNavigable
This no longer belongs in BrowsingContext.
2023-09-20 18:29:17 +02:00
Andreas Kling
046ae7fe86 LibWeb: Remove unused BrowsingContext::scroll_to_anchor() 2023-09-20 18:29:17 +02:00
Andreas Kling
94236c2532 LibWeb: Remove unused "frame nesting" tracking from BrowsingContext 2023-09-20 18:29:17 +02:00
Andreas Kling
51caa14381 LibWeb: Remove FrameLoader
This class is no longer used, now that we've moved to navigables.
2023-09-20 18:29:17 +02:00
Shannon Booth
b603e860af LibWeb: Port CharacterData from DeprecatedString to String
The existing implementation has some pre-existing issues where it is
incorrectly assumes that byte offsets are given through the IDL instead
of UTF-16 code units. While making these changes, leave some FIXMEs for
that.
2023-09-19 10:54:07 +02:00
Aliaksandr Kalenik
8e832a174e LibWeb: Update determine_the_origin to match the latest spec 2023-09-17 21:08:59 +02:00
Aliaksandr Kalenik
cd75b1de3d LibWeb: Delete discard() in Document and BrowsingContext
Those are not used anymore after moving to navigables.
2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
180c3e2fef LibWeb: Remove unused BrowsingContext::close()
Was replaced by close_top_level_traversable()
2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
bf785fee34 LibWeb: Remove unused BrowsingContext::container_document() 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
1f2ed7effc LibWeb: Remove outdated version of determine_the_origin() 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
7b91f79817 LibWeb: Delete unused BrowsingContext::is_child_of() 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
6942bdcfce LibWeb: Update top_level_browsing_context() to use navigables 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
fda420875d LibWeb: Delete BrowsingContext::set_active_document()
Superseded by Document::make_active()
2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
4532584b3a LibWeb: Remove unused BrowsingContext::create_a_new_browsing_context()
Became unused after introducing
create_a_new_browsing_context_and_document() used in navigables.
2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
6665f0db43 LibWeb: Delete unused document_tree_child_browsing_context_count()
The function is no longer needed with navigables.
2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
7daa462ef8 LibWeb: Remove BrowsingContext::create_a_new_top_level_browsing_context
This call has been replaced by
`create_a_new_top_level_browsing_context_and_document`
after specification was refactored to use navigables.
2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
3171abe92a LibWeb: Call Document::set_window() from Document::make_active() 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
24b3e315a0 LibWeb: Remove unused navigation methods in BrowsingContext 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