Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: Source/core/css/SelectorChecker.cpp

Issue 319513005: Return early in SelectorChecker::checkOne() if selector.isAttributeSelector() is true (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 if (selector.m_match == CSSSelector::Tag) 542 if (selector.m_match == CSSSelector::Tag)
543 return SelectorChecker::tagMatches(element, selector.tagQName()); 543 return SelectorChecker::tagMatches(element, selector.tagQName());
544 544
545 if (selector.m_match == CSSSelector::Class) 545 if (selector.m_match == CSSSelector::Class)
546 return element.hasClass() && element.classNames().contains(selector.valu e()); 546 return element.hasClass() && element.classNames().contains(selector.valu e());
547 547
548 if (selector.m_match == CSSSelector::Id) 548 if (selector.m_match == CSSSelector::Id)
549 return element.hasID() && element.idForStyleResolution() == selector.val ue(); 549 return element.hasID() && element.idForStyleResolution() == selector.val ue();
550 550
551 if (selector.isAttributeSelector()) { 551 if (selector.isAttributeSelector())
552 if (!anyAttributeMatches(element, static_cast<CSSSelector::Match>(select or.m_match), selector)) 552 return anyAttributeMatches(element, static_cast<CSSSelector::Match>(sele ctor.m_match), selector);
553 return false;
554 }
555 553
556 if (selector.m_match == CSSSelector::PseudoClass) { 554 if (selector.m_match == CSSSelector::PseudoClass) {
557 // Handle :not up front. 555 // Handle :not up front.
558 if (selector.pseudoType() == CSSSelector::PseudoNot) { 556 if (selector.pseudoType() == CSSSelector::PseudoNot) {
559 SelectorCheckingContext subContext(context); 557 SelectorCheckingContext subContext(context);
560 subContext.isSubSelector = true; 558 subContext.isSubSelector = true;
561 ASSERT(selector.selectorList()); 559 ASSERT(selector.selectorList());
562 for (subContext.selector = selector.selectorList()->first(); subCont ext.selector; subContext.selector = subContext.selector->tagHistory()) { 560 for (subContext.selector = selector.selectorList()->first(); subCont ext.selector; subContext.selector = subContext.selector->tagHistory()) {
563 // :not cannot nest. I don't really know why this is a 561 // :not cannot nest. I don't really know why this is a
564 // restriction in CSS3, but it is, so let's honor it. 562 // restriction in CSS3, but it is, so let's honor it.
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return element.focused() && isFrameFocused(element); 1148 return element.focused() && isFrameFocused(element);
1151 } 1149 }
1152 1150
1153 template 1151 template
1154 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const; 1152 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const;
1155 1153
1156 template 1154 template
1157 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; 1155 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const;
1158 1156
1159 } 1157 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698