Changeset 176983 in webkit
- Timestamp:
- Dec 8, 2014 3:55:04 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r176978 r176983 1 2014-12-08 Benjamin Poulain <benjamin@webkit.org> 2 3 Fix the parsing of advanced :lang() after r176902 4 https://bugs.webkit.org/show_bug.cgi?id=139379 5 6 Reviewed by Andreas Kling. 7 8 Unskip and update the tests. 9 10 All the interesting cases were covered, I just had to update 11 the expectations. 12 13 * TestExpectations: 14 * fast/css/css-selector-text-expected.txt: 15 * fast/css/css-selector-text.html: 16 * fast/css/parsing-css-lang-expected.txt: 17 * fast/css/parsing-css-lang.html: 18 1 19 2014-12-08 Myles C. Maxfield <mmaxfield@apple.com> 2 20 -
trunk/LayoutTests/TestExpectations
r176908 r176983 130 130 webkit.org/b/135390 fast/css/fontloader-page-cache.html [ Skip ] 131 131 webkit.org/b/135390 http/tests/webfont/fontloader-loading-attribute.html [ Skip ] 132 133 # regression due to r176902:134 webkit.org/b/139014 [ Debug ] fast/css/parsing-css-lang.html [ Skip ]135 webkit.org/b/139014 [ Debug ] fast/css/css-selector-text.html [ Skip ]136 132 137 133 # Various failures from the W3C CSS Shapes test suite import -
trunk/LayoutTests/fast/css/css-selector-text-expected.txt
r176902 r176983 48 48 PASS parseThenSerializeRule(':visited { }') is ':visited { }' 49 49 50 PASS parseThenSerializeRule(':lang(*-) { }') is ':lang(*-) { }'51 PASS parseThenSerializeRule(':lang(*--) { }') is ':lang(*--) { }'52 PASS parseThenSerializeRule(':lang(*---) { }') is ':lang(*---) { }'53 PASS parseThenSerializeRule(':lang(*----) { }') is ':lang(*----) { }'54 55 50 PASS parseThenSerializeRule(':lang(*-ab) { }') is ':lang(*-ab) { }' 56 51 PASS parseThenSerializeRule(':lang(*-ab-) { }') is ':lang(*-ab-) { }' 57 PASS parseThenSerializeRule(':lang(*-1996) { }') is ':lang(*-1996) { }'58 52 PASS parseThenSerializeRule(':lang(*-DE-1996) { }') is ':lang(*-DE-1996) { }' 59 53 … … 325 319 326 320 PASS parseThenSerializeRule(':lang(\\* ) { }') is ':lang(*) { }' 327 PASS parseThenSerializeRule(':lang(*- ) { }') is ':lang(*-) { }'328 321 PASS parseThenSerializeRule(':lang(*-en ) { }') is ':lang(*-en) { }' 329 322 PASS parseThenSerializeRule(':lang(*-en-\\* ) { }') is ':lang(*-en-*) { }' … … 360 353 PASS parseThenSerializeRule(':lang( \\* , id-\\*-sumatra ) { }') is ':lang(*, id-*-sumatra) { }' 361 354 PASS parseThenSerializeRule(':lang( \\* , id-\\*-sumatra ) { }') is ':lang(*, id-*-sumatra) { }' 362 363 PASS parseThenSerializeRule(':lang(*-1996) { }') is ':lang(*-1996) { }'364 PASS parseThenSerializeRule(':lang(*-1996, *-1997) { }') is ':lang(*-1996, *-1997) { }'365 PASS parseThenSerializeRule(':lang(*-1996, *-1997 ) { }') is ':lang(*-1996, *-1997) { }'366 PASS parseThenSerializeRule(':lang( *-1996 , *-1997 ) { }') is ':lang(*-1996, *-1997) { }'367 PASS parseThenSerializeRule(':lang( *-1996 ,*-1997 ) { }') is ':lang(*-1996, *-1997) { }'368 PASS parseThenSerializeRule(':lang( *-1996,*-1997 ) { }') is ':lang(*-1996, *-1997) { }'369 355 370 356 PASS parseThenSerializeRule(':lang(en-\\*) { }') is ':lang(en-*) { }' … … 397 383 PASS parseThenSerializeRule(':lang([]) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 398 384 PASS parseThenSerializeRule(':lang(@media screen {}) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 399 PASS parseThenSerializeRule(':lang(*)') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 400 PASS parseThenSerializeRule(':lang(**)') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 401 PASS parseThenSerializeRule(':lang(-*-)') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 385 PASS parseThenSerializeRule(':lang(*-) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 386 PASS parseThenSerializeRule(':lang(*- ) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 387 PASS parseThenSerializeRule(':lang(*--) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 388 PASS parseThenSerializeRule(':lang(*---) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 389 PASS parseThenSerializeRule(':lang(*----) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 390 PASS parseThenSerializeRule(':lang(*)' { }) threw exception SyntaxError: Unexpected token '{'. Expected ')' to end a argument list.. 391 PASS parseThenSerializeRule(':lang(**) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 392 PASS parseThenSerializeRule(':lang(-*-) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 402 393 PASS parseThenSerializeRule(':lang(*-*) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 403 394 PASS parseThenSerializeRule(':lang(de-*)') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). … … 406 397 PASS parseThenSerializeRule(':lang(*-en-*fr) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 407 398 PASS parseThenSerializeRule(':lang(*-*en-fr) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 408 PASS parseThenSerializeRule(':lang(*-1997) ') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').409 PASS parseThenSerializeRule(':lang(*-1997-*) ') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').399 PASS parseThenSerializeRule(':lang(*-1997) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 400 PASS parseThenSerializeRule(':lang(*-1997-*) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 410 401 PASS parseThenSerializeRule(':lang(*a*) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 411 402 PASS parseThenSerializeRule(':lang(*a) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). … … 418 409 PASS parseThenSerializeRule(':lang(*-a, br fr) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 419 410 PASS parseThenSerializeRule(':lang(*-a, br fr en *) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 411 PASS parseThenSerializeRule(':lang(*-1996, *-1997) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 412 PASS parseThenSerializeRule(':lang(*-1996, *-1997 ) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 413 PASS parseThenSerializeRule(':lang( *-1996 , *-1997 ) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 414 PASS parseThenSerializeRule(':lang( *-1996 ,*-1997 ) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 415 PASS parseThenSerializeRule(':lang( *-1996,*-1997 ) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText'). 420 416 421 417 PASS parseThenSerializeRule(':role(a) { }') is ':role(a) { }' -
trunk/LayoutTests/fast/css/css-selector-text.html
r176902 r176983 81 81 debug(''); 82 82 83 testSelectorRoundTrip(":lang(*-)");84 testSelectorRoundTrip(":lang(*--)");85 testSelectorRoundTrip(":lang(*---)");86 testSelectorRoundTrip(":lang(*----)");87 88 debug('');89 90 83 testSelectorRoundTrip(":lang(*-ab)"); 91 84 testSelectorRoundTrip(":lang(*-ab-)"); 92 testSelectorRoundTrip(":lang(*-1996)");93 85 testSelectorRoundTrip(":lang(*-DE-1996)"); 94 86 … … 418 410 419 411 shouldBe("parseThenSerializeRule(':lang(\\\\* ) { }')", "':lang(*) { }'"); 420 shouldBe("parseThenSerializeRule(':lang(*- ) { }')", "':lang(*-) { }'");421 412 shouldBe("parseThenSerializeRule(':lang(*-en ) { }')", "':lang(*-en) { }'"); 422 413 shouldBe("parseThenSerializeRule(':lang(*-en-\\\\* ) { }')", "':lang(*-en-*) { }'"); … … 459 450 shouldBe("parseThenSerializeRule(':lang( \\\\* , id-\\\\*-sumatra ) { }')", "':lang(*, id-*-sumatra) { }'"); 460 451 shouldBe("parseThenSerializeRule(':lang( \\\\* , id-\\\\*-sumatra ) { }')", "':lang(*, id-*-sumatra) { }'"); 461 462 debug('');463 464 shouldBe("parseThenSerializeRule(':lang(*-1996) { }')", "':lang(*-1996) { }'");465 shouldBe("parseThenSerializeRule(':lang(*-1996, *-1997) { }')", "':lang(*-1996, *-1997) { }'");466 shouldBe("parseThenSerializeRule(':lang(*-1996, *-1997 ) { }')", "':lang(*-1996, *-1997) { }'");467 shouldBe("parseThenSerializeRule(':lang( *-1996 , *-1997 ) { }')", "':lang(*-1996, *-1997) { }'");468 shouldBe("parseThenSerializeRule(':lang( *-1996 ,*-1997 ) { }')", "':lang(*-1996, *-1997) { }'");469 shouldBe("parseThenSerializeRule(':lang( *-1996,*-1997 ) { }')", "':lang(*-1996, *-1997) { }'");470 452 471 453 debug(''); … … 503 485 shouldThrow("parseThenSerializeRule(':lang(@media screen {}) { }')"); 504 486 505 shouldThrow("parseThenSerializeRule(':lang(*)')"); 506 shouldThrow("parseThenSerializeRule(':lang(**)')"); 507 shouldThrow("parseThenSerializeRule(':lang(-*-)')"); 487 shouldThrow("parseThenSerializeRule(':lang(*-) { }')"); 488 shouldThrow("parseThenSerializeRule(':lang(*- ) { }')"); 489 shouldThrow("parseThenSerializeRule(':lang(*--) { }')"); 490 shouldThrow("parseThenSerializeRule(':lang(*---) { }')"); 491 shouldThrow("parseThenSerializeRule(':lang(*----) { }')"); 492 493 shouldThrow("parseThenSerializeRule(':lang(*)' { })"); 494 shouldThrow("parseThenSerializeRule(':lang(**) { }')"); 495 shouldThrow("parseThenSerializeRule(':lang(-*-) { }')"); 508 496 shouldThrow("parseThenSerializeRule(':lang(*-*) { }')"); 509 497 shouldThrow("parseThenSerializeRule(':lang(de-*)')"); … … 512 500 shouldThrow("parseThenSerializeRule(':lang(*-en-*fr) { }')"); 513 501 shouldThrow("parseThenSerializeRule(':lang(*-*en-fr) { }')"); 514 shouldThrow("parseThenSerializeRule(':lang(*-1997) ')");515 shouldThrow("parseThenSerializeRule(':lang(*-1997-*) ')");502 shouldThrow("parseThenSerializeRule(':lang(*-1997) { }')"); 503 shouldThrow("parseThenSerializeRule(':lang(*-1997-*) { }')"); 516 504 shouldThrow("parseThenSerializeRule(':lang(*a*) { }')"); 517 505 shouldThrow("parseThenSerializeRule(':lang(*a) { }')"); … … 525 513 shouldThrow("parseThenSerializeRule(':lang(*-a, br fr en *) { }')"); 526 514 515 shouldThrow("parseThenSerializeRule(':lang(*-1996, *-1997) { }')"); 516 shouldThrow("parseThenSerializeRule(':lang(*-1996, *-1997 ) { }')"); 517 shouldThrow("parseThenSerializeRule(':lang( *-1996 , *-1997 ) { }')"); 518 shouldThrow("parseThenSerializeRule(':lang( *-1996 ,*-1997 ) { }')"); 519 shouldThrow("parseThenSerializeRule(':lang( *-1996,*-1997 ) { }')"); 520 527 521 debug(''); 528 522 -
trunk/LayoutTests/fast/css/parsing-css-lang-expected.txt
r176902 r176983 125 125 PASS document.getElementById('style-container').sheet.cssRules.length is 1 126 126 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(rm-CH)" 127 PASS document.querySelector(":lang(*-)") did not throw exception.128 PASS document.getElementById('style-container').sheet.cssRules.length is 1129 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*-)"130 PASS document.querySelector(":lang(*- )") did not throw exception.131 PASS document.getElementById('style-container').sheet.cssRules.length is 1132 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*-)"133 PASS document.querySelector(":lang(*--)") did not throw exception.134 PASS document.getElementById('style-container').sheet.cssRules.length is 1135 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*--)"136 PASS document.querySelector(":lang(*-- )") did not throw exception.137 PASS document.getElementById('style-container').sheet.cssRules.length is 1138 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*--)"139 PASS document.querySelector(":lang(*---)") did not throw exception.140 PASS document.getElementById('style-container').sheet.cssRules.length is 1141 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*---)"142 PASS document.querySelector(":lang(*--- )") did not throw exception.143 PASS document.getElementById('style-container').sheet.cssRules.length is 1144 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*---)"145 PASS document.querySelector(":lang(*----)") did not throw exception.146 PASS document.getElementById('style-container').sheet.cssRules.length is 1147 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*----)"148 PASS document.querySelector(":lang(*---- )") did not throw exception.149 PASS document.getElementById('style-container').sheet.cssRules.length is 1150 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*----)"151 127 PASS document.querySelector(":lang(*-CH)") did not throw exception. 152 128 PASS document.getElementById('style-container').sheet.cssRules.length is 1 … … 161 137 PASS document.getElementById('style-container').sheet.cssRules.length is 1 162 138 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*-DE-1996)" 163 PASS document.querySelector(":lang(*-1996)") did not throw exception.164 PASS document.getElementById('style-container').sheet.cssRules.length is 1165 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*-1996)"166 PASS document.querySelector(":lang(*-1996 )") did not throw exception.167 PASS document.getElementById('style-container').sheet.cssRules.length is 1168 PASS document.getElementById('style-container').sheet.cssRules[0].selectorText is ":lang(*-1996)"169 139 PASS document.querySelector(":lang(*-br-zh)") did not throw exception. 170 140 PASS document.getElementById('style-container').sheet.cssRules.length is 1 -
trunk/LayoutTests/fast/css/parsing-css-lang.html
r176902 r176983 47 47 "rm-CH", 48 48 49 "*-",50 "*--",51 "*---",52 "*----",53 54 49 "*-CH", 55 50 "*-DE-1996", 56 "*-1996",57 51 "*-br-zh", 58 52 "id-\\*-sumatra", -
trunk/Source/WebCore/ChangeLog
r176981 r176983 1 2014-12-08 Benjamin Poulain <benjamin@webkit.org> 2 3 Fix the parsing of advanced :lang() after r176902 4 https://bugs.webkit.org/show_bug.cgi?id=139379 5 6 Reviewed by Andreas Kling. 7 8 There were two mistakes that were only caught in debug: 9 10 The lexer was not calling isIdentifierStart() before parseIdentifier(). 11 Some identifier we were parsing should have been invalid. 12 This was caught with an assertion in parseIdentifier(). 13 14 The other issue is that we were accumulating pointer to freed memory. 15 The tokenizer for LANGRANGE was creating a new string with a StringBuilder. 16 The problem is that CSSParserString does not keep the source string alive. 17 Consequently, the list of language range was accumulating pointers to dead 18 StringImpls. 19 20 The fix there is to simply extend the token to take the original asterisk character 21 from the input. That is not elegant but that's efficient and we know 22 the buffer lifetime. 23 24 * css/CSSParser.cpp: 25 (WebCore::CSSParser::realLex): 26 * css/CSSGrammar.y.in: Fix the indentation of a language range rule. 27 1 28 2014-12-08 Anders Carlsson <andersca@apple.com> 2 29 -
trunk/Source/WebCore/css/CSSGrammar.y.in
r176902 r176983 1396 1396 $$ = nullptr; 1397 1397 if ($4) { 1398 auto selector = std::make_unique<CSSParserSelector>();1399 selector->setMatch(CSSSelector::PseudoClass);1400 selector->setArgumentList(*std::unique_ptr<Vector<CSSParserString>>($4));1401 selector->setPseudoClassValue($2);1402 if (selector->pseudoClassType() == CSSSelector::PseudoClassLang)1403 $$ = selector.release();1398 auto selector = std::make_unique<CSSParserSelector>(); 1399 selector->setMatch(CSSSelector::PseudoClass); 1400 selector->setArgumentList(*std::unique_ptr<Vector<CSSParserString>>($4)); 1401 selector->setPseudoClassValue($2); 1402 if (selector->pseudoClassType() == CSSSelector::PseudoClassLang) 1403 $$ = selector.release(); 1404 1404 } 1405 1405 } -
trunk/Source/WebCore/css/CSSParser.cpp
r176907 r176983 11488 11488 m_token = CONTAINS; 11489 11489 #if ENABLE(CSS_SELECTORS_LEVEL4) 11490 } else if (*currentCharacter<SrcCharacterType>() == '-' ) {11490 } else if (*currentCharacter<SrcCharacterType>() == '-' && isIdentifierStart<SrcCharacterType>()) { 11491 11491 result = currentCharacter<SrcCharacterType>(); 11492 11492 … … 11494 11494 parseIdentifier(result, parsedIdentifier, hasEscape); 11495 11495 11496 StringBuilder parsedLangRange; 11497 parsedLangRange.append('*'); 11498 parsedLangRange.append(parsedIdentifier); 11499 11500 m_token = LANGRANGE; 11501 yylval->string.init(parsedLangRange.toString()); 11496 if (parsedIdentifier.length()) { 11497 m_token = LANGRANGE; 11498 yylval->string.init(tokenStart<SrcCharacterType>(), parsedIdentifier.length() + 1); 11499 } 11502 11500 #endif 11503 11501 }
Note: See TracChangeset
for help on using the changeset viewer.