Commit Graph

58 Commits

Author SHA1 Message Date
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
Andreas Kling
65467021e2 LibWeb: Add updated version of "determine the origin" AO from HTML spec
The old version is still around since it has many users, so we can't
remove it until everything has been updated to use the new version.
2023-04-24 07:57:15 +02:00
Aliaksandr Kalenik
9f691b7fe4 LibWeb: Convert navigationId from DeprecatedString to String 2023-04-24 07:55:20 +02:00
Andreas Kling
d8ccc2d54e LibWeb: Rename BrowsingContextContainer => NavigableContainer
The "browsing context container" concept in the HTML spec has been
replaced with "navigable container". Renaming this is the first step of
many towards implementing the new world.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-19 18:26:45 +02:00
Andreas Kling
3b0e5a87db LibWeb: Make SessionHistoryEntry GC-allocated
These will need to float around more than they're currently able to.
Put them on the GC heap to prepare for that.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-15 14:05:00 +02:00
Timothy Flynn
2a410f8985 LibWeb: Change "popup"-related storage types to named enums 2023-03-22 00:12:53 +01:00
Timothy Flynn
1b811191cd LibWeb+WebContent: Change the "noopener" storage type to a named enum 2023-03-22 00:12:53 +01:00
Timothy Flynn
e6fc35897f WebContent+Everywhere: Add an option to not activate new tabs over IPC
WebDriver, for example, will want to create new tabs without activating
them.
2023-03-21 09:39:49 +00:00
Aliaksandr Kalenik
40ec976781 LibWeb: Inherit BrowsingContext from AbstractBrowsingContext 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik
6d91d2fa50 WebContent: Add IPC call to set window handle from WebContent client 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik
d87a207ca9 LibWeb: Add handle member in BrowsingContext
`handle` is uuid that is going to be used in WebDriver to identify
browsing context.
2023-03-16 13:17:37 -04:00
Luke Wilde
2ca8cf49ca LibWeb: Use browsing context creator URL for about:blank documents
In about:blank documents, we should use the browsing context's creator
URL as the base URL, if it exists and there is no <base> element.
This means that any about:blank frames will have URLs parse relative to
their parent frame's URL.

Fixes #17394.
2023-02-21 18:52:46 +01:00
Sam Atkins
affc8a22ca LibWeb+WebContent: Convert BrowsingContext to new pixel units
This fixes a few glitches. We no longer give the page double the width
it should have, and we mark the correct area of the page as needing
repainting.
2023-01-05 17:42:31 +01:00
Sam Atkins
3c7bd5a317 LibWeb+WebContent+headless-browser: Use CSSPixels for PageClient events
...and also for hit testing, which is involved in most of them.

Much of this is temporary conversions and other awkwardness, which
should resolve itself as the rest of LibWeb is converted to these new
types. Hopefully. :thousandyakstare:
2022-12-10 12:03:19 +00:00
MacDue
27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Idan Horowitz
ff2f31bc81 LibWeb: Bring BrowsingContext::choose_a_browsing_context closer to spec 2022-11-15 21:48:19 +00:00
Idan Horowitz
c948873c5b LibWeb: Add the 'opener browsing context' BrowsingContext property
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Idan Horowitz
b27f855107 LibWeb: Add the 'is popup' BrowsingContext property
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Timothy Flynn
2d5381fd91 LibWeb: Add a flag to track when a browsing context has been discarded 2022-11-08 19:58:34 -05:00
Linus Groh
b1968b8bed LibWeb: Make Fetch::Infrastructure::{Request,Response,HeaderList} GC'd
This is the way.

