Changeset 173688 in webkit


Ignore:
Timestamp:
Sep 17, 2014 1:54:50 AM (10 years ago)
Author:
Yusuke Suzuki
Message:

filterRootById accidentally clears inAdjacentChain flag
https://bugs.webkit.org/show_bug.cgi?id=136851

Reviewed by Benjamin Poulain.

Source/WebCore:

Test: fast/selectors/filter-root-node-with-selector-contains-adjacents.html

  • dom/SelectorQuery.cpp:

(WebCore::filterRootById):

LayoutTests:

When SubSelector comes, inAdjacentChain flag is cleared to false.
So for example, document.querySelector("span#id + ok") doesn't work correctly.
In this patch, we handles SubSelector relation correctly; don't change inAdjacentChain flag
to filter the right search root node.

  • fast/selectors/filter-root-node-with-selector-contains-adjacents-expected.txt: Added.
  • fast/selectors/filter-root-node-with-selector-contains-adjacents.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r173681 r173688  
     12014-09-16  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        filterRootById accidentally clears inAdjacentChain flag
     4        https://bugs.webkit.org/show_bug.cgi?id=136851
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        When SubSelector comes, `inAdjacentChain` flag is cleared to false.
     9        So for example, `document.querySelector("span#id + ok")` doesn't work correctly.
     10        In this patch, we handles SubSelector relation correctly; don't change `inAdjacentChain` flag
     11        to filter the right search root node.
     12
     13        * fast/selectors/filter-root-node-with-selector-contains-adjacents-expected.txt: Added.
     14        * fast/selectors/filter-root-node-with-selector-contains-adjacents.html: Added.
     15
    1162014-09-16  Yusuke Suzuki  <utatane.tea@gmail.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r173687 r173688  
     12014-09-16  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        filterRootById accidentally clears inAdjacentChain flag
     4        https://bugs.webkit.org/show_bug.cgi?id=136851
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Test: fast/selectors/filter-root-node-with-selector-contains-adjacents.html
     9
     10        * dom/SelectorQuery.cpp:
     11        (WebCore::filterRootById):
     12
    1132014-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • trunk/Source/WebCore/dom/SelectorQuery.cpp

    r173590 r173688  
    11/*
    22 * Copyright (C) 2011, 2013, 2014 Apple Inc. All rights reserved.
     3 * Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    244245            }
    245246        }
     247        if (selector->relation() == CSSSelector::SubSelector)
     248            continue;
    246249        if (selector->relation() == CSSSelector::DirectAdjacent || selector->relation() == CSSSelector::IndirectAdjacent)
    247250            inAdjacentChain = true;
     
    584587    if (m_entries.size() == maximumSelectorQueryCacheSize)
    585588        m_entries.remove(m_entries.begin());
    586    
     589
    587590    return m_entries.add(selectors, std::make_unique<SelectorQuery>(WTF::move(selectorList))).iterator->value.get();
    588591}
Note: See TracChangeset for help on using the changeset viewer.