Title: [109321] trunk
Revision
109321
Author
[email protected]
Date
2012-02-29 23:58:26 -0800 (Wed, 29 Feb 2012)

Log Message

Fallback elements in non-youngest shadow tree should not be rendered.
https://bugs.webkit.org/show_bug.cgi?id=80002

Reviewed by Hajime Morita.

Source/WebCore:

Fallback elements in non-youngest shadow tree should not be rendered, so its phase should be
AttachingNotDistributed instead of AttachingFallbacked.

Tests: multiple-shadowroot-rendering.html covers this patch.

* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::NodeRenderingContext):

LayoutTests:

Since createContentWithSelect shadw-test-driver.js is not intuitive, fallback element
is not added in existing tests.
This change makes sure the existence of fallback elements.

* fast/dom/resources/shadow-test-driver.js:
(createContentWithSelect):
* fast/dom/shadow/content-element-move.html:
* fast/dom/shadow/multiple-shadowroot-rendering.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109320 => 109321)


--- trunk/LayoutTests/ChangeLog	2012-03-01 07:50:59 UTC (rev 109320)
+++ trunk/LayoutTests/ChangeLog	2012-03-01 07:58:26 UTC (rev 109321)
@@ -1,3 +1,19 @@
+2012-02-29  Shinya Kawanaka  <[email protected]> 
+
+        Fallback elements in non-youngest shadow tree should not be rendered.
+        https://bugs.webkit.org/show_bug.cgi?id=80002
+
+        Reviewed by Hajime Morita.
+
+        Since createContentWithSelect shadw-test-driver.js is not intuitive, fallback element
+        is not added in existing tests.
+        This change makes sure the existence of fallback elements.
+
+        * fast/dom/resources/shadow-test-driver.js:
+        (createContentWithSelect):
+        * fast/dom/shadow/content-element-move.html:
+        * fast/dom/shadow/multiple-shadowroot-rendering.html:
+
 2012-02-29  Kentaro Hara  <[email protected]>
 
         Unreviewed, gardening.

Modified: trunk/LayoutTests/fast/dom/resources/shadow-test-driver.js (109320 => 109321)


--- trunk/LayoutTests/fast/dom/resources/shadow-test-driver.js	2012-03-01 07:50:59 UTC (rev 109320)
+++ trunk/LayoutTests/fast/dom/resources/shadow-test-driver.js	2012-03-01 07:58:26 UTC (rev 109321)
@@ -61,11 +61,11 @@
     return span;
 }
 
-function createContentWithSelect(select, fallback) {
+function createContentWithSelect(select, fallbackText) {
     var content = internals.createContentElement(document);
     content.setAttribute('select', select);
-    if (!fallback)
-        content.appendChild(createSpanWithText("FALLBACK"));
+    if (fallbackText)
+        content.appendChild(createSpanWithText(fallbackText));
 
     return content;
 }

Modified: trunk/LayoutTests/fast/dom/shadow/content-element-move.html (109320 => 109321)


--- trunk/LayoutTests/fast/dom/shadow/content-element-move.html	2012-03-01 07:50:59 UTC (rev 109320)
+++ trunk/LayoutTests/fast/dom/shadow/content-element-move.html	2012-03-01 07:58:26 UTC (rev 109321)
@@ -22,7 +22,7 @@
     root.innerHTML = "<span>LIGHT</span>";
 
     // Create shadow tree.
-    var content = createContentWithSelect('span');
+    var content = createContentWithSelect('span', 'FALLBACK');
     var sr = internals.ensureShadowRoot(root);
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content);
@@ -48,8 +48,8 @@
     root.innerHTML = "<span class='c1'>LIGHT 1</span><span>LIGHT 2</span>";
 
     // Create shadow tree.
-    var content1 = createContentWithSelect('.c1');
-    var content2 = createContentWithSelect('span');
+    var content1 = createContentWithSelect('.c1', 'FALLBACK');
+    var content2 = createContentWithSelect('span', 'FALLBACK');
     var sr = internals.ensureShadowRoot(root);
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content1);
@@ -77,8 +77,8 @@
     root.innerHTML = "<span>LIGHT 1</span><span class='c1'>LIGHT 2</span>";
 
     // Create shadow tree.
