Commit 943605f0 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Return early in SelectorChecker::checkOne() if selector.isAttributeSelector() is true

Return early in SelectorChecker::checkOne() if selector.isAttributeSelector()
is true and the selector matched. Previously, we were only returning early if
the selector did not match and we were falling through if it did. This means
that we ended up doing the 2 if() checks below in the method unnecessarily:
- selector.m_match == CSSSelector::PseudoClass
- selector.m_match == CSSSelector::PseudoElement

Review URL: https://codereview.chromium.org/319513005

git-svn-id: svn://svn.chromium.org/blink/trunk@175518 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ef8357c0
...@@ -548,10 +548,8 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib ...@@ -548,10 +548,8 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
if (selector.m_match == CSSSelector::Id) if (selector.m_match == CSSSelector::Id)
return element.hasID() && element.idForStyleResolution() == selector.value(); return element.hasID() && element.idForStyleResolution() == selector.value();
if (selector.isAttributeSelector()) { if (selector.isAttributeSelector())
if (!anyAttributeMatches(element, static_cast<CSSSelector::Match>(selector.m_match), selector)) return anyAttributeMatches(element, static_cast<CSSSelector::Match>(selector.m_match), selector);
return false;
}
if (selector.m_match == CSSSelector::PseudoClass) { if (selector.m_match == CSSSelector::PseudoClass) {
// Handle :not up front. // Handle :not up front.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment