| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA | 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA |
| 23 * | 23 * |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "CSSPropertyNames.h" | 28 #include "CSSPropertyNames.h" |
| 29 #include "core/css/CSSPrimitiveValue.h" | 29 #include "core/css/CSSPrimitiveValue.h" |
| 30 #include "core/css/CSSSelector.h" | 30 #include "core/css/CSSSelector.h" |
| 31 #include "core/css/CSSSelectorList.h" | 31 #include "core/css/CSSSelectorList.h" |
| 32 #include "core/css/StyleKeyframe.h" | |
| 33 #include "core/css/StyleRule.h" | 32 #include "core/css/StyleRule.h" |
| 34 #include "core/css/StyleRuleKeyframes.h" | |
| 35 #include "core/css/StyleSheetContents.h" | 33 #include "core/css/StyleSheetContents.h" |
| 36 #include "core/css/parser/BisonCSSParser.h" | 34 #include "core/css/parser/BisonCSSParser.h" |
| 37 #include "core/css/parser/CSSParserMode.h" | 35 #include "core/css/parser/CSSParserMode.h" |
| 38 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 39 #include "wtf/FastMalloc.h" | 37 #include "wtf/FastMalloc.h" |
| 40 #include <stdlib.h> | 38 #include <stdlib.h> |
| 41 #include <string.h> | 39 #include <string.h> |
| 42 | 40 |
| 43 using namespace blink; | 41 using namespace blink; |
| 44 | 42 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 | 61 |
| 64 %union { | 62 %union { |
| 65 bool boolean; | 63 bool boolean; |
| 66 char character; | 64 char character; |
| 67 int integer; | 65 int integer; |
| 68 double number; | 66 double number; |
| 69 CSSParserString string; | 67 CSSParserString string; |
| 70 | 68 |
| 71 StyleRuleBase* rule; | 69 StyleRuleBase* rule; |
| 72 // The content of the three below HeapVectors are guaranteed to be kept aliv
e by | 70 // The content of the three below HeapVectors are guaranteed to be kept aliv
e by |
| 73 // the corresponding m_parsedRules, and m_parsedKeyFrames | 71 // the corresponding m_parsedRules. |
| 74 // lists in BisonCSSParser.h. | 72 // lists in BisonCSSParser.h. |
| 75 Vector<RefPtr<StyleRuleBase> >* ruleList; | 73 Vector<RefPtr<StyleRuleBase> >* ruleList; |
| 76 Vector<RefPtr<StyleKeyframe> >* keyframeRuleList; | |
| 77 CSSParserSelector* selector; | 74 CSSParserSelector* selector; |
| 78 Vector<OwnPtr<CSSParserSelector> >* selectorList; | 75 Vector<OwnPtr<CSSParserSelector> >* selectorList; |
| 79 CSSSelector::AttributeMatchType attributeMatchType; | 76 CSSSelector::AttributeMatchType attributeMatchType; |
| 80 CSSParserValue value; | 77 CSSParserValue value; |
| 81 CSSParserValueList* valueList; | 78 CSSParserValueList* valueList; |
| 82 StyleKeyframe* keyframe; | |
| 83 float val; | 79 float val; |
| 84 CSSPropertyID id; | 80 CSSPropertyID id; |
| 85 CSSParserLocation location; | 81 CSSParserLocation location; |
| 86 } | 82 } |
| 87 | 83 |
| 88 %{ | 84 %{ |
| 89 | 85 |
| 90 static inline int cssyyerror(void*, const char*) | 86 static inline int cssyyerror(void*, const char*) |
| 91 { | 87 { |
| 92 return 1; | 88 return 1; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 %nonassoc error | 156 %nonassoc error |
| 161 %left '|' | 157 %left '|' |
| 162 | 158 |
| 163 %token SUPPORTS_SYM | 159 %token SUPPORTS_SYM |
| 164 %token FONT_FACE_SYM | 160 %token FONT_FACE_SYM |
| 165 %token CHARSET_SYM | 161 %token CHARSET_SYM |
| 166 %token INTERNAL_DECLS_SYM | 162 %token INTERNAL_DECLS_SYM |
| 167 %token INTERNAL_RULE_SYM | 163 %token INTERNAL_RULE_SYM |
| 168 %token INTERNAL_SELECTOR_SYM | 164 %token INTERNAL_SELECTOR_SYM |
| 169 %token INTERNAL_VALUE_SYM | 165 %token INTERNAL_VALUE_SYM |
| 170 %token INTERNAL_KEYFRAME_RULE_SYM | |
| 171 %token INTERNAL_KEYFRAME_KEY_LIST_SYM | |
| 172 %token INTERNAL_SUPPORTS_CONDITION_SYM | 166 %token INTERNAL_SUPPORTS_CONDITION_SYM |
| 173 %token KEYFRAMES_SYM | |
| 174 | 167 |
| 175 %token ATKEYWORD | 168 %token ATKEYWORD |
| 176 | 169 |
| 177 %token SUPPORTS_NOT | 170 %token SUPPORTS_NOT |
| 178 %token SUPPORTS_AND | 171 %token SUPPORTS_AND |
| 179 %token SUPPORTS_OR | 172 %token SUPPORTS_OR |
| 180 | 173 |
| 181 %token <number> CHS | 174 %token <number> CHS |
| 182 %token <number> EMS | 175 %token <number> EMS |
| 183 %token <number> EXS | 176 %token <number> EXS |
| (...skipping 28 matching lines...) Expand all Loading... |
| 212 %token <string> URI | 205 %token <string> URI |
| 213 %token <string> FUNCTION | 206 %token <string> FUNCTION |
| 214 %token <string> NOTFUNCTION | 207 %token <string> NOTFUNCTION |
| 215 %token <string> CALCFUNCTION | 208 %token <string> CALCFUNCTION |
| 216 %token <string> HOSTFUNCTION | 209 %token <string> HOSTFUNCTION |
| 217 | 210 |
| 218 %token <string> UNICODERANGE | 211 %token <string> UNICODERANGE |
| 219 | 212 |
| 220 %type <rule> ruleset | 213 %type <rule> ruleset |
| 221 %type <rule> font_face | 214 %type <rule> font_face |
| 222 %type <rule> keyframes | |
| 223 %type <rule> rule | 215 %type <rule> rule |
| 224 %type <rule> valid_rule | 216 %type <rule> valid_rule |
| 225 %type <ruleList> block_rule_body | 217 %type <ruleList> block_rule_body |
| 226 %type <ruleList> block_rule_list | 218 %type <ruleList> block_rule_list |
| 227 %type <rule> block_rule | 219 %type <rule> block_rule |
| 228 %type <rule> block_valid_rule | 220 %type <rule> block_valid_rule |
| 229 %type <rule> supports | 221 %type <rule> supports |
| 230 %type <boolean> keyframes_rule_start | |
| 231 | 222 |
| 232 %type <string> ident_or_string | 223 %type <string> ident_or_string |
| 233 | 224 |
| 234 %type <boolean> supports_condition | 225 %type <boolean> supports_condition |
| 235 %type <boolean> supports_condition_in_parens | 226 %type <boolean> supports_condition_in_parens |
| 236 %type <boolean> supports_negation | 227 %type <boolean> supports_negation |
| 237 %type <boolean> supports_conjunction | 228 %type <boolean> supports_conjunction |
| 238 %type <boolean> supports_disjunction | 229 %type <boolean> supports_disjunction |
| 239 %type <boolean> supports_declaration_condition | 230 %type <boolean> supports_declaration_condition |
| 240 | 231 |
| 241 %type <string> keyframe_name | |
| 242 %type <keyframe> keyframe_rule | |
| 243 %type <keyframeRuleList> keyframes_rule | |
| 244 %type <keyframeRuleList> keyframe_rule_list | |
| 245 %type <valueList> key_list | |
| 246 %type <value> key | |
| 247 | |
| 248 %type <id> property | 232 %type <id> property |
| 249 | 233 |
| 250 %type <selector> specifier | 234 %type <selector> specifier |
| 251 %type <selector> specifier_list | 235 %type <selector> specifier_list |
| 252 %type <selector> simple_selector | 236 %type <selector> simple_selector |
| 253 %type <selector> selector | 237 %type <selector> selector |
| 254 %type <selectorList> selector_list | 238 %type <selectorList> selector_list |
| 255 %type <selectorList> simple_selector_list | 239 %type <selectorList> simple_selector_list |
| 256 %type <selector> class | 240 %type <selector> class |
| 257 %type <selector> attrib | 241 %type <selector> attrib |
| (...skipping 29 matching lines...) Expand all Loading... |
| 287 %type <value> track_names_list | 271 %type <value> track_names_list |
| 288 | 272 |
| 289 %% | 273 %% |
| 290 | 274 |
| 291 stylesheet: | 275 stylesheet: |
| 292 maybe_charset maybe_sgml rule_list | 276 maybe_charset maybe_sgml rule_list |
| 293 | internal_decls | 277 | internal_decls |
| 294 | internal_rule | 278 | internal_rule |
| 295 | internal_selector | 279 | internal_selector |
| 296 | internal_value | 280 | internal_value |
| 297 | internal_keyframe_rule | |
| 298 | internal_keyframe_key_list | |
| 299 | internal_supports_condition | 281 | internal_supports_condition |
| 300 ; | 282 ; |
| 301 | 283 |
| 302 internal_rule: | 284 internal_rule: |
| 303 INTERNAL_RULE_SYM maybe_space valid_rule maybe_space TOKEN_EOF { | 285 INTERNAL_RULE_SYM maybe_space valid_rule maybe_space TOKEN_EOF { |
| 304 parser->m_rule = $3; | 286 parser->m_rule = $3; |
| 305 } | 287 } |
| 306 ; | 288 ; |
| 307 | 289 |
| 308 internal_keyframe_rule: | |
| 309 INTERNAL_KEYFRAME_RULE_SYM maybe_space keyframe_rule maybe_space TOKEN_EOF { | |
| 310 parser->m_keyframe = $3; | |
| 311 } | |
| 312 ; | |
| 313 | |
| 314 internal_keyframe_key_list: | |
| 315 INTERNAL_KEYFRAME_KEY_LIST_SYM maybe_space key_list TOKEN_EOF { | |
| 316 parser->m_valueList = parser->sinkFloatingValueList($3); | |
| 317 } | |
| 318 ; | |
| 319 | |
| 320 internal_decls: | 290 internal_decls: |
| 321 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF
{ | 291 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF
{ |
| 322 /* can be empty */ | 292 /* can be empty */ |
| 323 } | 293 } |
| 324 ; | 294 ; |
| 325 | 295 |
| 326 internal_value: | 296 internal_value: |
| 327 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF { | 297 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF { |
| 328 parser->m_valueList = parser->sinkFloatingValueList($3); | 298 parser->m_valueList = parser->sinkFloatingValueList($3); |
| 329 int oldParsedProperties = parser->m_parsedProperties.size(); | 299 int oldParsedProperties = parser->m_parsedProperties.size(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 /* empty */ | 365 /* empty */ |
| 396 | rule_list rule maybe_sgml { | 366 | rule_list rule maybe_sgml { |
| 397 if ($2 && parser->m_styleSheet) | 367 if ($2 && parser->m_styleSheet) |
| 398 parser->m_styleSheet->parserAppendRule($2); | 368 parser->m_styleSheet->parserAppendRule($2); |
| 399 } | 369 } |
| 400 ; | 370 ; |
| 401 | 371 |
| 402 valid_rule: | 372 valid_rule: |
| 403 ruleset | 373 ruleset |
| 404 | font_face | 374 | font_face |
| 405 | keyframes | |
| 406 | supports | 375 | supports |
| 407 ; | 376 ; |
| 408 | 377 |
| 409 before_rule: | 378 before_rule: |
| 410 /* empty */ { | 379 /* empty */ { |
| 411 parser->startRule(); | 380 parser->startRule(); |
| 412 } | 381 } |
| 413 ; | 382 ; |
| 414 | 383 |
| 415 rule: | 384 rule: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 438 | 407 |
| 439 block_rule_recovery: | 408 block_rule_recovery: |
| 440 before_rule invalid_rule_header { | 409 before_rule invalid_rule_header { |
| 441 parser->endRule(false); | 410 parser->endRule(false); |
| 442 } | 411 } |
| 443 ; | 412 ; |
| 444 | 413 |
| 445 block_valid_rule: | 414 block_valid_rule: |
| 446 ruleset | 415 ruleset |
| 447 | font_face | 416 | font_face |
| 448 | keyframes | |
| 449 | supports | 417 | supports |
| 450 ; | 418 ; |
| 451 | 419 |
| 452 block_rule: | 420 block_rule: |
| 453 before_rule block_valid_rule { | 421 before_rule block_valid_rule { |
| 454 $$ = $2; | 422 $$ = $2; |
| 455 parser->endRule(!!$$); | 423 parser->endRule(!!$$); |
| 456 } | 424 } |
| 457 | before_rule invalid_rule { | 425 | before_rule invalid_rule { |
| 458 $$ = 0; | 426 $$ = 0; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 } | 516 } |
| 549 parser->m_valueList = nullptr; | 517 parser->m_valueList = nullptr; |
| 550 parser->endProperty(false); | 518 parser->endProperty(false); |
| 551 } | 519 } |
| 552 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery clo
sing_parenthesis maybe_space { | 520 | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery clo
sing_parenthesis maybe_space { |
| 553 $$ = false; | 521 $$ = false; |
| 554 parser->endProperty(false, GeneralCSSError); | 522 parser->endProperty(false, GeneralCSSError); |
| 555 } | 523 } |
| 556 ; | 524 ; |
| 557 | 525 |
| 558 before_keyframes_rule: | |
| 559 /* empty */ { | |
| 560 parser->startRuleHeader(CSSRuleSourceData::KEYFRAMES_RULE); | |
| 561 } | |
| 562 ; | |
| 563 | |
| 564 keyframes_rule_start: | |
| 565 before_keyframes_rule KEYFRAMES_SYM maybe_space { | |
| 566 $$ = false; | |
| 567 } | |
| 568 ; | |
| 569 | |
| 570 keyframes: | |
| 571 keyframes_rule_start keyframe_name at_rule_header_end_maybe_space '{' at_rul
e_body_start maybe_space location_label keyframes_rule closing_brace { | |
| 572 $$ = parser->createKeyframesRule($2, parser->sinkFloatingKeyframeVector(
$8), $1 /* isPrefixed */); | |
| 573 } | |
| 574 ; | |
| 575 | |
| 576 keyframe_name: | |
| 577 IDENT | |
| 578 | STRING | |
| 579 ; | |
| 580 | |
| 581 keyframes_rule: | |
| 582 keyframe_rule_list | |
| 583 | keyframe_rule_list keyframes_error_recovery { | |
| 584 parser->clearProperties(); | |
| 585 }; | |
| 586 | |
| 587 keyframe_rule_list: | |
| 588 /* empty */ { | |
| 589 $$ = parser->createFloatingKeyframeVector(); | |
| 590 } | |
| 591 | keyframe_rule_list keyframe_rule maybe_space location_label { | |
| 592 $$ = $1; | |
| 593 $$->append($2); | |
| 594 } | |
| 595 | keyframe_rule_list keyframes_error_recovery invalid_block maybe_space loca
tion_label { | |
| 596 parser->clearProperties(); | |
| 597 } | |
| 598 ; | |
| 599 | |
| 600 keyframe_rule: | |
| 601 key_list '{' maybe_space declaration_list closing_brace { | |
| 602 $$ = parser->createKeyframe($1); | |
| 603 } | |
| 604 ; | |
| 605 | |
| 606 key_list: | |
| 607 key maybe_space { | |
| 608 $$ = parser->createFloatingValueList(); | |
| 609 $$->addValue(parser->sinkFloatingValue($1)); | |
| 610 } | |
| 611 | key_list ',' maybe_space key maybe_space { | |
| 612 $$ = $1; | |
| 613 $$->addValue(parser->sinkFloatingValue($4)); | |
| 614 } | |
| 615 ; | |
| 616 | |
| 617 key: | |
| 618 maybe_unary_operator PERCENTAGE { | |
| 619 $$.setFromNumber($1 * $2); | |
| 620 } | |
| 621 | IDENT { | |
| 622 if ($1.equalIgnoringCase("from")) | |
| 623 $$.setFromNumber(0); | |
| 624 else if ($1.equalIgnoringCase("to")) | |
| 625 $$.setFromNumber(100); | |
| 626 else { | |
| 627 YYERROR; | |
| 628 } | |
| 629 } | |
| 630 ; | |
| 631 | |
| 632 keyframes_error_recovery: | |
| 633 error rule_error_recovery { | |
| 634 parser->reportError(parser->lastLocationLabel(), InvalidKeyframeSelector
CSSError); | |
| 635 } | |
| 636 ; | |
| 637 | |
| 638 before_font_face_rule: | 526 before_font_face_rule: |
| 639 /* empty */ { | 527 /* empty */ { |
| 640 parser->startRuleHeader(CSSRuleSourceData::FONT_FACE_RULE); | 528 parser->startRuleHeader(CSSRuleSourceData::FONT_FACE_RULE); |
| 641 } | 529 } |
| 642 ; | 530 ; |
| 643 | 531 |
| 644 font_face: | 532 font_face: |
| 645 before_font_face_rule FONT_FACE_SYM at_rule_header_end_maybe_space | 533 before_font_face_rule FONT_FACE_SYM at_rule_header_end_maybe_space |
| 646 '{' at_rule_body_start maybe_space_before_declaration declaration_list closi
ng_brace { | 534 '{' at_rule_body_start maybe_space_before_declaration declaration_list closi
ng_brace { |
| 647 $$ = parser->createFontFaceRule(); | 535 $$ = parser->createFontFaceRule(); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 parser->reportError($2, InvalidRuleCSSError); | 1087 parser->reportError($2, InvalidRuleCSSError); |
| 1200 } | 1088 } |
| 1201 ; | 1089 ; |
| 1202 | 1090 |
| 1203 at_rule_end: | 1091 at_rule_end: |
| 1204 at_invalid_rule_header_end semi_or_eof | 1092 at_invalid_rule_header_end semi_or_eof |
| 1205 | at_invalid_rule_header_end invalid_block | 1093 | at_invalid_rule_header_end invalid_block |
| 1206 ; | 1094 ; |
| 1207 | 1095 |
| 1208 regular_invalid_at_rule_header: | 1096 regular_invalid_at_rule_header: |
| 1209 keyframes_rule_start at_rule_header_recovery | 1097 before_font_face_rule FONT_FACE_SYM at_rule_header_recovery |
| 1210 | before_font_face_rule FONT_FACE_SYM at_rule_header_recovery | |
| 1211 | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery { | 1098 | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery { |
| 1212 parser->reportError($4, InvalidSupportsConditionCSSError); | 1099 parser->reportError($4, InvalidSupportsConditionCSSError); |
| 1213 parser->popSupportsRuleData(); | 1100 parser->popSupportsRuleData(); |
| 1214 } | 1101 } |
| 1215 | error_location invalid_at at_rule_header_recovery { | 1102 | error_location invalid_at at_rule_header_recovery { |
| 1216 parser->reportError($1, InvalidRuleCSSError); | 1103 parser->reportError($1, InvalidRuleCSSError); |
| 1217 } | 1104 } |
| 1218 ; | 1105 ; |
| 1219 | 1106 |
| 1220 invalid_rule: | 1107 invalid_rule: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 | 1140 |
| 1254 opening_parenthesis: | 1141 opening_parenthesis: |
| 1255 '(' | FUNCTION | CALCFUNCTION | NOTFUNCTION | HOSTFUNCTION | 1142 '(' | FUNCTION | CALCFUNCTION | NOTFUNCTION | HOSTFUNCTION |
| 1256 ; | 1143 ; |
| 1257 | 1144 |
| 1258 error_location: { | 1145 error_location: { |
| 1259 $$ = parser->currentLocation(); | 1146 $$ = parser->currentLocation(); |
| 1260 } | 1147 } |
| 1261 ; | 1148 ; |
| 1262 | 1149 |
| 1263 location_label: { | |
| 1264 parser->setLocationLabel(parser->currentLocation()); | |
| 1265 } | |
| 1266 ; | |
| 1267 | |
| 1268 error_recovery: | 1150 error_recovery: |
| 1269 /* empty */ | 1151 /* empty */ |
| 1270 | error_recovery error | 1152 | error_recovery error |
| 1271 | error_recovery invalid_block | 1153 | error_recovery invalid_block |
| 1272 | error_recovery invalid_square_brackets_block | 1154 | error_recovery invalid_square_brackets_block |
| 1273 | error_recovery invalid_parentheses_block | 1155 | error_recovery invalid_parentheses_block |
| 1274 ; | 1156 ; |
| 1275 | 1157 |
| 1276 rule_error_recovery: | 1158 rule_error_recovery: |
| 1277 /* empty */ | 1159 /* empty */ |
| 1278 | rule_error_recovery error | 1160 | rule_error_recovery error |
| 1279 | rule_error_recovery invalid_square_brackets_block | 1161 | rule_error_recovery invalid_square_brackets_block |
| 1280 | rule_error_recovery invalid_parentheses_block | 1162 | rule_error_recovery invalid_parentheses_block |
| 1281 ; | 1163 ; |
| 1282 | 1164 |
| 1283 %% | 1165 %% |
| OLD | NEW |