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

Side by Side Diff: Source/core/dom/SelectorQuery.cpp

Issue 23851002: Have SelectorQuery constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 inline bool SelectorDataList::selectorMatches(const SelectorData& selectorData, Element* element, const Node* rootNode) const 142 inline bool SelectorDataList::selectorMatches(const SelectorData& selectorData, Element* element, const Node* rootNode) const
143 { 143 {
144 if (selectorData.isFastCheckable && !element->isSVGElement()) { 144 if (selectorData.isFastCheckable && !element->isSVGElement()) {
145 SelectorCheckerFastPath selectorCheckerFastPath(selectorData.selector, e lement); 145 SelectorCheckerFastPath selectorCheckerFastPath(selectorData.selector, e lement);
146 if (!selectorCheckerFastPath.matchesRightmostSelector(SelectorChecker::V isitedMatchDisabled)) 146 if (!selectorCheckerFastPath.matchesRightmostSelector(SelectorChecker::V isitedMatchDisabled))
147 return false; 147 return false;
148 return selectorCheckerFastPath.matches(); 148 return selectorCheckerFastPath.matches();
149 } 149 }
150 150
151 SelectorChecker selectorChecker(&element->document(), SelectorChecker::Query ingRules); 151 SelectorChecker selectorChecker(element->document(), SelectorChecker::Queryi ngRules);
152 SelectorChecker::SelectorCheckingContext selectorCheckingContext(selectorDat a.selector, element, SelectorChecker::VisitedMatchDisabled); 152 SelectorChecker::SelectorCheckingContext selectorCheckingContext(selectorDat a.selector, element, SelectorChecker::VisitedMatchDisabled);
153 selectorCheckingContext.behaviorAtBoundary = SelectorChecker::StaysWithinTre eScope; 153 selectorCheckingContext.behaviorAtBoundary = SelectorChecker::StaysWithinTre eScope;
154 selectorCheckingContext.scope = !rootNode->isDocumentNode() && rootNode->isC ontainerNode() ? toContainerNode(rootNode) : 0; 154 selectorCheckingContext.scope = !rootNode->isDocumentNode() && rootNode->isC ontainerNode() ? toContainerNode(rootNode) : 0;
155 PseudoId ignoreDynamicPseudo = NOPSEUDO; 155 PseudoId ignoreDynamicPseudo = NOPSEUDO;
156 return selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, D OMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches; 156 return selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, D OMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches;
157 } 157 }
158 158
159 bool SelectorDataList::matches(Element* targetElement) const 159 bool SelectorDataList::matches(Element* targetElement) const
160 { 160 {
161 ASSERT(targetElement); 161 ASSERT(targetElement);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 m_entries.add(selectors, selectorQuery.release()); 510 m_entries.add(selectors, selectorQuery.release());
511 return rawSelectorQuery; 511 return rawSelectorQuery;
512 } 512 }
513 513
514 void SelectorQueryCache::invalidate() 514 void SelectorQueryCache::invalidate()
515 { 515 {
516 m_entries.clear(); 516 m_entries.clear();
517 } 517 }
518 518
519 } 519 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/html/shadow/HTMLContentElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698