Skip to content

Commit 24c8486

Browse files
MacDueawesomekling
authored andcommitted
LibWeb: Don't lay out light DOM children of elements with a shadow root
This fixes the "last changed" time for files on GitHub. Note that this appears to be in accordance with the shadow DOM specification, but I can't find a line that neatly says it. Though on Google's post about shadow DOM v1 it says: > "the element's shadow DOM is rendered in place of its children." https://web.dev/shadowdom-v1/#creating-shadow-dom-for-a-custom-element
1 parent 1903e7f commit 24c8486

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
288288
for (auto* node = shadow_root->first_child(); node; node = node->next_sibling()) {
289289
TRY(create_layout_tree(*node, context));
290290
}
291+
} else {
292+
// This is the same as verify_cast<DOM::ParentNode>(dom_node).for_each_child
293+
for (auto* node = verify_cast<DOM::ParentNode>(dom_node).first_child(); node; node = node->next_sibling())
294+
TRY(create_layout_tree(*node, context));
291295
}
292-
293-
// This is the same as verify_cast<DOM::ParentNode>(dom_node).for_each_child
294-
for (auto* node = verify_cast<DOM::ParentNode>(dom_node).first_child(); node; node = node->next_sibling())
295-
TRY(create_layout_tree(*node, context));
296296
pop_parent();
297297
}
298298

0 commit comments

Comments
 (0)