Changeset 51608 in webkit
- Timestamp:
- Dec 2, 2009 11:27:17 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/platform/mac/fast/css/variables/misplaced-import-test-expected.checksum
r38008 r51608 1 298a5c439d36bd284adea72df4b2cbd5 1 3b521f0661cb5be8ef5513b2de77f62e -
trunk/LayoutTests/platform/mac/fast/css/variables/misplaced-import-test-expected.txt
r36855 r51608 3 3 layer at (0,0) size 800x34 4 4 RenderBlock {HTML} at (0,0) size 800x34 5 RenderBody {BODY} at (8,8) size 784x18 5 RenderBody {BODY} at (8,8) size 784x18 [bgcolor=#FF0000] 6 6 RenderText {#text} at (0,0) size 511x18 7 7 text run at (0,0) width 316: "This text should be green on a white background. " -
trunk/WebCore/ChangeLog
r51605 r51608 1 2009-12-02 Dave Hyatt <hyatt@apple.com> 2 3 Reviewed by Darin Adler. 4 5 https://bugs.webkit.org/show_bug.cgi?id=32072, clean up invalid @-rule error handling so that we 6 pass more CSS test suite stuff. Make the grammar stop enforcing the ordering of @namespace vs. 7 @variables vs. @import. Just let the parser handle that instead. This simplifies the grammar and 8 makes error handling deal with more cases correctly. 9 10 Added fast/css/namespaces/namespaces-invalid-at-rules.xml 11 12 * css/CSSGrammar.y: 13 * css/CSSParser.cpp: 14 (WebCore::CSSParser::CSSParser): 15 (WebCore::CSSParser::parseRule): 16 (WebCore::CSSParser::createCharsetRule): 17 (WebCore::CSSParser::createImportRule): 18 (WebCore::CSSParser::createMediaRule): 19 (WebCore::CSSParser::createKeyframesRule): 20 (WebCore::CSSParser::createStyleRule): 21 (WebCore::CSSParser::createFontFaceRule): 22 (WebCore::CSSParser::addNamespace): 23 (WebCore::CSSParser::createVariablesRule): 24 * css/CSSParser.h: 25 1 26 2009-12-02 Yusuke Sato <yusukes@chromium.org> 2 27 -
trunk/WebCore/css/CSSGrammar.y
r51549 r51608 98 98 %} 99 99 100 %expect 51100 %expect 48 101 101 102 102 %nonassoc LOWEST_PREC … … 185 185 %type <rule> charset 186 186 %type <rule> ruleset 187 %type <rule> valid_rule_or_import188 187 %type <rule> media 189 188 %type <rule> import 189 %type <rule> namespace 190 190 %type <rule> page 191 191 %type <rule> font_face … … 194 194 %type <rule> save_block 195 195 %type <rule> invalid_at 196 %type <rule> invalid_at_list197 %type <rule> invalid_import198 %type <rule> invalid_media199 196 %type <rule> rule 200 197 %type <rule> valid_rule … … 269 266 270 267 stylesheet: 271 maybe_space maybe_charset maybe_sgml import_list variables_list namespace_listrule_list268 maybe_space maybe_charset maybe_sgml rule_list 272 269 | webkit_rule maybe_space 273 270 | webkit_decls maybe_space … … 279 276 ; 280 277 281 valid_rule_or_import:282 valid_rule283 | import284 ;285 286 278 webkit_rule: 287 WEBKIT_RULE_SYM '{' maybe_space valid_rule _or_importmaybe_space '}' {279 WEBKIT_RULE_SYM '{' maybe_space valid_rule maybe_space '}' { 288 280 static_cast<CSSParser*>(parser)->m_rule = $4; 289 281 } … … 374 366 ; 375 367 376 import_list:377 /* empty */378 | import_list import maybe_sgml {379 CSSParser* p = static_cast<CSSParser*>(parser);380 if ($2 && p->m_styleSheet)381 p->m_styleSheet->append($2);382 }383 | invalid_at_list {384 }385 ;386 387 variables_list:388 /* empty */389 | variables_list variables_rule maybe_sgml {390 CSSParser* p = static_cast<CSSParser*>(parser);391 if ($2 && p->m_styleSheet)392 p->m_styleSheet->append($2);393 }394 ;395 396 namespace_list:397 /* empty */398 | namespace_list namespace maybe_sgml399 ;400 401 368 rule_list: 402 369 /* empty */ … … 414 381 | font_face 415 382 | keyframes 383 | namespace 384 | import 385 | variables_rule 416 386 ; 417 387 … … 420 390 | invalid_rule 421 391 | invalid_at 422 | invalid_import423 392 ; 424 393 … … 446 415 | invalid_rule 447 416 | invalid_at 448 | invalid_import 449 | invalid_media 417 | namespace 418 | import 419 | variables_rule 420 | media 450 421 ; 451 422 … … 571 542 namespace: 572 543 NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' { 573 CSSParser* p = static_cast<CSSParser*>(parser); 574 if (p->m_styleSheet) 575 p->m_styleSheet->addNamespace(p, $3, $4); 544 static_cast<CSSParser*>(parser)->addNamespace($3, $4); 545 $$ = 0; 576 546 } 577 | NAMESPACE_SYM error invalid_block 578 | NAMESPACE_SYM error ';' 547 | NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space invalid_block { 548 $$ = 0; 549 } 550 | NAMESPACE_SYM error invalid_block { 551 $$ = 0; 552 } 553 | NAMESPACE_SYM error ';' { 554 $$ = 0; 555 } 579 556 ; 580 557 … … 1482 1459 ; 1483 1460 1484 invalid_at_list:1485 invalid_at maybe_sgml1486 | invalid_at_list invalid_at maybe_sgml1487 ;1488 1489 invalid_import:1490 import {1491 $$ = 0;1492 }1493 ;1494 1495 invalid_media:1496 media {1497 $$ = 0;1498 }1499 ;1500 1501 1461 invalid_rule: 1502 1462 error invalid_block { -
trunk/WebCore/css/CSSParser.cpp
r51600 r51608 143 143 , m_data(0) 144 144 , yy_start(1) 145 , m_allowImportRules(true) 146 , m_allowVariablesRules(true) 147 , m_allowNamespaceDeclarations(true) 145 148 , m_floatingMediaQuery(0) 146 149 , m_floatingMediaQueryExp(0) … … 230 233 { 231 234 m_styleSheet = sheet; 235 m_allowNamespaceDeclarations = false; 232 236 setupParser("@-webkit-rule{", string, "} "); 233 237 cssyyparse(this); … … 4977 4981 CSSRule* CSSParser::createImportRule(const CSSParserString& url, MediaList* media) 4978 4982 { 4979 if (!media || !m_styleSheet )4983 if (!media || !m_styleSheet || !m_allowImportRules) 4980 4984 return 0; 4981 4985 RefPtr<CSSImportRule> rule = CSSImportRule::create(m_styleSheet, url, media); … … 4989 4993 if (!media || !rules || !m_styleSheet) 4990 4994 return 0; 4995 m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; 4991 4996 RefPtr<CSSMediaRule> rule = CSSMediaRule::create(m_styleSheet, media, rules); 4992 4997 CSSMediaRule* result = rule.get(); … … 5006 5011 WebKitCSSKeyframesRule* CSSParser::createKeyframesRule() 5007 5012 { 5013 m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; 5008 5014 RefPtr<WebKitCSSKeyframesRule> rule = WebKitCSSKeyframesRule::create(m_styleSheet); 5009 5015 WebKitCSSKeyframesRule* rulePtr = rule.get(); … … 5014 5020 CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors) 5015 5021 { 5022 m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; 5016 5023 CSSStyleRule* result = 0; 5017 5024 if (selectors) { … … 5030 5037 CSSRule* CSSParser::createFontFaceRule() 5031 5038 { 5039 m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; 5032 5040 RefPtr<CSSFontFaceRule> rule = CSSFontFaceRule::create(m_styleSheet); 5033 5041 for (unsigned i = 0; i < m_numParsedProperties; ++i) { … … 5047 5055 } 5048 5056 5057 void CSSParser::addNamespace(const AtomicString& prefix, const AtomicString& uri) 5058 { 5059 if (!m_styleSheet || !m_allowNamespaceDeclarations) 5060 return; 5061 m_allowImportRules = false; 5062 m_allowVariablesRules = false; 5063 m_styleSheet->addNamespace(this, prefix, uri); 5064 } 5065 5049 5066 #if !ENABLE(CSS_VARIABLES) 5050 5067 … … 5068 5085 CSSRule* CSSParser::createVariablesRule(MediaList* mediaList, bool variablesKeyword) 5069 5086 { 5087 if (!m_allowVariablesRules) 5088 return 0; 5089 m_allowImportRules = false; 5070 5090 RefPtr<CSSVariablesRule> rule = CSSVariablesRule::create(m_styleSheet, mediaList, variablesKeyword); 5071 5091 rule->setDeclaration(CSSVariablesDeclaration::create(rule.get(), m_variableNames, m_variableValues)); -
trunk/WebCore/css/CSSParser.h
r51600 r51608 188 188 MediaQuery* sinkFloatingMediaQuery(MediaQuery*); 189 189 190 void addNamespace(const AtomicString& prefix, const AtomicString& uri); 191 190 192 bool addVariable(const CSSParserString&, CSSParserValueList*); 191 193 bool addVariableDeclarationBlock(const CSSParserString&); … … 194 196 195 197 Vector<CSSSelector*>* reusableSelectorVector() { return &m_reusableSelectorVector; } 196 198 197 199 bool m_strict; 198 200 bool m_important; … … 249 251 int yyTok; 250 252 int yy_start; 253 254 bool m_allowImportRules; 255 bool m_allowVariablesRules; 256 bool m_allowNamespaceDeclarations; 251 257 252 258 Vector<RefPtr<StyleBase> > m_parsedStyleObjects;
Note: See TracChangeset
for help on using the changeset viewer.