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

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

Issue 138023007: Renamed :host to :ancestor and made :host to match only shadow host. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 57b570056d8ddc2f38d6cb0cca578900ecf658ef..f7c459d99a1c1cfecd840af38bb8e6f8262549fc 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -848,6 +848,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
break;
case CSSSelector::PseudoHost:
+ case CSSSelector::PseudoAncestor:
{
// :host only matches a shadow host when :host is in a shadow tree of the shadow host.
if (!context.scope || !(context.behaviorAtBoundary & ScopeIsShadowHost) || context.scope != element)
@@ -869,7 +870,8 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
subContext.behaviorAtBoundary = ScopeIsShadowHostInPseudoHostParameter;
subContext.scope = context.scope;
// Use NodeRenderingTraversal to traverse a composed ancestor list of a given element.
- for (Element* nextElement = &element; nextElement; nextElement = NodeRenderingTraversal::parentElement(nextElement)) {
+ Element* nextElement = &element;
+ do {
MatchResult subResult;
subContext.element = nextElement;
if (match(subContext, siblingTraversalStrategy, &subResult) == SelectorMatches) {
@@ -880,7 +882,12 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
}
subContext.behaviorAtBoundary = DoesNotCrossBoundary;
subContext.scope = 0;
- }
+
+ if (selector->pseudoType() == CSSSelector::PseudoHost)
+ break;
+
+ nextElement = NodeRenderingTraversal::parentElement(nextElement);
+ } while (nextElement);
}
if (matched) {
if (specificity)

Powered by Google App Engine
This is Rietveld 408576698