-    var content1 = createContentWithSelect('.c1');
-    var content2 = createContentWithSelect('span');
+    var content1 = createContentWithSelect('.c1', 'FALLBACK');
+    var content2 = createContentWithSelect('span', 'FALLBACK');
     var sr = internals.ensureShadowRoot(root);
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content1);
@@ -133,7 +133,7 @@
     root.innerHTML = "<span>LIGHT</span>";
 
     // Create shadow tree.
-    var content = createContentWithSelect('span');
+    var content = createContentWithSelect('span', 'FALLBACK');
     var sr = internals.ensureShadowRoot(root);
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content);
@@ -159,7 +159,7 @@
     root.innerHTML = "<span>LIGHT</span>";
 
     // Create shadow tree.
-    var content = createContentWithSelect('span');
+    var content = createContentWithSelect('span', 'FALLBACK');
     var sr = internals.ensureShadowRoot(root);
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content);
@@ -186,7 +186,7 @@
     root.innerHTML = "<span>LIGHT 1</span><span class='c1'>LIGHT 2</span>";
 
     // Create shadow tree.
-    var content = createContentWithSelect('.c1');
+    var content = createContentWithSelect('.c1', 'FALLBACK');
     var sr = internals.ensureShadowRoot(root);
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content);
@@ -221,7 +221,7 @@
 
     var f = (function(root, callIfDone) {
         return function() {
-            var content = createContentWithSelect('span');
+            var content = createContentWithSelect('span', 'FALLBACK');
             var sr = internals.ensureShadowRoot(root);
             sr.insertBefore(content, sr.lastChild);
             document.getElementById('expect-container').innerHTML = "<div><span>BEFORE</span><SPAN>LIGHT</span><span>AFTER</span></div>";
@@ -247,8 +247,8 @@
 
     var f = (function(root, callIfDone) {
         return function() {
-            var content1 = createContentWithSelect('.c2');
-            var content2 = createContentWithSelect('span');
+            var content1 = createContentWithSelect('.c2', 'FALLBACK');
+            var content2 = createContentWithSelect('span', 'FALLBACK');
             var sr = internals.ensureShadowRoot(root);
             sr.insertBefore(content1, sr.lastChild);
             sr.insertBefore(content2, sr.lastChild);
@@ -271,14 +271,14 @@
     var mid = createSpanWithText("MID");
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(mid);
-    sr.appendChild(createContentWithSelect('.c2'));
+    sr.appendChild(createContentWithSelect('.c2', 'FALLBACK'));
     sr.appendChild(createSpanWithText("AFTER"));
 
     document.getElementById('actual-container').appendChild(root);
 
     var f = (function(root, mid, callIfDone) {
         return function() {
-            var content = createContentWithSelect('span');
+            var content = createContentWithSelect('span', 'FALLBACK');
             var sr = internals.ensureShadowRoot(root);
             sr.insertBefore(content, mid);
             document.getElementById('expect-container').innerHTML =
@@ -298,8 +298,8 @@
 
     // Create shadow tree.
     var sr = internals.ensureShadowRoot(root);
-    var content1 = createContentWithSelect('.c1');
-    var content2 = createContentWithSelect('span');
+    var content1 = createContentWithSelect('.c1', 'FALLBACK');
+    var content2 = createContentWithSelect('span', 'FALLBACK');
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content1);
     sr.appendChild(content2);
@@ -336,7 +336,7 @@
 
     // Create shadow tree in 'n1'
     var sr = internals.ensureShadowRoot(n1);
-    var content = createContentWithSelect('span');
+    var content = createContentWithSelect('span', 'FALLBACK');
     sr.appendChild(createSpanWithText("BEFORE"));
     sr.appendChild(content);
     sr.appendChild(createSpanWithText("AFTER"));

Modified: trunk/LayoutTests/fast/dom/shadow/multiple-shadowroot-rendering.html (109320 => 109321)


--- trunk/LayoutTests/fast/dom/shadow/multiple-shadowroot-rendering.html	2012-03-01 07:50:59 UTC (rev 109320)
+++ trunk/LayoutTests/fast/dom/shadow/multiple-shadowroot-rendering.html	2012-03-01 07:58:26 UTC (rev 109321)
@@ -124,7 +124,7 @@
 
     var sr1 = new WebKitShadowRoot(root);
     sr1.appendChild(createSpanWithText('BEFORE: SHOULD NOT BE RENDERED'));
-    sr1.appendChild(createContentWithSelect('span', 'FALLBACK'));
+    sr1.appendChild(createContentWithSelect('span', 'FALLBACK 1'));
     sr1.appendChild(createSpanWithText('AFTER: SHOULD NOT BE RENDERED'));
 
     document.getElementById('actual-container').appendChild(root);
@@ -132,7 +132,7 @@
     setTimeout((function(callIfDone, root) { return function() {
         var sr2 = new WebKitShadowRoot(root);
         sr2.appendChild(createSpanWithText('BEFORE'));
-        sr2.appendChild(createContentWithSelect('span', 'FALLBACK'));
+        sr2.appendChild(createContentWithSelect('span', 'FALLBACK 2'));
         sr2.appendChild(createSpanWithText('AFTER'));
 
         callIfDone();
@@ -148,13 +148,13 @@
 
     var sr1 = new WebKitShadowRoot(root);
     sr1.appendChild(createSpanWithText('BEFORE: SHOULD NOT BE RENDERED'));
-    sr1.appendChild(createContentWithSelect('span', 'FALLBACK'));
+    sr1.appendChild(createContentWithSelect('span', 'FALLBACK 1'));
     sr1.appendChild(createSpanWithText('AFTER: SHOULD NOT BE RENDERED'));
 
     setTimeout((function(callIfDone, root) { return function() {
         var sr2 = new WebKitShadowRoot(root);
         sr2.appendChild(createSpanWithText('BEFORE'));
-        sr2.appendChild(createContentWithSelect('span', 'FALLBACK'));
+        sr2.appendChild(createContentWithSelect('span', 'FALLBACK 2'));
         sr2.appendChild(createSpanWithText('AFTER'));
 
         document.getElementById('actual-container').appendChild(root);

Modified: trunk/Source/WebCore/ChangeLog (109320 => 109321)


--- trunk/Source/WebCore/ChangeLog	2012-03-01 07:50:59 UTC (rev 109320)
+++ trunk/Source/WebCore/ChangeLog	2012-03-01 07:58:26 UTC (rev 109321)
@@ -1,3 +1,18 @@
+2012-02-29  Shinya Kawanaka  <[email protected]> 
+
+        Fallback elements in non-youngest shadow tree should not be rendered.
+        https://bugs.webkit.org/show_bug.cgi?id=80002
+
+        Reviewed by Hajime Morita.
+
+        Fallback elements in non-youngest shadow tree should not be rendered, so its phase should be
+        AttachingNotDistributed instead of AttachingFallbacked.
+
+        Tests: multiple-shadowroot-rendering.html covers this patch.
+
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::NodeRenderingContext::NodeRenderingContext):
+
 2012-02-29  Adam Barth  <[email protected]>
 
         ScriptExecutionContext has too many ifdef ENABLE(SQL_DATABASE)

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (109320 => 109321)


--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-03-01 07:50:59 UTC (rev 109320)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-03-01 07:58:26 UTC (rev 109321)
@@ -88,6 +88,14 @@
         }
 
         if (isShadowBoundary(parent)) {
+            // FIXME: We don't support <shadow> yet, so the non-youngest shadow won't be rendered.
+            // https://bugs.webkit.org/show_bugs.cgi?id=78596
+            if (!toShadowRoot(parent->shadowTreeRootNode())->isYoungest()) {
+                m_phase = AttachingNotDistributed;
+                m_parentNodeForRenderingAndStyle = parent;
+                return;
+            }
+
             if (toInsertionPoint(parent)->hasSelection())
                 m_phase = AttachingNotFallbacked;
             else
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to