Index: Source/core/css/CSSGrammar.y.in |
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in |
index 024f514addcc5349f46debf7ee0d7767cadc3d86..a4377b256e85d11cbe79ea8038bcf4c53647d744 100644 |
--- a/Source/core/css/CSSGrammar.y.in |
+++ b/Source/core/css/CSSGrammar.y.in |
@@ -96,6 +96,15 @@ inline static CSSParserValue makeOperatorValue(int value) |
return v; |
} |
+inline static CSSParserValue makeIdentValue(CSSParserString string) |
+{ |
+ CSSParserValue v; |
+ v.id = cssValueKeywordID(string); |
+ v.unit = CSSPrimitiveValue::CSS_IDENT; |
+ v.string = string; |
+ return v; |
+} |
+ |
%} |
%expect 0 |
@@ -329,6 +338,9 @@ inline static CSSParserValue makeOperatorValue(int value) |
%type <location> error_location |
+%type <valueList> ident_list |
+%type <valueList> track_names_list |
+ |
%% |
stylesheet: |
@@ -1634,16 +1646,47 @@ prio: |
| /* empty */ { $$ = false; } |
; |
+ident_list: |
+ IDENT maybe_space { |
+ $$ = parser->createFloatingValueList(); |
+ $$->addValue(makeIdentValue($1)); |
+ } |
+ | ident_list IDENT maybe_space { |
+ $$ = $1; |
+ $$->addValue(makeIdentValue($2)); |
+ } |
+ ; |
+ |
+track_names_list: |
+ '(' maybe_space ident_list closing_parenthesis maybe_space { |
+ $$ = $3; |
+ $$->insertValueAt(0, makeOperatorValue('(')); |
Julien - ping for review
2013/11/12 07:33:17
I wonder if we couldn't simplify the code by makin
svillar
2013/11/12 07:45:04
I can take a look again, and maybe the changes pro
Julien - ping for review
2013/11/12 07:49:38
Agreed but the proposal was to insert the list as-
|
+ $$->addValue(makeOperatorValue(')')); |
+ } |
+ ; |
+ |
expr: |
term { |
$$ = parser->createFloatingValueList(); |
$$->addValue(parser->sinkFloatingValue($1)); |
} |
+ | track_names_list { |
+ $$ = $1; |
+ } |
+ | expr track_names_list { |
+ $$ = $1; |
+ $$->extend(*($2)); |
rune
2013/09/10 11:30:19
$2, which comes from is createFloatingValueList()
|
+ } |
| expr operator term { |
$$ = $1; |
$$->addValue(makeOperatorValue($2)); |
$$->addValue(parser->sinkFloatingValue($3)); |
} |
+ | expr operator track_names_list { |
+ $$ = $1; |
+ $$->addValue(makeOperatorValue($2)); |
+ $$->extend(*($3)); |
+ } |
| expr term { |
$$ = $1; |
$$->addValue(parser->sinkFloatingValue($2)); |
@@ -1669,11 +1712,7 @@ term: |
unary_term maybe_space |
| unary_operator unary_term maybe_space { $$ = $2; $$.fValue *= $1; } |
| STRING maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_STRING; } |
- | IDENT maybe_space { |
- $$.id = cssValueKeywordID($1); |
- $$.unit = CSSPrimitiveValue::CSS_IDENT; |
- $$.string = $1; |
- } |
+ | IDENT maybe_space { $$ = makeIdentValue($1); } |
/* We might need to actually parse the number from a dimension, but we can't just put something that uses $$.string into unary_term. */ |
| DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } |
| unary_operator DIMEN maybe_space { $$.id = CSSValueInvalid; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } |