summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
AgeCommit message (Collapse)Author
2022-09-06LibWeb: Make NodeIterator GC-allocatedAndreas Kling
2022-09-06LibWeb: Move event listeners, handlers and callbacks to the GC heapAndreas Kling
This patch moves the following things to being GC-allocated: - Bindings::CallbackType - HTML::EventHandler - DOM::IDLEventListener - DOM::DOMEventListener - DOM::NodeFilter Note that we only use PlatformObject for things that might be exposed to web content. Anything that is only used internally inherits directly from JS::Cell instead, making them a bit more lightweight.
2022-09-06LibWeb: Make DOMImplementation GC-allocatedAndreas Kling
2022-09-06LibWeb: Make DOMTokenList GC-allocatedAndreas Kling
2022-09-06LibWeb: Make NamedNodeMap GC-allocatedAndreas Kling
2022-09-06LibWeb: Make CSSStyleDeclaration GC-allocatedAndreas Kling
2022-09-06LibWeb: Make CSSRuleList GC-allocatedAndreas Kling
2022-09-06LibWeb: Make StyleSheetList GC-allocatedAndreas Kling
2022-09-06LibWeb: Make StyleSheet and CSSStyleSheet GC-allocatedAndreas Kling
2022-08-27LibJS+LibWeb: Remove last uses of GlobalObject::associated_realm()Linus Groh
2022-08-26LibWeb: Determine the origin when navigating across documentsMacDue
2022-08-25LibWeb: Add GridFormattingContextmartinfalisse
2022-08-23LibWeb: Restore realm retrieval from 'this' in activate_event_handler()Linus Groh
Removing the FIXME'd code in b99cc7d was a bit too eager, and relying on the main thread VM's current realm only works when JS is being executed. Restore a simplified version of the old code to determine the realm this time instead of the global object, following the assumptions already made in get_current_value_of_event_handler() regarding what kind of event target 'this' can be.
2022-08-23LibJS: Remove GlobalObject parameter from native functionsLinus Groh
2022-08-23LibWeb: Replace GlobalObject with Realm in wrapper functionsLinus Groh
Similar to create() in LibJS, wrap() et al. are on a low enough level to warrant passing a Realm directly instead of relying on the current realm from the VM, as a wrapper may need to be allocated while no JS is being executed.
2022-08-23LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]Linus Groh
This is where the fun begins. :^)
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-23LibJS+LibWeb: Replace GlobalObject with Realm in create() functionsLinus Groh
This is a continuation of the previous two commits. As allocating a JS cell already primarily involves a realm instead of a global object, and we'll need to pass one to the allocate() function itself eventually (it's bridged via the global object right now), the create() functions need to receive a realm as well. The plan is for this to be the highest-level function that actually receives a realm and passes it around, AOs on an even higher level will use the "current realm" concept via VM::current_realm() as that's what the spec assumes; passing around realms (or global objects, for that matter) on higher AO levels is pointless and unlike for allocating individual objects, which may happen outside of regular JS execution, we don't need control over the specific realm that is being used there.
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: Add API for setting a document's referrerAndreas Kling
2022-08-05LibWeb: Store document origin as a HTML::Origin objectAndreas Kling
This will allow us to remember an arbitrary origin instead of deriving it from the document's URL.
2022-08-05LibWeb: Clear the "is initial about:blank" flag in Document.write()Andreas Kling
2022-08-05LibWeb: Use Document::m_type to check for XML documentsAndreas Kling
...instead of doing a string compare on the DOCTYPE node.
2022-08-05LibWeb: Start implementing "create and initialize a Document" from HTMLAndreas Kling
The way we've been creating DOM::Document has been pretty far from what the spec tells us to do, and this is a first big step towards getting us closer to spec. The new Document::create_and_initialize() is called by FrameLoader after loading a "text/html" resource. We create the JS Realm and the Window object when creating the Document (previously, we'd do it on first access to Document::interpreter().) The realm execution context is owned by the Environment Settings Object.
2022-08-05LibWeb: Move DOM::Document factory functions out of lineAndreas Kling
2022-08-05LibWeb: Add the "is initial about:blank" flag to DOM::DocumentAndreas Kling
2022-07-30LibWeb: Resolve circular IDL importsMacDue
These circular imports led to the generator silently failing to generate the required methods/properties.
2022-07-29LibWeb: Extract the InnerHTML IDL mixinSam Atkins
2022-07-29LibWeb: Extract the ParentNode IDL mixinSam Atkins
2022-07-29LibWeb: Correct typo in Document.idlSam Atkins
Makes me wonder how things were working when Document was never including GlobalEventHandlers.
2022-07-29LibWeb: Extract the ChildNode IDL mixinSam Atkins
2022-07-27LibWeb: Add fast_is<HTMLElement>()Andreas Kling
This avoids slow RTTI lookups in selector matching.
2022-07-27LibWeb: Add fast_is<HTMLBaseElement>()Andreas Kling
This avoids slow RTTI lookups in Document::base_url().
2022-07-26LibWeb: Move "has-definite-width/height" flags to UsedValuesAndreas Kling
This state is less static than we originally assumed, and there are special formatting context-specific rules that say certain sizes are definite in special circumstances. To be able to support this, we move the has-definite-size flags from the layout node to the UsedValues struct instead.
2022-07-26LibWeb: Destroy ICB formatting context before committing used valuesAndreas Kling
Absolutely positioned boxes are handled by the BFC destructor, so we need to make sure the ICB BFC is destroyed if we want these boxes to get laid out.
2022-07-19LibWeb: Add accessors for UsedValues::computed_{width,height}Andreas Kling
This is preparation for doing some more work when assigning to these values.
2022-07-17LibWeb: Add & use TRY_OR_RETURN_OOM macroLinus Groh
This is a convenient way to return a DOM exception for operations that return ErrorOr and only have an OOM failure path.
2022-07-17LibWeb: Fix queuing mutation records for node removalLuke Wilde
Step 19 of node removal was missing, which allows the mutations of the descendants of the removed node to still be observed by the parent. Step 20 of node removal queued the mutation record for the removed node instead of it's parent. Since queuing takes place after the node is removed from the tree, the mutation record would be lost as the only inclusive ancestor of the node at this point is only the node itself.
2022-07-17LibWeb: Rename LayoutState::NodeState => LayoutState::UsedValuesAndreas Kling
This object contains all the CSS "used values" as seen during the layout process, so calling it "used values" seems appropriate. :^)
2022-07-17LibWeb: Rename FormattingState to LayoutStateAndreas Kling
This seems a bit more descriptive (and also a bit shorter).
2022-07-14LibWeb: Move Origin into the HTML namespaceLinus Groh
Origin is defined in the HTML Standard, and therefore belongs into the HTML directory and namespace in LibWeb. https://html.spec.whatwg.org/multipage/origin.html#origin
2022-07-12LibWeb: Traverse shadow-including subtree when adopting DOM nodesAndreas Kling
This takes care of two FIXMEs and fixes an issue on Google Docs where we'd mix boxes from different documents in the same layout tree. (This happened because shadow trees remained attached to their old document when their host was adopted.)
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-11LibWeb: Implement all "attributes" mutation records for MutationObserverLuke Wilde
2022-07-11LibWeb: Implement "characterData" mutation record for MutationObserverLuke Wilde
2022-07-11LibWeb: Implement all "childList" mutation records for MutationObserverLuke Wilde
2022-07-11LibWeb: Introduce Mutation{Record,Observer} and observer microtasksLuke Wilde
2022-07-11LibWeb: Implement CharacterData.{append,insert,delete}DataLuke Wilde
2022-07-11LibWeb: Implement CharacterData::set_data in terms of replace_dataLuke Wilde
This makes it so that it always queues a mutation record, even if `data` is set to the same value. It also makes it follow the spec steps.