On a more serious note, there's no reason to keep adding ref-counted
classes to LibWeb now that the majority of classes is GC'd - it only
adds the risk of discovering some cycle down the line, and forces us to
use handles as we can't visit().
2022-10-30 11:30:23 +00:00
Andreas Kling
83c5ff57d8 LibWeb: Make BrowsingContext GC-allocated
(And BrowsingContextGroup had to come along for the ride as well.)
This solves a number of nasty reference cycles between browsing
contexts, history items, and their documents.
2022-10-20 15:16:23 +02:00
Andreas Kling
3c548adf9c LibWeb: Create and hook up a WindowProxy for each BrowsingContext
All the machinery for this was already in place, we just never created
the actual WindowProxy and installed it.
2022-10-20 15:16:23 +02:00
leeight
2029c98fa7 LibWeb: Add missing property and methods for history object
We provide `length` property and `go` / `back` / `forward` methods
implementation here.
2022-10-14 16:01:35 +02:00
Linus Groh
1c12f5c31d LibWeb: Make Fetch::Infrastructure::{Request,Response} ref-counted
With the addition of the 'fetch params' struct, the single ownership
model we had so far falls apart completely.

Additionally, this works nicely for FilteredResponse's internal response
instead of risking a dangling reference.

Replacing the public constructor with a create() function also found a
few instances of a Request being stack-allocated!
2022-10-05 09:14:49 +01:00
Linus Groh
ad04d7ac9b LibWeb: Move ExceptionOr from DOM/ to WebIDL/
This is a concept fully defined in the Web IDL spec and doesn't belong
in the DOM directory/namespace - not even DOMException, despite the name
:^)
2022-09-25 19:13:31 +01:00
Andreas Kling
6c33dea6a6 LibWeb: Implement the "close" algorithm for browsing contexts
This is used by window.close() programmatically, but of course the user
can also decide to close a top-level browsing context at any time by
closing the tab.
2022-09-21 11:51:18 +02:00
Andreas Kling
92deba7197 LibWeb: Implement Document/BrowsingContext hookup according to spec
We now implement the browsing context's "set active document" algorithm
from the spec, as well as the "discard" algorithm for browsing contexts
and documents.
2022-09-20 23:44:59 +02:00
Andreas Kling
d4acdac317 LibWeb+WebContent+Browser: Plumb visibility state from GUI to web pages
OOPWV now reacts to show/hide events and informs LibWeb about the state
change. This makes visibilitychange events fire when switching tabs. :^)
2022-09-20 10:32:14 +02:00
Andreas Kling
4ee5dfbe4b LibWeb: Flesh out a chunk of the HTML spec's frame navigation algorithms 2022-09-20 10:32:13 +02:00
Andreas Kling
8ead228202 LibWeb: Implement "browsing context group" concept from the HTML spec 2022-09-20 10:32:12 +02:00
Andreas Kling
da451467b1 LibWeb: Implement basic "scroll" events at the document level 2022-09-17 18:53:26 +02:00
networkException
e377e28fd2 LibWeb: Implement window.length 2022-09-09 17:42:30 +01:00
Andreas Kling
9567e211e7 LibWeb+WebContent: Add abstraction layer for event loop and timers
Instead of using Core::EventLoop and Core::Timer directly, LibWeb now
goes through a Web::Platform abstraction layer instead.

This will allow us to plug in Qt's event loop (and QTimer) over in
Ladybird, to avoid having to deal with multiple event loops.
2022-09-07 20:30:31 +02:00
Andreas Kling
6f433c8656 LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.

There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
2022-09-06 00:27:09 +02:00
MacDue
8d2c2f7c52 LibWeb: Determine the origin when navigating across documents 2022-08-26 00:21:10 +02:00
Andreas Kling
2a7924f96c LibWeb: Bring browsing context creation closer to spec
This patch implements the "create a new browsing context" function from
the HTML spec and replaces our existing logic with it.

The big difference is that browsing contexts now initially navigate to
"about:blank" instead of starting out in a strange "empty" state.
This makes it possible for websites to create a new iframe and start
scripting inside it right away, without having to load an URL into it.
2022-08-05 12:46:42 +02:00
Andreas Kling
ffb23db57f LibWeb: Add browsing context "still on its initial about:blank Document" 2022-08-05 12:42:46 +02:00
Andreas Kling
c4a0b7057b LibWeb: Add basic skeleton of HTML "session history" to BrowsingContext 2022-08-05 12:42:46 +02:00