Title: [102423] trunk
Revision
102423
Author
[email protected]
Date
2011-12-08 20:16:26 -0800 (Thu, 08 Dec 2011)

Log Message

Suppress rendering of light children when ShadowRoot is dynamically created.
https://bugs.webkit.org/show_bug.cgi?id=72441

Reviewed by Ryosuke Niwa.

Source/WebCore:

Tests: fast/dom/shadow/dynamically-created-shadow-root-expected.html
       fast/dom/shadow/dynamically-created-shadow-root.html

* dom/Element.cpp:
(WebCore::Element::setShadowRoot):

LayoutTests:

* fast/dom/shadow/dynamically-created-shadow-root-expected.html: Added.
* fast/dom/shadow/dynamically-created-shadow-root.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (102422 => 102423)


--- trunk/LayoutTests/ChangeLog	2011-12-09 04:12:55 UTC (rev 102422)
+++ trunk/LayoutTests/ChangeLog	2011-12-09 04:16:26 UTC (rev 102423)
@@ -1,3 +1,13 @@
+2011-12-08  Hayato Ito  <[email protected]>
+
+        Suppress rendering of light children when ShadowRoot is dynamically created.
+        https://bugs.webkit.org/show_bug.cgi?id=72441
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/shadow/dynamically-created-shadow-root-expected.html: Added.
+        * fast/dom/shadow/dynamically-created-shadow-root.html: Added.
+
 2011-12-08  Kenichi Ishibashi  <[email protected]>
 
         Unreviewed, chromium test rebaseline tests added in r102388. Updates expectations.

Added: trunk/LayoutTests/fast/dom/shadow/dynamically-created-shadow-root-expected.html (0 => 102423)


--- trunk/LayoutTests/fast/dom/shadow/dynamically-created-shadow-root-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/dynamically-created-shadow-root-expected.html	2011-12-09 04:16:26 UTC (rev 102423)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<body>
+<div>
+This tests that dynamically created ShadowRoot should be rendered correctly.
+Can only run within DRT.
+</div>
+<div>Shadow should be rendered.</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/dynamically-created-shadow-root.html (0 => 102423)


--- trunk/LayoutTests/fast/dom/shadow/dynamically-created-shadow-root.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/dynamically-created-shadow-root.html	2011-12-09 04:16:26 UTC (rev 102423)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<body>
+<div>
+This tests that dynamically created ShadowRoot should be rendered correctly.
+Can only run within DRT.
+</div>
+<div id="host">Light children should not be rendered.</div>
+<script>
+if (window.internals) {
+    var host = document.querySelector('#host');
+    var shadowRoot = window.internals.ensureShadowRoot(host);
+    shadowRoot.appendChild(document.createTextNode('Shadow should be rendered.'));
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (102422 => 102423)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 04:12:55 UTC (rev 102422)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 04:16:26 UTC (rev 102423)
@@ -1,3 +1,16 @@
+2011-12-08  Hayato Ito  <[email protected]>
+
+        Suppress rendering of light children when ShadowRoot is dynamically created.
+        https://bugs.webkit.org/show_bug.cgi?id=72441
+
+        Reviewed by Ryosuke Niwa.
+
+        Tests: fast/dom/shadow/dynamically-created-shadow-root-expected.html
+               fast/dom/shadow/dynamically-created-shadow-root.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::setShadowRoot):
+
 2011-12-08  Pierre Rossi  <[email protected]>
 
         Drop ENABLE_NO_LISTBOX_RENDERING, and make it a runtime decision.

Modified: trunk/Source/WebCore/dom/Element.cpp (102422 => 102423)


--- trunk/Source/WebCore/dom/Element.cpp	2011-12-09 04:12:55 UTC (rev 102422)
+++ trunk/Source/WebCore/dom/Element.cpp	2011-12-09 04:16:26 UTC (rev 102423)
@@ -1238,8 +1238,11 @@
     shadowRoot->setShadowHost(this);
     if (inDocument())
         shadowRoot->insertedIntoDocument();
-    if (attached())
+    if (attached()) {
         shadowRoot->lazyAttach();
+        for (Node* child = firstChild(); child; child = child->nextSibling())
+            child->detach();
+    }
 }
 
 ShadowRoot* Element::ensureShadowRoot()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to