Title: [151424] trunk
- Revision
- 151424
- Author
- [email protected]
- Date
- 2013-06-11 00:10:00 -0700 (Tue, 11 Jun 2013)
Log Message
Autoclose braces and parentheses at the end of style sheet
https://bugs.webkit.org/show_bug.cgi?id=117414
Reviewed by Andreas Kling.
>From Blink r150202 by <[email protected]>
Source/WebCore:
Use closing_parenthesis and closing_brace instead of the literals
'}' and ')'. This allows the parser to treat expressions with
unmatched closing braces/parenthesis as if all of them were
actually closed.
Tests: animations/keyframe-autoclose-brace.html
css3/autoclose-braces-and-parentheses.html
* css/CSSGrammar.y.in:
LayoutTests:
* animations/keyframe-autoclose-brace-expected.txt: Added.
* animations/keyframe-autoclose-brace.html: Added.
* css3/autoclose-braces-and-parentheses-expected.txt: Added.
* css3/autoclose-braces-and-parentheses.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (151423 => 151424)
--- trunk/LayoutTests/ChangeLog 2013-06-11 05:47:40 UTC (rev 151423)
+++ trunk/LayoutTests/ChangeLog 2013-06-11 07:10:00 UTC (rev 151424)
@@ -1,3 +1,17 @@
+2013-06-11 Sergio Villar Senin <[email protected]>
+
+ Autoclose braces and parentheses at the end of style sheet
+ https://bugs.webkit.org/show_bug.cgi?id=117414
+
+ Reviewed by Andreas Kling.
+
+ From Blink r150202 by <[email protected]>
+
+ * animations/keyframe-autoclose-brace-expected.txt: Added.
+ * animations/keyframe-autoclose-brace.html: Added.
+ * css3/autoclose-braces-and-parentheses-expected.txt: Added.
+ * css3/autoclose-braces-and-parentheses.html: Added.
+
2013-06-10 Ryosuke Niwa <[email protected]>
Use shouldBeType in animations/keyframes-rule.html
Added: trunk/LayoutTests/animations/keyframe-autoclose-brace-expected.txt (0 => 151424)
--- trunk/LayoutTests/animations/keyframe-autoclose-brace-expected.txt (rev 0)
+++ trunk/LayoutTests/animations/keyframe-autoclose-brace-expected.txt 2013-06-11 07:10:00 UTC (rev 151424)
@@ -0,0 +1,2 @@
+Tests parsing the @-webkit-keyframes rule without closing brace. "User agents must close all open constructs ... at the end of the style sheet." (http://www.w3.org/TR/CSS21/syndata.html#parsing-errors). So it must be parsed as if all braces are closed.
+Test passed
Added: trunk/LayoutTests/animations/keyframe-autoclose-brace.html (0 => 151424)
--- trunk/LayoutTests/animations/keyframe-autoclose-brace.html (rev 0)
+++ trunk/LayoutTests/animations/keyframe-autoclose-brace.html 2013-06-11 07:10:00 UTC (rev 151424)
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Tests CSS parser autocloses braces.</title>
+ <style type="text/css" media="screen">
+ @-webkit-keyframes "foo" {
+ from { left: 100px; }
+ 40% { left: 200px; }
+ 60% { left: 200px; }
+ to { left: 300px;
+ </style>
+ <script type="text/_javascript_" charset="utf-8">
+ function findKeyframesRule(rule)
+ {
+ var ss = document.styleSheets;
+ for (var i = 0; i < ss.length; ++i) {
+ for (var j = 0; j < ss[i].cssRules.length; ++j) {
+ if (ss[i].cssRules[j].type == window.CSSRule.WEBKIT_KEYFRAMES_RULE && ss[i].cssRules[j].name == rule)
+ return ss[i].cssRules[j];
+ }
+ }
+
+ return null;
+ }
+
+ function test()
+ {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var keyframes = findKeyframesRule("foo");
+ document.getElementById("console").textContent = keyframes && keyframes.cssRules.length == 4 ? "Test passed" : "Test failed";
+ }
+
+ </script>
+</head>
+<body _onload_="test()">
+<div>Tests parsing the @-webkit-keyframes rule without closing brace. "User agents must close all open constructs ... at the end of the style sheet."
+(<a href="" So it must be parsed as if
+all braces are closed.</div>
+<div id="console"></div>
+</body>
+</html>
Added: trunk/LayoutTests/css3/autoclose-braces-and-parentheses-expected.txt (0 => 151424)
--- trunk/LayoutTests/css3/autoclose-braces-and-parentheses-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/autoclose-braces-and-parentheses-expected.txt 2013-06-11 07:10:00 UTC (rev 151424)
@@ -0,0 +1,3 @@
+Tests parsing style declarations without closing braces and parentheses. "User agents must close all open constructs ... at the end of the style sheet." (http://www.w3.org/TR/CSS21/syndata.html#parsing-errors). So it must be parsed as if all braces and parentheses are closed.
+All tests passed
+
Added: trunk/LayoutTests/css3/autoclose-braces-and-parentheses.html (0 => 151424)
--- trunk/LayoutTests/css3/autoclose-braces-and-parentheses.html (rev 0)
+++ trunk/LayoutTests/css3/autoclose-braces-and-parentheses.html 2013-06-11 07:10:00 UTC (rev 151424)
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<style>
+.test1 {
+ width: 1px;
+ width: calc(100px
+</style>
+<style>
+.test2 {
+ width: 1px;
+ width: calc((((((100px
+</style>
+<style>
+@media all {
+.test3 {
+ width: 1px;
+ width: calc(100px
+</style>
+<body>
+<div>Tests parsing style declarations without closing braces and parentheses. "User agents must close all open constructs ... at the end of the style sheet."
+(<a href="" So it must be parsed as if
+all braces and parentheses are closed.</div>
+<div id="console"></div>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+var NUMBER_OF_TESTS = 3;
+var failed = false;
+var consoleElement = document.getElementById("console");
+for (var i = 1; i <= NUMBER_OF_TESTS; i++) {
+ var div = document.createElement("DIV");
+ div.className = "test" + i;
+ document.body.appendChild(div);
+ var width = window.getComputedStyle(div).getPropertyValue("width");
+ document.body.removeChild;
+
+ if (width != "100px") {
+ consoleElement.textContent += "Test " + i + " failed\n";
+ failed = true;
+ }
+}
+if (!failed) {
+ consoleElement.textContent += "All tests passed\n";
+}
+</script>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (151423 => 151424)
--- trunk/Source/WebCore/ChangeLog 2013-06-11 05:47:40 UTC (rev 151423)
+++ trunk/Source/WebCore/ChangeLog 2013-06-11 07:10:00 UTC (rev 151424)
@@ -1,3 +1,22 @@
+2013-06-11 Sergio Villar Senin <[email protected]>
+
+ Autoclose braces and parentheses at the end of style sheet
+ https://bugs.webkit.org/show_bug.cgi?id=117414
+
+ Reviewed by Andreas Kling.
+
+ From Blink r150202 by <[email protected]>
+
+ Use closing_parenthesis and closing_brace instead of the literals
+ '}' and ')'. This allows the parser to treat expressions with
+ unmatched closing braces/parenthesis as if all of them were
+ actually closed.
+
+ Tests: animations/keyframe-autoclose-brace.html
+ css3/autoclose-braces-and-parentheses.html
+
+ * css/CSSGrammar.y.in:
+
2013-06-10 Jae Hyun Park <[email protected]>
[CoordinatedGraphics] Typos in custom shader support
Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (151423 => 151424)
--- trunk/Source/WebCore/css/CSSGrammar.y.in 2013-06-11 05:47:40 UTC (rev 151423)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in 2013-06-11 07:10:00 UTC (rev 151424)
@@ -854,7 +854,7 @@
;
keyframe_rule:
- key_list maybe_space '{' maybe_space declaration_list '}' {
+ key_list maybe_space '{' maybe_space declaration_list closing_brace {
$$ = parser->createKeyframe($1);
}
;
@@ -1692,7 +1692,7 @@
| UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; }
| HEX maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; }
| '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */
- | VARFUNCTION maybe_space IDENT ')' maybe_space {
+ | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space {
#if ENABLE_CSS_VARIABLES
$$.id = 0;
$$.string = $3;
@@ -1782,7 +1782,7 @@
calc_func_term:
unary_term { $$ = $1; }
- | VARFUNCTION maybe_space IDENT ')' {
+ | VARFUNCTION maybe_space IDENT closing_parenthesis {
#if ENABLE_CSS_VARIABLES
$$.id = 0;
$$.string = $3;
@@ -1813,7 +1813,7 @@
;
calc_func_paren_expr:
- '(' maybe_space calc_func_expr calc_maybe_space ')' {
+ '(' maybe_space calc_func_expr calc_maybe_space closing_parenthesis {
if ($3) {
$$ = $3;
CSSParserValue v;
@@ -1883,7 +1883,7 @@
;
calc_function:
- CALCFUNCTION maybe_space calc_func_expr calc_maybe_space ')' maybe_space {
+ CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis maybe_space {
CSSParserFunction* f = parser->createFloatingFunction();
f->name = $1;
f->args = parser->sinkFloatingValueList($3);
@@ -1907,7 +1907,7 @@
;
min_or_max_function:
- min_or_max maybe_space calc_func_expr_list ')' maybe_space {
+ min_or_max maybe_space calc_func_expr_list closing_parenthesis maybe_space {
CSSParserFunction* f = parser->createFloatingFunction();
f->name = $1;
f->args = parser->sinkFloatingValueList($3);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes