mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
script: Skip clearing subtree layout boxes of detached element when attaching shadow to it (#44052)
There is no layout boxes to clear in this case. For the example in #43998, this skips the traversal many times. Testing: Should not change visible behaviour. [Try](https://github.com/servo/servo/actions/runs/24131782865). --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
@@ -699,8 +699,9 @@ impl Element {
|
||||
// non-shadow-tree children of `self` no longer have layout boxes as they are no
|
||||
// longer in the flat tree.
|
||||
let node = self.upcast::<Node>();
|
||||
node.remove_layout_boxes_from_subtree();
|
||||
|
||||
if node.is_connected() {
|
||||
node.remove_layout_boxes_from_subtree();
|
||||
}
|
||||
// Step 6. Set shadow's delegates focus to delegatesFocus
|
||||
shadow_root.set_delegates_focus(delegates_focus);
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ impl Node {
|
||||
}
|
||||
|
||||
/// Clear this [`Node`]'s layout data and also clear the layout data of all children.
|
||||
/// Note that clears layout data from all non-flat tree descendants and flat tree
|
||||
/// Note that this clears layout data from all non-flat tree descendants and flat tree
|
||||
/// descendants.
|
||||
pub(crate) fn remove_layout_boxes_from_subtree(&self) {
|
||||
for node in self.traverse_preorder(ShadowIncluding::Yes) {
|
||||
|
||||
Reference in New Issue
Block a user