LibWeb: Allow style inheritance through slots

When a subtree is projected through a slot, its root now inherits style
from the slot's parent, rather than the parent of the unprojected root.

This fixes a ton of subtle issues, and is very noticeable on Reddit.
This commit is contained in:
Andreas Kling
2025-08-16 14:08:35 +02:00
committed by Andreas Kling
parent ba62679a7a
commit 9208a54b0b
Notes: github-actions[bot] 2025-08-16 19:04:51 +00:00
7 changed files with 64 additions and 34 deletions

View File

@@ -27,6 +27,7 @@ public:
GC::Ptr<Layout::NodeWithStyle const> layout_node() const { return const_cast<AbstractElement*>(this)->layout_node(); }
GC::Ptr<Element const> parent_element() const;
GC::Ptr<Element const> element_to_inherit_style_from() const;
Optional<AbstractElement> previous_in_tree_order() { return walk_layout_tree(WalkMethod::Previous); }
Optional<AbstractElement> previous_sibling_in_tree_order() { return walk_layout_tree(WalkMethod::PreviousSibling); }
bool is_before(AbstractElement const&) const;