Commit Graph

97 Commits

Author SHA1 Message Date
Tim Ledbetter
398bf10b92 LibWeb: Use TraversalDecision for multi level Node traversal methods
This adds the `SkipChildrenAndContinue` option, where traversal
continues but child nodes are not included.
2024-05-07 16:45:28 -06:00
Andreas Kling
3945e1a82a LibJS: Make JS::Cell a Weakable
This makes things easier downstream of Cell, and is preparation for
using weak pointers in prototype chain property caches.
2024-05-04 21:42:59 +02:00
Andreas Kling
0ebfc0a4c4 LibWeb: Move event handling & cursor from BrowsingContext to Navigable
This was a long standing FIXME since the introduction of navigables.
2024-04-26 20:01:58 +02:00
Aliaksandr Kalenik
39f74d3437 LibWeb: Bring HistoryHandlingBehavior up to date with the specification
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2024-03-28 15:34:52 +01:00
Aliaksandr Kalenik
561e011e07 LibWeb+WebContent+Ladybird: Add ability to paste text from clipboard
Text can be pasted by pressing Ctrl/Cmd+V or by using button in the
context menu. For now only the Qt client is supported.
2024-03-22 15:47:33 -04:00
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
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
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
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
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
Shannon Booth
88f8ea7c60 LibWeb: Make BrowsingContex::page() return a Page&
This exposed a whole slew of now-unnecessary null checks. :^)

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +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
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
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
Andreas Kling
f31b39ca18 LibWeb: Remove unused BrowsingContext::for_each_child() 2023-09-20 18:29:17 +02: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
a02d42dea2 LibWeb: Remove two unused BrowsingContext member variables 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
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
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
Andrew Kaster
5f0fb84379 LibWeb: Stub out determine_the_creation_sandboxing_flags 2023-08-29 09:39:57 +02:00
Andrew Kaster
a565021147 LibWeb: De-duplicate definition of url_matches_about_blank
We don't need two static methods for this.
2023-08-29 09:39:57 +02:00
Aliaksandr Kalenik
5ff7448fee LibWeb: Move viewport subscriptions from BrowsingContext to Document
With this change, elements that want to receive viewport rect updates
will need to register on document instead of the browsing context.

This change solves the problem where a browsing context for a document
is guaranteed to exist only while the document is active so browsing
context might not exit by the time DOM node that want to register is
constructed.

This is a part of preparation work before switching to navigables where
this issue becomes more visible.
2023-08-23 20:14:20 +02:00
Aliaksandr Kalenik
b2b99aba95 LibWeb: Use Core::Timer for cursor blink timer in BrowsingContext
Using `Core::Timer` that doesn't implicitly convert callback to
`JS::SafeFunction` fixes the bug when `BrowsingContext` is never
destroyed because of cyclic dependency between callback and
`BrowsingContext`.
2023-08-19 16:41:53 +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
6ae208dbf6 LibWeb: Broadcast the viewport rect to clients immediately after layout
This lets elements figure out if they're visible within the viewport or
not, so they take appropriate action.

Fixes the issues with animations not starting until the viewport was
resized or scrolled.
2023-05-09 09:48:49 +02:00
Aliaksandr Kalenik
3b00636288 LibWeb: Implement "create a new browsing context and document"
Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-04-24 07:57:15 +02:00
Andreas Kling
6871fbce9f LibWeb: Implement the "top-level traversable" of a browsing context 2023-04-24 07:57:15 +02:00