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

Unified Diff: Source/core/css/SelectorChecker.cpp

Issue 15657003: Make a '::distributed' pseudo element the first-ever client who can accept a relative selector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/SelectorChecker.cpp
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 768de63972ce3c8e4be511c17f62fa86a73e7a0c..4e2032fe73a535532bb1e41514ae39fce6465d46 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -212,28 +212,35 @@ SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& con
nextContext.elementStyle = 0;
return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
}
- case CSSSelector::ShadowDistributed:
- {
- Vector<InsertionPoint*, 8> insertionPoints;
- for (Element* element = context.element; element; element = element->parentElement()) {
- insertionPoints.clear();
- collectInsertionPointsWhereNodeIsDistributed(element, insertionPoints);
- for (size_t i = 0; i < insertionPoints.size(); ++i) {
- nextContext.element = insertionPoints[i];
- nextContext.isSubSelector = false;
- nextContext.elementStyle = 0;
- if (match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy) == SelectorMatches)
- return SelectorMatches;
- }
- }
- return SelectorFailsCompletely;
+ case CSSSelector::ShadowVirtualDescendant:
+ for (Element* element = context.element; element; element = element->parentElement()) {
+ if (matchForVirtualChild(element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext) == SelectorMatches)
+ return SelectorMatches;
}
+ return SelectorFailsCompletely;
+ case CSSSelector::ShadowVirtualChild:
+ return matchForVirtualChild(context.element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext);
}
ASSERT_NOT_REACHED();
return SelectorFailsCompletely;
}
+template<typename SiblingTraversalStrategy>
+SelectorChecker::Match SelectorChecker::matchForVirtualChild(const Element* element, const SiblingTraversalStrategy& siblingTraversalStrategy, PseudoId& dynamicPseudo, SelectorCheckingContext& nextContext) const
dglazkov 2013/05/22 17:43:43 This is interesting. Right now, it's clear that "v
+{
+ Vector<InsertionPoint*, 8> insertionPoints;
+ collectInsertionPointsWhereNodeIsDistributed(element, insertionPoints);
+ for (size_t i = 0; i < insertionPoints.size(); ++i) {
+ nextContext.element = insertionPoints[i];
+ nextContext.isSubSelector = false;
+ nextContext.elementStyle = 0;
+ if (match(nextContext, dynamicPseudo, siblingTraversalStrategy) == SelectorMatches)
+ return SelectorMatches;
+ }
+ return SelectorFailsCompletely;
+}
+
static inline bool containsHTMLSpace(const AtomicString& string)
{
for (unsigned i = 0; i < string.length(); i++)

Powered by Google App Engine
This is Rietveld 408576698