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

Side by Side Diff: sky/engine/core/css/parser/CSSGrammar.y

Issue 860423004: Remove css !important (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 %{ 1 %{
2 2
3 /* 3 /*
4 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2012 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 %token INTERNAL_RULE_SYM 167 %token INTERNAL_RULE_SYM
168 %token INTERNAL_SELECTOR_SYM 168 %token INTERNAL_SELECTOR_SYM
169 %token INTERNAL_VALUE_SYM 169 %token INTERNAL_VALUE_SYM
170 %token INTERNAL_KEYFRAME_RULE_SYM 170 %token INTERNAL_KEYFRAME_RULE_SYM
171 %token INTERNAL_KEYFRAME_KEY_LIST_SYM 171 %token INTERNAL_KEYFRAME_KEY_LIST_SYM
172 %token INTERNAL_SUPPORTS_CONDITION_SYM 172 %token INTERNAL_SUPPORTS_CONDITION_SYM
173 %token KEYFRAMES_SYM 173 %token KEYFRAMES_SYM
174 174
175 %token ATKEYWORD 175 %token ATKEYWORD
176 176
177 %token IMPORTANT_SYM
178
179 %token SUPPORTS_NOT 177 %token SUPPORTS_NOT
180 %token SUPPORTS_AND 178 %token SUPPORTS_AND
181 %token SUPPORTS_OR 179 %token SUPPORTS_OR
182 180
183 %token <number> CHS 181 %token <number> CHS
184 %token <number> EMS 182 %token <number> EMS
185 %token <number> EXS 183 %token <number> EXS
186 %token <number> PXS 184 %token <number> PXS
187 %token <number> CMS 185 %token <number> CMS
188 %token <number> MMS 186 %token <number> MMS
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 %type <selectorList> selector_list 254 %type <selectorList> selector_list
257 %type <selectorList> simple_selector_list 255 %type <selectorList> simple_selector_list
258 %type <selector> class 256 %type <selector> class
259 %type <selector> attrib 257 %type <selector> attrib
260 %type <selector> pseudo 258 %type <selector> pseudo
261 259
262 %type <boolean> declaration_list 260 %type <boolean> declaration_list
263 %type <boolean> decl_list 261 %type <boolean> decl_list
264 %type <boolean> declaration 262 %type <boolean> declaration
265 263
266 %type <boolean> prio
267
268 %type <integer> unary_operator 264 %type <integer> unary_operator
269 %type <integer> maybe_unary_operator 265 %type <integer> maybe_unary_operator
270 %type <character> operator 266 %type <character> operator
271 267
272 %type <valueList> expr 268 %type <valueList> expr
273 %type <value> term 269 %type <value> term
274 %type <value> unary_term 270 %type <value> unary_term
275 %type <value> function 271 %type <value> function
276 %type <value> calc_func_term 272 %type <value> calc_func_term
277 %type <character> calc_func_operator 273 %type <character> calc_func_operator
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 internal_decls: 320 internal_decls:
325 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF { 321 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF {
326 /* can be empty */ 322 /* can be empty */
327 } 323 }
328 ; 324 ;
329 325
330 internal_value: 326 internal_value:
331 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF { 327 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF {
332 parser->m_valueList = parser->sinkFloatingValueList($3); 328 parser->m_valueList = parser->sinkFloatingValueList($3);
333 int oldParsedProperties = parser->m_parsedProperties.size(); 329 int oldParsedProperties = parser->m_parsedProperties.size();
334 if (!parser->parseValue(parser->m_id, parser->m_important)) 330 if (!parser->parseValue(parser->m_id))
335 parser->rollbackLastProperties(parser->m_parsedProperties.size() - o ldParsedProperties); 331 parser->rollbackLastProperties(parser->m_parsedProperties.size() - o ldParsedProperties);
336 parser->m_valueList = nullptr; 332 parser->m_valueList = nullptr;
337 } 333 }
338 ; 334 ;
339 335
340 internal_selector: 336 internal_selector:
341 INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF { 337 INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF {
342 if (parser->m_selectorListForParseSelector) 338 if (parser->m_selectorListForParseSelector)
343 parser->m_selectorListForParseSelector->adoptSelectorVector(*$3); 339 parser->m_selectorListForParseSelector->adoptSelectorVector(*$3);
344 } 340 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 $$ = $3; 528 $$ = $3;
533 } 529 }
534 | supports_declaration_condition 530 | supports_declaration_condition
535 | '(' error error_location error_recovery closing_parenthesis maybe_space { 531 | '(' error error_location error_recovery closing_parenthesis maybe_space {
536 parser->reportError($3, InvalidSupportsConditionCSSError); 532 parser->reportError($3, InvalidSupportsConditionCSSError);
537 $$ = false; 533 $$ = false;
538 } 534 }
539 ; 535 ;
540 536
541 supports_declaration_condition: 537 supports_declaration_condition:
542 '(' maybe_space IDENT maybe_space ':' maybe_space expr prio closing_parenthe sis maybe_space { 538 '(' maybe_space IDENT maybe_space ':' maybe_space expr closing_parenthesis m aybe_space {
543 $$ = false; 539 $$ = false;
544 CSSPropertyID id = cssPropertyID($3); 540 CSSPropertyID id = cssPropertyID($3);
545 if (id != CSSPropertyInvalid) { 541 if (id != CSSPropertyInvalid) {
546 parser->m_valueList = parser->sinkFloatingValueList($7); 542 parser->m_valueList = parser->sinkFloatingValueList($7);
547 int oldParsedProperties = parser->m_parsedProperties.size(); 543 int oldParsedProperties = parser->m_parsedProperties.size();
548 $$ = parser->parseValue(id, $8); 544 $$ = parser->parseValue(id);
549 // We just need to know if the declaration is supported as it is wri tten. Rollback any additions. 545 // We just need to know if the declaration is supported as it is wri tten. Rollback any additions.
550 if ($$) 546 if ($$)
551 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties); 547 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
552 } 548 }
553 parser->m_valueList = nullptr; 549 parser->m_valueList = nullptr;
554 parser->endProperty($8, false); 550 parser->endProperty(false);
555 } 551 }
556 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery clo sing_parenthesis maybe_space { 552 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery clo sing_parenthesis maybe_space {
557 $$ = false; 553 $$ = false;
558 parser->endProperty(false, false, GeneralCSSError); 554 parser->endProperty(false, GeneralCSSError);
559 } 555 }
560 ; 556 ;
561 557
562 before_keyframes_rule: 558 before_keyframes_rule:
563 /* empty */ { 559 /* empty */ {
564 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE); 560 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE);
565 } 561 }
566 ; 562 ;
567 563
568 keyframes_rule_start: 564 keyframes_rule_start:
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 parser->startProperty(); 946 parser->startProperty();
951 $$ = $1; 947 $$ = $1;
952 } 948 }
953 | decl_list declaration ';' maybe_space { 949 | decl_list declaration ';' maybe_space {
954 parser->startProperty(); 950 parser->startProperty();
955 $$ = $1 || $2; 951 $$ = $1 || $2;
956 } 952 }
957 ; 953 ;
958 954
959 declaration: 955 declaration:
960 property ':' maybe_space error_location expr prio { 956 property ':' maybe_space error_location expr {
961 $$ = false; 957 $$ = false;
962 bool isPropertyParsed = false; 958 bool isPropertyParsed = false;
963 if ($1 != CSSPropertyInvalid) { 959 if ($1 != CSSPropertyInvalid) {
964 parser->m_valueList = parser->sinkFloatingValueList($5); 960 parser->m_valueList = parser->sinkFloatingValueList($5);
965 int oldParsedProperties = parser->m_parsedProperties.size(); 961 int oldParsedProperties = parser->m_parsedProperties.size();
966 $$ = parser->parseValue($1, $6); 962 $$ = parser->parseValue($1);
967 if (!$$) { 963 if (!$$) {
968 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties); 964 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
969 parser->reportError($4, InvalidPropertyValueCSSError); 965 parser->reportError($4, InvalidPropertyValueCSSError);
970 } else 966 } else
971 isPropertyParsed = true; 967 isPropertyParsed = true;
972 parser->m_valueList = nullptr; 968 parser->m_valueList = nullptr;
973 } 969 }
974 parser->endProperty($6, isPropertyParsed); 970 parser->endProperty(isPropertyParsed);
975 } 971 }
976 | 972 |
977 property ':' maybe_space error_location expr prio error error_recovery { 973 property ':' maybe_space error_location expr error error_recovery {
978 /* When we encounter something like p {color: red !important fail;} we s hould drop the declaration */ 974 /* When we encounter something like p {color: red !important fail;} we s hould drop the declaration */
979 parser->reportError($4, InvalidPropertyValueCSSError); 975 parser->reportError($4, InvalidPropertyValueCSSError);
980 parser->endProperty(false, false); 976 parser->endProperty(false);
981 $$ = false; 977 $$ = false;
982 } 978 }
983 | 979 |
984 property ':' maybe_space error_location error error_recovery { 980 property ':' maybe_space error_location error error_recovery {
985 parser->reportError($4, InvalidPropertyValueCSSError); 981 parser->reportError($4, InvalidPropertyValueCSSError);
986 parser->endProperty(false, false); 982 parser->endProperty(false);
987 $$ = false; 983 $$ = false;
988 } 984 }
989 | 985 |
990 property error error_location error_recovery { 986 property error error_location error_recovery {
991 parser->reportError($3, PropertyDeclarationCSSError); 987 parser->reportError($3, PropertyDeclarationCSSError);
992 parser->endProperty(false, false, GeneralCSSError); 988 parser->endProperty(false, GeneralCSSError);
993 $$ = false; 989 $$ = false;
994 } 990 }
995 | 991 |
996 error error_location error_recovery { 992 error error_location error_recovery {
997 parser->reportError($2, PropertyDeclarationCSSError); 993 parser->reportError($2, PropertyDeclarationCSSError);
998 $$ = false; 994 $$ = false;
999 } 995 }
1000 ; 996 ;
1001 997
1002 property: 998 property:
1003 error_location IDENT maybe_space { 999 error_location IDENT maybe_space {
1004 $$ = cssPropertyID($2); 1000 $$ = cssPropertyID($2);
1005 parser->setCurrentProperty($$); 1001 parser->setCurrentProperty($$);
1006 if ($$ == CSSPropertyInvalid) 1002 if ($$ == CSSPropertyInvalid)
1007 parser->reportError($1, InvalidPropertyCSSError); 1003 parser->reportError($1, InvalidPropertyCSSError);
1008 } 1004 }
1009 ; 1005 ;
1010 1006
1011 prio:
1012 IMPORTANT_SYM maybe_space { $$ = true; }
1013 | /* empty */ { $$ = false; }
1014 ;
1015
1016 ident_list: 1007 ident_list:
1017 IDENT maybe_space { 1008 IDENT maybe_space {
1018 $$ = parser->createFloatingValueList(); 1009 $$ = parser->createFloatingValueList();
1019 $$->addValue(makeIdentValue($1)); 1010 $$->addValue(makeIdentValue($1));
1020 } 1011 }
1021 | ident_list IDENT maybe_space { 1012 | ident_list IDENT maybe_space {
1022 $$ = $1; 1013 $$ = $1;
1023 $$->addValue(makeIdentValue($2)); 1014 $$->addValue(makeIdentValue($2));
1024 } 1015 }
1025 ; 1016 ;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 ; 1274 ;
1284 1275
1285 rule_error_recovery: 1276 rule_error_recovery:
1286 /* empty */ 1277 /* empty */
1287 | rule_error_recovery error 1278 | rule_error_recovery error
1288 | rule_error_recovery invalid_square_brackets_block 1279 | rule_error_recovery invalid_square_brackets_block
1289 | rule_error_recovery invalid_parentheses_block 1280 | rule_error_recovery invalid_parentheses_block
1290 ; 1281 ;
1291 1282
1292 %% 1283 %%
OLDNEW
« no previous file with comments | « sky/engine/core/css/parser/BisonCSSParser-in.cpp ('k') | sky/engine/core/css/parser/CSSParserObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698