Title: [89742] trunk
Revision
89742
Author
[email protected]
Date
2011-06-25 10:04:40 -0700 (Sat, 25 Jun 2011)

Log Message

2011-06-24  Dimitri Glazkov  <[email protected]>

        Reviewed by Darin Adler.

        REGRESSION (r77740): Shadow DOM pseudo elements aren't matching when combined with descendant selectors
        https://bugs.webkit.org/show_bug.cgi?id=63373

        * fast/css/unknown-pseudo-element-matching-expected.txt: Updated results.
        * fast/css/unknown-pseudo-element-matching.html: Added more tests.
2011-06-24  Dimitri Glazkov  <[email protected]>

        Reviewed by Darin Adler.

        REGRESSION (r77740): Shadow DOM pseudo elements aren't matching when combined with descendant selectors
        https://bugs.webkit.org/show_bug.cgi?id=63373

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::pushParentStackFrame): Changed to use parentOrHostElement.
        (WebCore::CSSStyleSelector::pushParent): Ditto.
        * dom/Node.cpp:
        (WebCore::Node::parentOrHostElement): Added.
        * dom/Node.h:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (89741 => 89742)


--- trunk/LayoutTests/ChangeLog	2011-06-25 10:20:18 UTC (rev 89741)
+++ trunk/LayoutTests/ChangeLog	2011-06-25 17:04:40 UTC (rev 89742)
@@ -1,3 +1,13 @@
+2011-06-24  Dimitri Glazkov  <[email protected]>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (r77740): Shadow DOM pseudo elements aren't matching when combined with descendant selectors
+        https://bugs.webkit.org/show_bug.cgi?id=63373
+
+        * fast/css/unknown-pseudo-element-matching-expected.txt: Updated results.
+        * fast/css/unknown-pseudo-element-matching.html: Added more tests.
+
 2011-06-25  Pavel Feldman  <[email protected]>
 
         Not reviewed: chromium rebaselines.

Modified: trunk/LayoutTests/fast/css/unknown-pseudo-element-matching-expected.txt (89741 => 89742)


--- trunk/LayoutTests/fast/css/unknown-pseudo-element-matching-expected.txt	2011-06-25 10:20:18 UTC (rev 89741)
+++ trunk/LayoutTests/fast/css/unknown-pseudo-element-matching-expected.txt	2011-06-25 17:04:40 UTC (rev 89742)
@@ -49,3 +49,15 @@
 input#foo::-webkit-slider-thumb:hover should match: PASS
 input.bar::-webkit-slider-thumb:hover should match: PASS
 input[type=range]::-webkit-slider-thumb:hover should match: PASS
+
+Should match when combined with descendant selectors:
+#baz input::-webkit-slider-thumb should match: PASS
+#baz #foo::-webkit-slider-thumb should match: PASS
+#baz input#foo::-webkit-slider-thumb should match: PASS
+#baz input.bar::-webkit-slider-thumb should match: PASS
+#baz input[type=range]::-webkit-slider-thumb should match: PASS
+.qux input::-webkit-slider-thumb should match: PASS
+.qux #foo::-webkit-slider-thumb should match: PASS
+.qux input#foo::-webkit-slider-thumb should match: PASS
+.qux input.bar::-webkit-slider-thumb should match: PASS
+.qux input[type=range]::-webkit-slider-thumb should match: PASS

Modified: trunk/LayoutTests/fast/css/unknown-pseudo-element-matching.html (89741 => 89742)


--- trunk/LayoutTests/fast/css/unknown-pseudo-element-matching.html	2011-06-25 10:20:18 UTC (rev 89741)
+++ trunk/LayoutTests/fast/css/unknown-pseudo-element-matching.html	2011-06-25 17:04:40 UTC (rev 89742)
@@ -25,7 +25,11 @@
 'input[type=range]::-webkit-slider-thumb'
 ];
 var DISABLED_SELECTORS = SELECTORS.map(function(selector) { return selector + ':disabled'; });
-var HOVER_SELECTORS = SELECTORS.map(function(selector) { return selector + ':hover'; })
+var HOVER_SELECTORS = SELECTORS.map(function(selector) { return selector + ':hover'; });
+var DESCENDANT_ID_SELECTORS = SELECTORS.map(function(selector) { return '#baz ' + selector; });
+DESCENDANT_ID_SELECTORS.shift();
+var DESCENDANT_CLASS_SELECTORS = SELECTORS.map(function(selector) { return '.qux ' + selector; });
+DESCENDANT_CLASS_SELECTORS.shift();
 
 // convenience constants
 var MATCH = true;
@@ -100,7 +104,10 @@
     }
     log('<br>Should match :hover when the mouse is over the slider thumb:');
     HOVER_SELECTORS.forEach(expectMatch);
