فهرست منبع

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
MacDue 1 سال پیش
والد
کامیت
24c848607c
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp

+ 4 - 4
Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp

@@ -288,11 +288,11 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
             for (auto* node = shadow_root->first_child(); node; node = node->next_sibling()) {
                 TRY(create_layout_tree(*node, context));
             }
+        } else {
+            // This is the same as verify_cast<DOM::ParentNode>(dom_node).for_each_child
+            for (auto* node = verify_cast<DOM::ParentNode>(dom_node).first_child(); node; node = node->next_sibling())
+                TRY(create_layout_tree(*node, context));
         }
-
-        // This is the same as verify_cast<DOM::ParentNode>(dom_node).for_each_child
-        for (auto* node = verify_cast<DOM::ParentNode>(dom_node).first_child(); node; node = node->next_sibling())
-            TRY(create_layout_tree(*node, context));
         pop_parent();
     }