From dabe162d44a2b8a47b7a9dc8566e7f51ae678d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=BClker?= Date: Sun, 19 Jan 2025 15:05:05 +0100 Subject: Implement shadow dom slots (#35013) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement slot-related algorithms Signed-off-by: Simon Wülker * Hook up slot elements to DOM creation logic Signed-off-by: Simon Wülker * Set a slot assignment mode for servo-internal shadow roots Signed-off-by: Simon Wülker * Assign slots when a slottable's slot attribute changes Signed-off-by: Simon Wülker * Properly compute slot name Signed-off-by: Simon Wülker * ./mach test-tidy Signed-off-by: Simon Wülker * Update name when name attribute changes Signed-off-by: Simon Wülker * Implement fast path for Node::assign_slottables_for_a_tree assign_slottables_for_a_tree traverses all descendants of the node and is potentially very expensive. If the node is not a shadow root then assigning slottables to it won't have any effect, so we take a fast path out. Signed-off-by: Simon Wülker * Move slottable data into ElementRareData This shrinks all element descendants back to their original size. Signed-off-by: Simon Wülker * Address review comments Signed-off-by: Simon Wülker * Update WPT expectations Signed-off-by: Simon Wülker --------- Signed-off-by: Simon Wülker --- components/script/dom/raredata.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'components/script/dom/raredata.rs') diff --git a/components/script/dom/raredata.rs b/components/script/dom/raredata.rs index d9b087d3b63..383eaaf70c3 100644 --- a/components/script/dom/raredata.rs +++ b/components/script/dom/raredata.rs @@ -12,6 +12,7 @@ use crate::dom::customelementregistry::{ CustomElementDefinition, CustomElementReaction, CustomElementState, }; use crate::dom::elementinternals::ElementInternals; +use crate::dom::htmlslotelement::SlottableData; use crate::dom::mutationobserver::RegisteredObserver; use crate::dom::node::UniqueId; use crate::dom::shadowroot::ShadowRoot; @@ -57,4 +58,6 @@ pub(crate) struct ElementRareData { pub(crate) client_rect: Option>>, /// pub(crate) element_internals: Option>, + + pub(crate) slottable_data: SlottableData, } -- cgit v1.2.3