-    document.body.removeChild(input);
+    log('<br>Should match when combined with descendant selectors:');
+    DESCENDANT_ID_SELECTORS.forEach(expectMatch);
+    DESCENDANT_CLASS_SELECTORS.forEach(expectMatch);
+    input.parentNode.removeChild(input);
 }
 
 function expectNoMatch(selector) {
@@ -115,7 +122,9 @@
 </head>
 <body _onload_="runTest()">
     <p>Tests various selector combinations, containing unknown pseudo element selectors.</p>
-    <input id="foo" class="bar" type="range">
+    <div id="baz" class="qux">
+        <input id="foo" class="bar" type="range">
+    </div>
     <div id="log"></div>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (89741 => 89742)


--- trunk/Source/WebCore/ChangeLog	2011-06-25 10:20:18 UTC (rev 89741)
+++ trunk/Source/WebCore/ChangeLog	2011-06-25 17:04:40 UTC (rev 89742)
@@ -1,3 +1,17 @@
+2011-06-24  Dimitri Glazkov  <[email protected]>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (r77740): Shadow DOM pseudo elements aren't matching when combined with descendant selectors
+        https://bugs.webkit.org/show_bug.cgi?id=63373
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::pushParentStackFrame): Changed to use parentOrHostElement.
+        (WebCore::CSSStyleSelector::pushParent): Ditto.
+        * dom/Node.cpp:
+        (WebCore::Node::parentOrHostElement): Added.
+        * dom/Node.h:
+
 2011-06-24  Dan Bernstein  <[email protected]>
 
         Reviewed by Anders Carlsson.

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (89741 => 89742)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-06-25 10:20:18 UTC (rev 89741)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-06-25 17:04:40 UTC (rev 89742)
@@ -624,8 +624,8 @@
 void CSSStyleSelector::pushParentStackFrame(Element* parent)
 {
     ASSERT(m_ancestorIdentifierFilter);
-    ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent->parentElement());
-    ASSERT(!m_parentStack.isEmpty() || !parent->parentElement());
+    ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent->parentOrHostElement());
+    ASSERT(!m_parentStack.isEmpty() || !parent->parentOrHostElement());
     m_parentStack.append(ParentStackFrame(parent));
     ParentStackFrame& parentFrame = m_parentStack.last();
     // Mix tags, class names and ids into some sort of weird bouillabaisse.
@@ -657,16 +657,16 @@
         ASSERT(!m_ancestorIdentifierFilter);
         m_ancestorIdentifierFilter = adoptPtr(new BloomFilter<bloomFilterKeyBits>);
         // If the element is not the root itself, build the stack starting from the root.
-        if (parent->parentElement()) {
+        if (parent->parentOrHostNode()) {
             Vector<Element*, 30> ancestors;
-            for (Element* ancestor = parent; ancestor; ancestor = ancestor->parentElement())
+            for (Element* ancestor = parent; ancestor; ancestor = ancestor->parentOrHostElement())
                 ancestors.append(ancestor);
             int count = ancestors.size();
             for (int n = count - 1; n >= 0; --n)
                 pushParentStackFrame(ancestors[n]);
             return;
         }
-    } else if (!parent->parentElement()) {
+    } else if (!parent->parentOrHostElement()) {
         // We are not always invoked consistently. For example, script execution can cause us to enter
         // style recalc in the middle of tree building. Reset the stack if we see a new root element.
         ASSERT(m_ancestorIdentifierFilter);
@@ -676,7 +676,7 @@
         ASSERT(m_ancestorIdentifierFilter);
         // We may get invoked for some random elements in some wacky cases during style resolve.
         // Pause maintaining the stack in this case.
-        if (m_parentStack.last().element != parent->parentElement())
+        if (m_parentStack.last().element != parent->parentOrHostElement())
             return;
     }
     pushParentStackFrame(parent);

Modified: trunk/Source/WebCore/dom/Node.cpp (89741 => 89742)


--- trunk/Source/WebCore/dom/Node.cpp	2011-06-25 10:20:18 UTC (rev 89741)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-06-25 17:04:40 UTC (rev 89742)
@@ -1576,6 +1576,22 @@
     return false;
 }
 
+Element* Node::parentOrHostElement() const
+{
+    ContainerNode* parent = parentOrHostNode();
+    if (!parent)
+        return 0;
+
+    if (parent->isShadowRoot())
+        parent = parent->shadowHost();
+
+    if (!parent->isElementNode())
+        return 0;
+
+    return toElement(parent);
+}
+
+
 bool Node::isBlockFlow() const
 {
     return renderer() && renderer()->isBlockFlow();

Modified: trunk/Source/WebCore/dom/Node.h (89741 => 89742)


--- trunk/Source/WebCore/dom/Node.h	2011-06-25 10:20:18 UTC (rev 89741)
+++ trunk/Source/WebCore/dom/Node.h	2011-06-25 17:04:40 UTC (rev 89742)
@@ -221,6 +221,7 @@
     bool isInShadowTree();
     // Node's parent, shadow tree host, or SVG use.
     ContainerNode* parentOrHostNode() const;
+    Element* parentOrHostElement() const;
     // Use when it's guaranteed to that shadowHost is 0 and svgShadowHost is 0.
     ContainerNode* parentNodeGuaranteedHostFree() const;
     // Returns the parent node, but 0 if the parent node is a ShadowRoot.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to