Changeset 166808 in webkit


Ignore:
Timestamp:
Apr 4, 2014 3:30:44 PM (10 years ago)
Author:
benjamin@webkit.org
Message:

Upgrade to SelectorFailsAllSiblings when Child selector is failed.
https://bugs.webkit.org/show_bug.cgi?id=130961

Patch by Yusuke Suzuki <Yusuke Suzuki> on 2014-04-04
Reviewed by Benjamin Poulain.

When Child selector fails, we should resume matching from the closest
Descendant selector.
So upgrading SelectorFailsLocally to SelectorFailsAllSibling at least
to prevent unnecessary direct/indirect adjacent selectors matching.

  • css/SelectorChecker.cpp:

(WebCore::SelectorChecker::matchRecursively):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166803 r166808  
     12014-04-04  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        Upgrade to SelectorFailsAllSiblings when Child selector is failed.
     4        https://bugs.webkit.org/show_bug.cgi?id=130961
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        When Child selector fails, we should resume matching from the closest
     9        Descendant selector.
     10        So upgrading SelectorFailsLocally to SelectorFailsAllSibling at least
     11        to prevent unnecessary direct/indirect adjacent selectors matching.
     12
     13        * css/SelectorChecker.cpp:
     14        (WebCore::SelectorChecker::matchRecursively):
     15
    1162014-04-04  Roger Fong  <roger_fong@apple.com>
    217
  • trunk/Source/WebCore/css/SelectorChecker.cpp

    r165402 r166808  
    212212
    213213    case CSSSelector::Child:
    214         nextContext.element = context.element->parentElement();
    215         if (!nextContext.element)
    216             return SelectorFailsCompletely;
    217         nextContext.isSubSelector = false;
    218         nextContext.elementStyle = 0;
    219         return matchRecursively(nextContext, ignoreDynamicPseudo);
     214        {
     215            nextContext.element = context.element->parentElement();
     216            if (!nextContext.element)
     217                return SelectorFailsCompletely;
     218            nextContext.isSubSelector = false;
     219            nextContext.elementStyle = nullptr;
     220            Match match = matchRecursively(nextContext, ignoreDynamicPseudo);
     221            if (match == SelectorMatches || match == SelectorFailsCompletely)
     222                return match;
     223            return SelectorFailsAllSiblings;
     224        }
    220225
    221226    case CSSSelector::DirectAdjacent:
Note: See TracChangeset for help on using the changeset viewer.