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

Unified Diff: Source/core/css/CSSGrammar.y

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/CSSGrammar.y
diff --git a/Source/core/css/CSSGrammar.y b/Source/core/css/CSSGrammar.y
index f010bee340e5be7c509cd90cc4f399575a24ea26..1982307f815c234f11ba39227f90385f37089cb0 100644
--- a/Source/core/css/CSSGrammar.y
+++ b/Source/core/css/CSSGrammar.y
@@ -114,6 +114,7 @@ static inline bool isCSSTokenAString(int yytype)
case FUNCTION:
case ANYFUNCTION:
case HOSTFUNCTION:
+ case ANCESTORFUNCTION:
case NOTFUNCTION:
case CALCFUNCTION:
case MINFUNCTION:
@@ -269,6 +270,7 @@ inline static CSSParserValue makeIdentValue(CSSParserString string)
%token <string> VARFUNCTION
%token <string> VAR_DEFINITION
%token <string> HOSTFUNCTION
+%token <string> ANCESTORFUNCTION
%token <string> UNICODERANGE
@@ -1542,6 +1544,29 @@ pseudo:
| ':' HOSTFUNCTION selector_recovery closing_parenthesis {
YYERROR;
}
+ | ':' ANCESTORFUNCTION maybe_space simple_selector_list maybe_space closing_parenthesis {
+ $$ = parser->createFloatingSelector();
+ $$->setMatch(CSSSelector::PseudoClass);
+ $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4));
+ parser->tokenToLowerCase($2);
+ $$->setValue($2);
+ CSSSelector::PseudoType type = $$->pseudoType();
+ if (type != CSSSelector::PseudoAncestor)
+ YYERROR;
+ }
+ // used by :ancestor()
+ | ':' ANCESTORFUNCTION maybe_space closing_parenthesis {
+ $$ = parser->createFloatingSelector();
+ $$->setMatch(CSSSelector::PseudoClass);
+ parser->tokenToLowerCase($2);
+ $$->setValue($2.atomicSubstring(0, $2.length() - 1));
+ CSSSelector::PseudoType type = $$->pseudoType();
+ if (type != CSSSelector::PseudoAncestor)
+ YYERROR;
+ }
+ | ':' ANCESTORFUNCTION selector_recovery closing_parenthesis {
+ YYERROR;
+ }
;
selector_recovery:

Powered by Google App Engine
This is Rietveld 408576698