summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
AgeCommit message (Collapse)Author
2022-03-31LibWeb: Add 'is scripting enabled' concept to EnvironmentSettingsObjectLinus Groh
This is now the source of truth for 'user enabled/disabled scripting', but it has to ask the window's page, which actually stores the setting. Also use this new functionality in two places where it was previously marked as a FIXME.
2022-03-31LibWeb: Remove Document::is_scripting_enabled() and use Node'sLinus Groh
There's no need to have a custom is_scripting_enabled() for the Document class, as it (indirectly) inherits from Node. Also, let's not hardcode false here :^)
2022-03-31LibWeb: Replace ad-hoc EventHandler type with callback function typedefIdan Horowitz
2022-03-30LibWeb: Implement Element.toggleAttribute()Elisée Maurer
2022-03-30LibWeb: Add fast_is<T>() for some common DOM Node subclassesAndreas Kling
2022-03-29LibWeb: Streamline how inline CSS style declarations are constructedAndreas Kling
When parsing the "style" attribute on elements, we'd previously ask the CSS parser for a PropertyOwningCSSStyleDeclaration. Then we'd create a new ElementCSSInlineStyleDeclaration and transfer the properties from the first object to the second object. This patch teaches the parser to make ElementCSSInlineStyleDeclaration objects directly.
2022-03-28LibWeb: Rename parse_css_declaration() -> parse_css_style_attribute()Sam Atkins
2022-03-27LibWeb: Ensure lazy WindowObject creation when activating event handlerLinus Groh
2022-03-24LibWeb: Remove inheritance of FormAssociatedElement from HTMLElementTimothy Flynn
HTMLObjectElement will need to be both a FormAssociatedElement and a BrowsingContextContainer. Currently, both of these classes inherit from HTMLElement. This can work in C++, but is generally frowned upon, and doesn't play particularly well with the rest of LibWeb. Instead, we can essentially revert commit 3bb5c62 to remove HTMLElement from FormAssociatedElement's hierarchy. This means that objects such as HTMLObjectElement individually inherit from FormAssociatedElement and HTMLElement now. Some caveats are: * FormAssociatedElement still needs to know when the HTMLElement is inserted into and removed from the DOM. This hook is automatically injected via a macro now, while still allowing classes like HTMLInputElement to also know when the element is inserted. * Casting from a DOM::Element to a FormAssociatedElement is now a sideways cast, rather than directly following an inheritance chain. This means static_cast cannot be used here; but we can safely use dynamic_cast since the only 2 instances of this already use RTTI to verify the cast.
2022-03-23LibWeb: Fill the whole viewport with the correct background colorAndreas Kling
CSS2 tells us to use the HTML element's background color if not transparent. Otherwise, the BODY element's background color.
2022-03-23LibWeb: Make NodeIterator behave like other browser enginesAndreas Kling
If invoking a NodeFilter ends up deleting a node from the DOM, it's not enough to only adjust the NodeIterator reference nodes in the pre-removing steps. We must also adjust the current traversal pointer. This is not in the spec, but it's how other engines behave, so let's do the same. I've encapsulated the Node + before-or-after-flag in a struct called NodePointer so that we can use the same pre-removing steps for both the traversal pointer and for the NodeIterator's reference node. Note that when invoking the NodeFilter, we have to remember the node we passed to the filter function, so that we can return it if accepted by the filter. This gets us another point on Acid3. :^)
2022-03-23LibWeb: Minor cleanups in NodeIterator and TreeWalkerAndreas Kling
- Use TRY() when invoking the NodeFilter - Say "nullptr" instead of "RefPtr<Node> {}"
2022-03-22LibWeb: Implement Range.deleteContents()Andreas Kling
And here's another point on Acid3. :^)
2022-03-22LibWeb: Implement Range.cloneContents()Andreas Kling
2022-03-22LibWeb: Convert Text to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert ShadowRoot to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert ParentNode to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert NodeOperations to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert Node to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert Element to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert DOMTokenList to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert DOMImplementation to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert Document to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Convert ChildNode to use TRY for error propagationLinus Groh
2022-03-22LibWeb: Explicitly ignore [[nodiscard]] values returned from TRY()Linus Groh
This broke the clang build.
2022-03-22LibWeb: Convert Range to use TRY for error propagationTimothy Flynn
2022-03-22LibWeb: Make DOM::ExceptionOr compatible with the TRY macroTimothy Flynn
This will help reduce the quite repetitive pattern of: auto result_or_error = dom_node->do_something(); if (result_or_error.is_exception()) return result_or_error.exception(); auto result = result_or_error.release_value(); Similar to LibJS completions, this adds an alias to the error accessors. This also removes the requirement on release_value() for ValueType to not be Empty, which we also had to do for TRY compatibility in LibJS.
2022-03-22LibWeb: Fix crash when removing event listenersJamie Mansfield
2022-03-22LibWeb: Expose HTMLCollection's root element to its subclassesTimothy Flynn
For example, HTMLOptionsCollection will need to access its root HTMLSelectElement.
2022-03-21LibWeb: Implement Range.surroundContents(newParent)Andreas Kling
Here goes another Acid3 point :^)
2022-03-21LibWeb: Fix two spec transcription mistakes in live range updatingAndreas Kling
This scores us another point on Acid3. :^)
2022-03-21LibWeb: Fix spec transcription mistake in Range.extractContents()Andreas Kling
The spec text and code didn't match up. Thanks to Tim for spotting this! :^)
2022-03-21LibWeb: Don't allow setting Range start/end to document being destroyedAndreas Kling
2022-03-21LibWeb: Update live ranges on Node insertion and removalAndreas Kling
Taking care of some old FIXMEs :^)
2022-03-21LibWeb: Update live DOM ranges on Text and CharacterData mutationsAndreas Kling
Taking care of the FIXMEs I added in earlier patches. :^)
2022-03-21LibWeb: Implement Range.insertNode(node)Andreas Kling
2022-03-21LibWeb: Implement Text.splitText(offset)Andreas Kling
With FIXMEs about updating live ranges, but still.
2022-03-21LibWeb: Fix logic mistakes in Range stringificationAndreas Kling
We were passing the wrong length argument to substring() when stringifying a range where start and end are the same text node. Also, make sure we visit all the contained text nodes when appending them to the output. This was caught by an Acid3 subtest.
2022-03-21LibWeb: Implement Range.extractContents()Andreas Kling
Another point on Acid3 coming through! :^)
2022-03-21LibWeb: Add CharacterData.replaceData(offset, count, data)Andreas Kling
Note that we don't queue mutation records or update live ranges yet, I've left those as FIXMEs.
2022-03-21LibWeb: Add CharacterData.substringData(offset, count)Andreas Kling
2022-03-21LibWeb: Implement stringifier for DOM Range :^)Andreas Kling
2022-03-21LibWeb: Only invalidate stacking context tree for opacity/z-index changeAndreas Kling
I came across some websites that change an elements CSS "opacity" in their :hover selectors. That caused us to relayout on hover, which we'd like to avoid. With this patch, we now check if a property only affects the stacking context tree, and if nothing layout-affecting has changed, we only invalidate the stacking context tree, causing it to be rebuilt on next paint or hit test. This makes :hover { opacity: ... } rules much faster. :^)
2022-03-21LibWeb: Build stacking context tree lazilyAndreas Kling
There's no actual need to build the stacking context tree before performing layout. Instead, make it lazy and build the tree when it's actually needed for something. This avoids a bunch of work in situations where multiple synchronous layouts are forced (typically by JavaScript) without painting or hit testing taking place in between. It also opens up for style invalidations that only target the stacking context tree.
2022-03-20LibWeb: Grey out invisible nodes in the DOM inspectorSimon Wanner
This makes it easier to navigate large DOM trees where some nodes have display: none
2022-03-20LibWeb: Layout browsing context parent before its childrenAndreas Kling
When updating layout inside a nested browsing context, try first to perform layout in the parent document (the nested browsing context's container's document). This ensures that nested browsing contexts have the right viewport dimensions in case the parent layout changes them somehow.
2022-03-20LibWeb: Clear element.style when the "style" attribute is removedAndreas Kling
We were hanging on to element inline style, even after the style attribute was removed. This made inline style sticky and impossible to remove. This patch fixes that. :^)
2022-03-20LibWeb: Evaluate @media CSS rules when updating styleAndreas Kling
In case we have new @media rules, we need to make sure we've evaluated them before actually recomputing styles for the document.
2022-03-20LibWeb: Add a barebones SVGTextContentElement with getNumberOfChars()Andreas Kling
2022-03-19LibWeb: Make document-level style invalidation fastAndreas Kling
Add a flag to DOM::Document that means the whole document needs a style update. This saves us the trouble of traversing the entire DOM to mark all nodes as needing a style update.