Title: [131910] trunk
Revision
131910
Author
[email protected]
Date
2012-10-19 09:56:24 -0700 (Fri, 19 Oct 2012)

Log Message

Elements assigned to <shadow> should not be reprojected.
https://bugs.webkit.org/show_bug.cgi?id=99680

Reviewed by Dimitri Glazkov.

Source/WebCore:

In the current spec, we don't have shadow reprojection, i.e. elements assigned to <shadow> should not be
reprojected to content. However, we can select them by <shadow>.

Tests: fast/dom/shadow/content-reprojection-complex.html
       fast/dom/shadow/content-reprojection-shadow.html
       fast/dom/shadow/shadow-reprojection-prohibited.html

* html/shadow/ContentDistributor.cpp:
(WebCore::ContentDistributor::distribute): When a node is <shadow>, we should not add elements assigned to <shadow>
to POOL. Instead, <shadow> itself should be added to POOL.
* html/shadow/HTMLContentElement.h:
(WebCore::isHTMLContentElement):
(WebCore):

LayoutTests:

* fast/dom/shadow/content-reprojection-complex-expected.html: Added.
* fast/dom/shadow/content-reprojection-complex.html: Added.
* fast/dom/shadow/content-reprojection-shadow-expected.html: Added.
* fast/dom/shadow/content-reprojection-shadow.html: Added.
* fast/dom/shadow/shadow-reprojection-prohibited-expected.html: Added.
* fast/dom/shadow/shadow-reprojection-prohibited.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (131909 => 131910)


--- trunk/LayoutTests/ChangeLog	2012-10-19 16:54:00 UTC (rev 131909)
+++ trunk/LayoutTests/ChangeLog	2012-10-19 16:56:24 UTC (rev 131910)
@@ -1,3 +1,17 @@
+2012-10-19  Shinya Kawanaka  <[email protected]>
+
+        Elements assigned to <shadow> should not be reprojected.
+        https://bugs.webkit.org/show_bug.cgi?id=99680
+
+        Reviewed by Dimitri Glazkov.
+
+        * fast/dom/shadow/content-reprojection-complex-expected.html: Added.
+        * fast/dom/shadow/content-reprojection-complex.html: Added.
+        * fast/dom/shadow/content-reprojection-shadow-expected.html: Added.
+        * fast/dom/shadow/content-reprojection-shadow.html: Added.
+        * fast/dom/shadow/shadow-reprojection-prohibited-expected.html: Added.
+        * fast/dom/shadow/shadow-reprojection-prohibited.html: Added.
+
 2012-10-19  Pan Deng  <[email protected]>
 
         Fix incorrect User Timing test case path in TestExpectations of qt-5.0-wk2 platform.

Added: trunk/LayoutTests/fast/dom/shadow/content-reprojection-complex-expected.html (0 => 131910)


--- trunk/LayoutTests/fast/dom/shadow/content-reprojection-complex-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-reprojection-complex-expected.html	2012-10-19 16:56:24 UTC (rev 131910)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+
+<p>This test ensures that content element cannot select elements assigned to a shadow element.</p>
+
+<div id="host1">
+    <h2>A</h2>
+    <div>A</div>
+    <div>A</div>
+    <div>A</div>
+    <h2>B</h2>
+    <div>B</div>
+    <div>B</div>
+</div>
+
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/content-reprojection-complex.html (0 => 131910)


--- trunk/LayoutTests/fast/dom/shadow/content-reprojection-complex.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-reprojection-complex.html	2012-10-19 16:56:24 UTC (rev 131910)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+
+<script src=""
+
+<p>This test ensures that content element cannot select elements assigned to a shadow element.</p>
+
+<div id="host1">
+    <div class="A">A</div>
+    <div class="A">A</div>
+    <div class="B">B</div>
+    <div class="B">B</div>
+</div>
+
+<script>
+var shadowRoot1 = new WebKitShadowRoot(host1);
+shadowRoot1.innerHTML = '<div id="host2"><content select=".A"></content><shadow></shadow><div class=".A">A</div></div>';
+
+var shadowRoot2 = new WebKitShadowRoot(shadowRoot1.getElementById('host2'));
+shadowRoot2.innerHTML = '<div><h2>A</h2><content select="div"></content><h2>B</h2><shadow></shadow></div>'
+</script>
+
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/content-reprojection-shadow-expected.html (0 => 131910)


--- trunk/LayoutTests/fast/dom/shadow/content-reprojection-shadow-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-reprojection-shadow-expected.html	2012-10-19 16:56:24 UTC (rev 131910)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+
+<p>This test ensures that elements distributed to a content element can be taken from a shadow element</p>
+
+<div id="host1">
+    <div>These elements</div>
+    <div>should be</div>
+    <div>reprojected</div>
+    <div>A</div>
+</div>
+
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/content-reprojection-shadow.html (0 => 131910)


