Changeset 89742 in webkit


Ignore:
Timestamp:
Jun 25, 2011 10:04:40 AM (13 years ago)
Author:
Dimitri Glazkov
Message:

2011-06-24 Dimitri Glazkov <Dimitri Glazkov>

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 <Dimitri Glazkov>

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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89741 r89742  
     12011-06-24  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        REGRESSION (r77740): Shadow DOM pseudo elements aren't matching when combined with descendant selectors
     6        https://bugs.webkit.org/show_bug.cgi?id=63373
     7
     8        * fast/css/unknown-pseudo-element-matching-expected.txt: Updated results.
     9        * fast/css/unknown-pseudo-element-matching.html: Added more tests.
     10
    1112011-06-25  Pavel Feldman  <pfeldman@google.com>
    212
  • trunk/LayoutTests/fast/css/unknown-pseudo-element-matching-expected.txt

    r85077 r89742  
    5050input.bar::-webkit-slider-thumb:hover should match: PASS
    5151input[type=range]::-webkit-slider-thumb:hover should match: PASS
     52
     53Should match when combined with descendant selectors:
     54#baz input::-webkit-slider-thumb should match: PASS
     55#baz #foo::-webkit-slider-thumb should match: PASS
     56#baz input#foo::-webkit-slider-thumb should match: PASS
     57#baz input.bar::-webkit-slider-thumb should match: PASS
     58#baz input[type=range]::-webkit-slider-thumb should match: PASS
     59.qux input::-webkit-slider-thumb should match: PASS
     60.qux #foo::-webkit-slider-thumb should match: PASS
     61.qux input#foo::-webkit-slider-thumb should match: PASS
     62.qux input.bar::-webkit-slider-thumb should match: PASS
     63.qux input[type=range]::-webkit-slider-thumb should match: PASS
  • trunk/LayoutTests/fast/css/unknown-pseudo-element-matching.html

    r85077 r89742  
    2626];
    2727var DISABLED_SELECTORS = SELECTORS.map(function(selector) { return selector + ':disabled'; });
    28 var HOVER_SELECTORS = SELECTORS.map(function(selector) { return selector + ':hover'; })
     28var HOVER_SELECTORS = SELECTORS.map(function(selector) { return selector + ':hover'; });
     29var DESCENDANT_ID_SELECTORS = SELECTORS.map(function(selector) { return '#baz ' + selector; });
     30DESCENDANT_ID_SELECTORS.shift();
     31var DESCENDANT_CLASS_SELECTORS = SELECTORS.map(function(selector) { return '.qux ' + selector; });
     32DESCENDANT_CLASS_SELECTORS.shift();
    2933
    3034// convenience constants
     
    101105    log('<br>Should match :hover when the mouse is over the slider thumb:');
    102106    HOVER_SELECTORS.forEach(expectMatch);
    103     document.body.removeChild(input);
     107    log('<br>Should match when combined with descendant selectors:');
     108    DESCENDANT_ID_SELECTORS.forEach(expectMatch);
     109    DESCENDANT_CLASS_SELECTORS.forEach(expectMatch);
     110    input.parentNode.removeChild(input);
    104111}
    105112
     
    116123<body onload="runTest()">
    117124    <p>Tests various selector combinations, containing unknown pseudo element selectors.</p>
    118     <input id="foo" class="bar" type="range">
     125    <div id="baz" class="qux">
     126        <input id="foo" class="bar" type="range">
     127    </div>
    119128    <div id="log"></div>
    120129</body>
  • trunk/Source/WebCore/ChangeLog

    r89733 r89742  
     12011-06-24  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        REGRESSION (r77740): Shadow DOM pseudo elements aren't matching when combined with descendant selectors
     6        https://bugs.webkit.org/show_bug.cgi?id=63373
     7
     8        * css/CSSStyleSelector.cpp:
     9        (WebCore::CSSStyleSelector::pushParentStackFrame): Changed to use parentOrHostElement.
     10        (WebCore::CSSStyleSelector::pushParent): Ditto.
     11        * dom/Node.cpp:
     12        (WebCore::Node::parentOrHostElement): Added.
     13        * dom/Node.h:
     14
    1152011-06-24  Dan Bernstein  <mitz@apple.com>
    216
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r89705 r89742  
    625625{
    626626    ASSERT(m_ancestorIdentifierFilter);
    627     ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent->parentElement());
    628     ASSERT(!m_parentStack.isEmpty() || !parent->parentElement());
     627    ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent->parentOrHostElement());
     628    ASSERT(!m_parentStack.isEmpty() || !parent->parentOrHostElement());
    629629    m_parentStack.append(ParentStackFrame(parent));
    630630    ParentStackFrame& parentFrame = m_parentStack.last();
     
    658658        m_ancestorIdentifierFilter = adoptPtr(new BloomFilter<bloomFilterKeyBits>);
    659659        // If the element is not the root itself, build the stack starting from the root.
    660         if (parent->parentElement()) {
     660        if (parent->parentOrHostNode()) {
    661661            Vector<Element*, 30> ancestors;
    662             for (Element* ancestor = parent; ancestor; ancestor = ancestor->parentElement())
     662            for (Element* ancestor = parent; ancestor; ancestor = ancestor->parentOrHostElement())
    663663                ancestors.append(ancestor);
    664664            int count = ancestors.size();
     
    667667            return;
    668668        }
    669     } else if (!parent->parentElement()) {
     669    } else if (!parent->parentOrHostElement()) {
    670670        // We are not always invoked consistently. For example, script execution can cause us to enter
    671671        // style recalc in the middle of tree building. Reset the stack if we see a new root element.
     
    677677        // We may get invoked for some random elements in some wacky cases during style resolve.
    678678        // Pause maintaining the stack in this case.
    679         if (m_parentStack.last().element != parent->parentElement())
     679        if (m_parentStack.last().element != parent->parentOrHostElement())
    680680            return;
    681681    }
  • trunk/Source/WebCore/dom/Node.cpp

    r89521 r89742  
    15771577}
    15781578
     1579Element* Node::parentOrHostElement() const
     1580{
     1581    ContainerNode* parent = parentOrHostNode();
     1582    if (!parent)
     1583        return 0;
     1584
     1585    if (parent->isShadowRoot())
     1586        parent = parent->shadowHost();
     1587
     1588    if (!parent->isElementNode())
     1589        return 0;
     1590
     1591    return toElement(parent);
     1592}
     1593
     1594
    15791595bool Node::isBlockFlow() const
    15801596{
  • trunk/Source/WebCore/dom/Node.h

    r89069 r89742  
    222222    // Node's parent, shadow tree host, or SVG use.
    223223    ContainerNode* parentOrHostNode() const;
     224    Element* parentOrHostElement() const;
    224225    // Use when it's guaranteed to that shadowHost is 0 and svgShadowHost is 0.
    225226    ContainerNode* parentNodeGuaranteedHostFree() const;
Note: See TracChangeset for help on using the changeset viewer.