summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
AgeCommit message (Collapse)Author
2022-11-19Everywhere: Remove unnecessary mutable attributes from lambdasMacDue
These lambdas were marked mutable as they captured a Ptr wrapper class by value, which then only returned const-qualified references to the value they point from the previous const pointer operators. Nothing is actually mutating in the lambdas state here, and now that the Ptr operators don't add extra const qualifiers these can be removed.
2022-11-15LibWeb: Bring BrowsingContext::choose_a_browsing_context closer to specIdan Horowitz
2022-11-15LibWeb: Add the 'opener browsing context' BrowsingContext propertyIdan Horowitz
This will also be used by the window.open algorithm steps.
2022-11-08LibWeb: Add a flag to track when a browsing context has been discardedTimothy Flynn
2022-10-31LibWeb: Handle currently ignored `WebIDL::ExceptionOr<T>`sLinus Groh
2022-10-30LibWeb: Make Fetch::Infrastructure::{Request,Response,HeaderList} GC'dLinus Groh
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-24LibWeb: Move url_origin() to URL/URL.{cpp,h}Linus Groh
2022-10-20LibWeb: Make the layout tree GC-allocatedAndreas Kling
This removes a set of complex reference cycles between DOM, layout tree and browsing context. It also makes lifetimes much easier to reason about, as the DOM and layout trees are now free to keep each other alive.
2022-10-20LibWeb: Make BrowsingContext GC-allocatedAndreas Kling
(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-20LibWeb: Tear down old layout tree when new document becomes activeAndreas Kling
When a new document becomes the active document of a browsing context, we now notify the old document, allowing it to tear down its layout tree. In the future, there might be more cleanups we'd like to do here.
2022-10-20LibWeb: Create and hook up a WindowProxy for each BrowsingContextAndreas Kling
All the machinery for this was already in place, we just never created the actual WindowProxy and installed it.
2022-10-05LibWeb: Make Fetch::Infrastructure::{Request,Response} ref-countedLinus Groh
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-05LibWeb: Rename HighResolutionTime/{CoarsenTime => TimeOrigin}.cpp/hLinus Groh
This is being used for more than just time coarsening now, so let's use the spec's section title for the name.
2022-10-05LibWeb: Move unsafe_shared_current_time() to HighResolutionTimeLinus Groh
This doesn't belong on the EventLoop at all, as far as I can tell.
2022-10-01LibWeb: Remove unecessary dependence on Window from HTML classesAndrew Kaster
These classes only needed Window to get at its realm. Pass a realm directly to construct HTML classes.
2022-10-01LibWeb: Move Web prototypes and constructors to new Intrinsics objectAndrew Kaster
This Intrinsics object hangs off of a new HostDefined struct that takes the place of EnvironmentSettingsObject as the true [[HostDefined]] slot on JS::Realm objects created by LibWeb. This gets the intrinsics off of the GlobalObject, Window, similar to the previous refactor of LibJS to move the intrinsics into the Realm's [[Intrinics]] internal slot. A side effect of this change is that we cannot fully initialize a Window object until the [[HostDefined]] slot has been installed into the realm, which happens with the creation of the WindowEnvironmentSettingsObject. As such, any Window usage that has not been funned through a WindowESO will not have any cached Web prototyped or constructors, and will not have Window APIs available to javascript code. Currently this seems limited to usage of Window in the CSS parser, but a subsequent commit will clean those up to take Realm as well. However, this commit compiles so let's cut it off here :^).
2022-09-29LibWeb: Don't force layout when scrolling to non-existent anchorAndreas Kling
If we're asked to scroll to an anchor element that's not actually in the document, we don't need to perform a layout.
2022-09-29AK+Everywhere: Replace "protocol" with "scheme" url helpersnetworkException
URL had properly named replacements for protocol(), set_protocol() and create_with_file_protocol() already. This patch removes these function and updates all call sites to use the functions named according to the specification. See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-25LibWeb: Move DOMException from DOM/ to WebIDL/Linus Groh
2022-09-25LibWeb: Move ExceptionOr from DOM/ to WebIDL/Linus Groh
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-24LibWeb: Remove now-unnecessary JS::Handles in HTML task capture listsAndreas Kling
JS::SafeFunction will protect anything captures for HTML tasks now.
2022-09-21LibWeb: Abort the active document when navigating a browsing contextAndreas Kling
2022-09-21LibWeb: Implement the "close" algorithm for browsing contextsAndreas Kling
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-21LibWeb: Save document load timing when creating browsing contextAndreas Kling
2022-09-20LibWeb: Implement Document/BrowsingContext hookup according to specAndreas Kling
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-20LibWeb+WebContent+Browser: Plumb visibility state from GUI to web pagesAndreas Kling
OOPWV now reacts to show/hide events and informs LibWeb about the state change. This makes visibilitychange events fire when switching tabs. :^)
2022-09-20LibWeb: Flesh out a chunk of the HTML spec's frame navigation algorithmsAndreas Kling
2022-09-20LibWeb: Implement "browsing context group" concept from the HTML specAndreas Kling
2022-09-17LibWeb: Implement basic "scroll" events at the document levelAndreas Kling
2022-09-09LibWeb: Implement window.lengthnetworkException
2022-09-07LibWeb+WebContent: Add abstraction layer for event loop and timersAndreas Kling
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-06LibWeb: Remove now-unused Bindings::Wrapper classAndreas Kling
2022-09-06LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocatedAndreas Kling
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-08-26LibWeb: Don't return an opaque origin for file:// URLsMacDue
The protocol of the origin is used for checking if the a file:// iframe is allowed to be loaded (a document with a file:// origin can load other files in iframes). This used to be the case, but was changed in 6e71e400e696a92bbc2a69e6a59efddc29b926ce, which broke file:// iframes.
2022-08-26LibWeb: Determine the origin when navigating across documentsMacDue
2022-08-23LibJS+LibWeb: Replace GlobalObject with Realm in Heap::allocate<T>()Linus Groh
This is a continuation of the previous three commits. Now that create() receives the allocating realm, we can simply forward that to allocate(), which accounts for the majority of these changes. Additionally, we can get rid of the realm_from_global_object() in one place, with one more remaining in VM::throw_completion().
2022-08-06LibJS+LibWeb: Restore type safety of Realm::set_global_object()Linus Groh
The changes from 8a03b17 to allow any JS::Value aren't a good fit, as shown by the excessive amount of verify_cast needed :^)
2022-08-05LibWeb: Bring browsing context creation closer to specAndreas Kling
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-05LibWeb: Remove page_did_set_document_in_top_level_browsing_context()Andreas Kling
This PageClient callback was never used for anything.
2022-08-05LibWeb: Add browsing context "still on its initial about:blank Document"Andreas Kling
2022-04-06LibWeb: Make BrowsingContext ask PageClient when it wants to be scrolledAndreas Kling
BrowsingContext shouldn't be scrolling itself, instead it has to update the layout (to ensure that we have current document metrics, and then ask the PageClient nicely to scroll it. This fixes an issue where BrowsingContext sometimes believed itself to be scrolled, but OOPWV had a different idea.
2022-03-26LibWeb: Bring handling of anchor elements closer to specsin-ack
This commit moves the regular handling of links to the anchor elements' activation behavior, and implements a few auxiliary algorithms as defined by the HTML specification. Note that certain things such as javascript links, fragments and opening a new tab are still handled directly in EventHandler, but they have been moved to handle_mouseup so that it behaves closer to how it would if it was entirely up-to-spec.
2022-03-20LibWeb: Invalidate style & layout inside iframes when they change sizeAndreas Kling
2022-03-17Libraries: Use default constructors/destructors in LibWebLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-03-16LibWeb: Implement window.nameSimon Wanner
Right now the only functionality supported is getting/setting via JS and resetting when browsing cross origin. The HTML Specification (7.11 Browsing the web) also specifies how the name should be restored from history entries, but we don't have those yet.
2022-03-16LibWeb: Invalidate layout on BrowsingContext resizeAndreas Kling
Even if style didn't change, we still need to force a layout, since the initial containing block depends on the viewport size.
2022-03-15LibWeb: Make BrowsingContext::reset_cursor_blink_cycle() more robustAndreas Kling
If the browsing context text cursor has become invalid for whatever reason, don't try to repaint its associated node.
2022-03-15LibWeb: Invalidate style when a browsing context's viewport is resizedAndreas Kling
Anything with viewport-relative CSS lengths (vw/vh/vmin/vmax) needs to have its style recomputed if the viewport size changes.
2022-03-08LibWeb: Move Window from DOM directory & namespace to HTMLLinus Groh
The Window object is part of the HTML spec. :^) https://html.spec.whatwg.org/multipage/window-object.html
2022-03-01LibWeb: Fix incorrect check in BrowsingContext::is_top_levelLuke Wilde
A top level browsing context is a browsing context with no parent browsing context. However, we considered a top level browsing context to be a browsing context with no associated browsing context container.