--- trunk/LayoutTests/fast/dom/shadow/content-reprojection-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-reprojection-shadow.html	2012-10-19 16:56:24 UTC (rev 131910)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+
+<script src=""
+
+<p>This test ensures that elements distributed to a content element can be taken from a shadow element</p>
+
+<div id="host1">
+    <div>These elements</div>
+    <div>should be</div>
+    <div>reprojected</div>
+</div>
+
+<script>
+var shadowRoot1 = new WebKitShadowRoot(host1);
+shadowRoot1.innerHTML = '<div id="host2"><content></content></div>';
+
+var shadowRoot2 = new WebKitShadowRoot(shadowRoot1.getElementById('host2'));
+shadowRoot2.innerHTML = '<div><shadow></shadow><div>A</div></div>'
+</script>
+
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/shadow-reprojection-prohibited-expected.html (0 => 131910)


--- trunk/LayoutTests/fast/dom/shadow/shadow-reprojection-prohibited-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-reprojection-prohibited-expected.html	2012-10-19 16:56:24 UTC (rev 131910)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+
+<p>This test ensures that elements assigned to a shadow element are not distributed.</p>
+
+<div id="host1">
+    <div id="host2"><div>This should be selected.</div></div>
+</div>
+
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/shadow-reprojection-prohibited.html (0 => 131910)


--- trunk/LayoutTests/fast/dom/shadow/shadow-reprojection-prohibited.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-reprojection-prohibited.html	2012-10-19 16:56:24 UTC (rev 131910)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+
+<script src=""
+
+<p>This test ensures that elements assigned to a shadow element are not distributed.</p>
+
+<div id="host1">
+    <div>These elements</div>
+    <div>should not be</div>
+    <div>reprojected</div>
+</div>
+
+<script>
+var shadowRoot1 = new WebKitShadowRoot(host1);
+shadowRoot1.innerHTML = '<div id="host2"><shadow></shadow></div>';
+
+var shadowRoot2 = new WebKitShadowRoot(shadowRoot1.getElementById('host2'));
+shadowRoot2.innerHTML = '<div><content select="div"></content><div>This should be selected.</div></div>'
+</script>
+
+</html>

Modified: trunk/Source/WebCore/ChangeLog (131909 => 131910)


--- trunk/Source/WebCore/ChangeLog	2012-10-19 16:54:00 UTC (rev 131909)
+++ trunk/Source/WebCore/ChangeLog	2012-10-19 16:56:24 UTC (rev 131910)
@@ -1,3 +1,24 @@
+2012-10-19  Shinya Kawanaka  <[email protected]>
+
+        Elements assigned to <shadow> should not be reprojected.
+        https://bugs.webkit.org/show_bug.cgi?id=99680
+
+        Reviewed by Dimitri Glazkov.
+
+        In the current spec, we don't have shadow reprojection, i.e. elements assigned to <shadow> should not be
+        reprojected to content. However, we can select them by <shadow>.
+
+        Tests: fast/dom/shadow/content-reprojection-complex.html
+               fast/dom/shadow/content-reprojection-shadow.html
+               fast/dom/shadow/shadow-reprojection-prohibited.html
+
+        * html/shadow/ContentDistributor.cpp:
+        (WebCore::ContentDistributor::distribute): When a node is <shadow>, we should not add elements assigned to <shadow>
+        to POOL. Instead, <shadow> itself should be added to POOL.
+        * html/shadow/HTMLContentElement.h:
+        (WebCore::isHTMLContentElement):
+        (WebCore):
+
 2012-10-19  Chris Fleizach  <[email protected]>
 
         VO issues with hidden <legend> and last explicitly labelled element within a group <fieldset>

Modified: trunk/Source/WebCore/html/shadow/ContentDistributor.cpp (131909 => 131910)


--- trunk/Source/WebCore/html/shadow/ContentDistributor.cpp	2012-10-19 16:54:00 UTC (rev 131909)
+++ trunk/Source/WebCore/html/shadow/ContentDistributor.cpp	2012-10-19 16:56:24 UTC (rev 131910)
@@ -58,7 +58,7 @@
 
     ContentDistribution pool;
     for (Node* node = host->firstChild(); node; node = node->nextSibling()) {
-        if (!isInsertionPoint(node)) {
+        if (!isHTMLContentElement(node)) {
             pool.append(node);
             continue;
         }
@@ -72,6 +72,7 @@
                 pool.append(fallbackNode);
         }
     }
+
     Vector<bool> distributed(pool.size());
     distributed.fill(false);
 

Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.h (131909 => 131910)


--- trunk/Source/WebCore/html/shadow/HTMLContentElement.h	2012-10-19 16:54:00 UTC (rev 131909)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.h	2012-10-19 16:56:24 UTC (rev 131910)
@@ -56,6 +56,12 @@
     virtual void parseAttribute(const Attribute&) OVERRIDE;
 };
 
+inline bool isHTMLContentElement(const Node* node)
+{
+    ASSERT(node);
+    return node->hasTagName(HTMLNames::contentTag);
 }
 
+}
+
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to