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

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

Issue 1129673002: Remove support for pseudo classes in <content select>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix more tests. Created 5 years, 7 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, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 11 matching lines...) Expand all
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/dom/SelectorQuery.h" 28 #include "core/dom/SelectorQuery.h"
29 29
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "core/css/SelectorChecker.h" 31 #include "core/css/SelectorChecker.h"
32 #include "core/css/SiblingTraversalStrategies.h"
33 #include "core/css/parser/CSSParser.h" 32 #include "core/css/parser/CSSParser.h"
34 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
35 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
36 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
37 #include "core/dom/Node.h" 36 #include "core/dom/Node.h"
38 #include "core/dom/StaticNodeList.h" 37 #include "core/dom/StaticNodeList.h"
39 #include "core/dom/shadow/ElementShadow.h" 38 #include "core/dom/shadow/ElementShadow.h"
40 #include "core/dom/shadow/ShadowRoot.h" 39 #include "core/dom/shadow/ShadowRoot.h"
41 40
42 namespace blink { 41 namespace blink {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 115 }
117 } 116 }
118 117
119 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme nt& element, const ContainerNode& rootNode) const 118 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme nt& element, const ContainerNode& rootNode) const
120 { 119 {
121 SelectorChecker selectorChecker(SelectorChecker::QueryingRules); 120 SelectorChecker selectorChecker(SelectorChecker::QueryingRules);
122 SelectorChecker::SelectorCheckingContext selectorCheckingContext(selector, & element, SelectorChecker::VisitedMatchDisabled); 121 SelectorChecker::SelectorCheckingContext selectorCheckingContext(selector, & element, SelectorChecker::VisitedMatchDisabled);
123 selectorCheckingContext.scope = !rootNode.isDocumentNode() ? &rootNode : 0; 122 selectorCheckingContext.scope = !rootNode.isDocumentNode() ? &rootNode : 0;
124 if (selectorCheckingContext.scope) 123 if (selectorCheckingContext.scope)
125 selectorCheckingContext.scopeContainsLastMatchedElement = true; 124 selectorCheckingContext.scopeContainsLastMatchedElement = true;
126 return selectorChecker.match(selectorCheckingContext, DOMSiblingTraversalStr ategy()) == SelectorChecker::SelectorMatches; 125 return selectorChecker.match(selectorCheckingContext) == SelectorChecker::Se lectorMatches;
127 } 126 }
128 127
129 bool SelectorDataList::matches(Element& targetElement) const 128 bool SelectorDataList::matches(Element& targetElement) const
130 { 129 {
131 unsigned selectorCount = m_selectors.size(); 130 unsigned selectorCount = m_selectors.size();
132 for (unsigned i = 0; i < selectorCount; ++i) { 131 for (unsigned i = 0; i < selectorCount; ++i) {
133 if (selectorMatches(*m_selectors[i], targetElement, targetElement)) 132 if (selectorMatches(*m_selectors[i], targetElement, targetElement))
134 return true; 133 return true;
135 } 134 }
136 135
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 537
539 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa lue->value.get(); 538 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa lue->value.get();
540 } 539 }
541 540
542 void SelectorQueryCache::invalidate() 541 void SelectorQueryCache::invalidate()
543 { 542 {
544 m_entries.clear(); 543 m_entries.clear();
545 } 544 }
546 545
547 } 546 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698