No subject


Mon Jan 28 08:41:14 PST 2013


0201">r150201</a> and <a href=3D"http://trac.webkit.org/projects/webkit/c=
hangeset/150755">r150755</a> by &lt;serya at chromium.org&gt;

Source/WebCore:

Test: fast/css/parsing-expr-error-recovery.html

The CSS parser should properly recover from invalid {}, () and []
blocks skipping them instead of discarding the whole declaration
as invalid. This merge is actually made of two different changes
from Blink, the original one that fixes the bug and another one
which refactors a bit the code making it more legible.

* css/CSSGrammar.y.in:

LayoutTests:

* fast/css/parsing-expr-error-recovery-expected.txt: Added.
* fast/css/parsing-expr-error-recovery.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a=
></li>
<li><a href=3D"#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeL=
og</a></li>
<li><a href=3D"#trunkSourceWebCorecssCSSGrammaryin">trunk/Source/WebCore/=
css/CSSGrammar.y.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsfastcssparsingexprerrorrecoveryexpectedtx=
t">trunk/LayoutTests/fast/css/parsing-expr-error-recovery-expected.txt</a=
></li>
<li><a href=3D"#trunkLayoutTestsfastcssparsingexprerrorrecoveryhtml">trun=
k/LayoutTests/fast/css/parsing-expr-error-recovery.html</a></li>
</ul>

</div>
<div id=3D"patch">
<h3>Diff</h3>
<a id=3D"trunkLayoutTestsChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (151509 =
=3D> 151510)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/ChangeLog	2013-06-12 17:22:57 =
UTC (rev 151509)
+++ trunk/LayoutTests/ChangeLog	2013-06-12 17:23:31 UTC (rev 151510)
</span><span class=3D"lines">@@ -1,5 +1,17 @@
</span><span class=3D"cx"> 2013-06-12  Sergio Villar Senin  &lt;svillar at i=
galia.com&gt;
</span><span class=3D"cx">=20
</span><ins>+        Skipping {}, () and [] blocks while error recovering=
 in CSS
+        https://bugs.webkit.org/show_bug.cgi?id=3D116071
+
+        Reviewed by Darin Adler.
+
+        From Blink r150201 and r150755 by &lt;serya at chromium.org&gt;
+
+        * fast/css/parsing-expr-error-recovery-expected.txt: Added.
+        * fast/css/parsing-expr-error-recovery.html: Added.
+
+2013-06-12  Sergio Villar Senin  &lt;svillar at igalia.com&gt;
+
</ins><span class=3D"cx">         [css exclusions] fast/css/variables/var=
-inside-shape.html is failing
</span><span class=3D"cx">         https://bugs.webkit.org/show_bug.cgi?i=
d=3D116059
</span><span class=3D"cx">=20
</span></span></pre></div>
<a id=3D"trunkLayoutTestsfastcssparsingexprerrorrecoveryexpectedtxt"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/parsing-expr=
-error-recovery-expected.txt (0 =3D> 151510)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/parsing-expr-error-re=
covery-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/parsing-expr-error-recovery-expected.txt	2=
013-06-12 17:23:31 UTC (rev 151510)
</span><span class=3D"lines">@@ -0,0 +1,3 @@
</span><ins>+Tests that CSS parser correctly recovers after {}, () and []=
 invalid blocks.
+All tests passed
+
</ins></span></pre></div>
<a id=3D"trunkLayoutTestsfastcssparsingexprerrorrecoveryhtml"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/parsing-expr=
-error-recovery.html (0 =3D> 151510)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/parsing-expr-error-re=
covery.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/parsing-expr-error-recovery.html	2013-06-1=
2 17:23:31 UTC (rev 151510)
</span><span class=3D"lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;div&gt;Tests that CSS parser correctly recovers after {}, () and [] =
invalid blocks.&lt;/div&gt;
+&lt;div id=3D&quot;result&quot;&gt;&lt;/div&gt;
+&lt;div id=3D&quot;tests&quot;&gt;&lt;/div&gt;
+&lt;script type=3D&quot;text/javascript&quot;&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var BASE_EXPR =3D &quot;1px,\&quot;x\&quot;,var(y) /calc(1px + (((5px)))=
),-webkit-min(1px,2px)&quot;;
+var INVALID_BLOCKS =3D [&quot;#&quot;, &quot;{}&quot;, &quot;()&quot;, &=
quot;[]&quot;, &quot;{(){{}{{}}[]}}&quot;, &quot;(})&quot;, &quot;(])&quo=
t;, &quot;[}]&quot;, &quot;[)]&quot;, &quot;{)}&quot;, &quot;{]}&quot;, &=
quot;#({})&quot;];
+
+var tests =3D document.getElementById(&quot;tests&quot;);
+for (var i =3D 0; i &lt;=3D BASE_EXPR.length; i++) {
+    for (var j =3D 0; j &lt; INVALID_BLOCKS.length; j++) {
+        var invalidExpr =3D BASE_EXPR.substr(0, i) + INVALID_BLOCKS[j] +=
 BASE_EXPR.substr(i);
+        var test =3D document.createElement(&quot;DIV&quot;);
+        test.textContent =3D &quot;failed: &quot; + invalidExpr;
+        test.style.cssText =3D &quot;color:&quot; + invalidExpr + &quot;=
; display: none;&quot;;
+        tests.appendChild(test);
+    }
+}
+
+var failed =3D 0;
+for (var test =3D tests.firstChild; test; test =3D test.nextSibling) {
+   if (getComputedStyle(test).display !=3D &quot;none&quot;)
+       failed++;
+}
+
+document.getElementById(&quot;result&quot;).textContent =3D failed ? &qu=
ot;Failed &quot; + failed + &quot; tests&quot; : &quot;All tests passed&q=
uot;;
+
+&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id=3D"trunkSourceWebCoreChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (1515=
09 =3D> 151510)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/ChangeLog	2013-06-12 17:22:=
57 UTC (rev 151509)
+++ trunk/Source/WebCore/ChangeLog	2013-06-12 17:23:31 UTC (rev 151510)
</span><span class=3D"lines">@@ -1,3 +1,22 @@
</span><ins>+2013-06-12  Sergio Villar Senin  &lt;svillar at igalia.com&gt;
+
+        Skipping {}, () and [] blocks while error recovering in CSS
+        https://bugs.webkit.org/show_bug.cgi?id=3D116071
+
+        Reviewed by Darin Adler.
+
+        From Blink r150201 and r150755 by &lt;serya at chromium.org&gt;
+
+        Test: fast/css/parsing-expr-error-recovery.html
+
+        The CSS parser should properly recover from invalid {}, () and [=
]
+        blocks skipping them instead of discarding the whole declaration
+        as invalid. This merge is actually made of two different changes
+        from Blink, the original one that fixes the bug and another one
+        which refactors a bit the code making it more legible.
+
+        * css/CSSGrammar.y.in:
+
</ins><span class=3D"cx"> 2013-06-12  Alberto Garcia  &lt;agarcia at igalia.=
com&gt;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         [BlackBerry] Remove dead WebDOM code
</span></span></pre></div>
<a id=3D"trunkSourceWebCorecssCSSGrammaryin"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.=
y.in (151509 =3D> 151510)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/css/CSSGrammar.y.in	2013-06=
-12 17:22:57 UTC (rev 151509)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in	2013-06-12 17:23:31 UTC (rev=
 151510)
</span><span class=3D"lines">@@ -321,12 +321,14 @@
</span><span class=3D"cx"> %type &lt;character&gt; operator
</span><span class=3D"cx">=20
</span><span class=3D"cx"> %type &lt;valueList&gt; expr
</span><ins>+%type &lt;valueList&gt; valid_expr
</ins><span class=3D"cx"> %type &lt;value&gt; term
</span><span class=3D"cx"> %type &lt;value&gt; unary_term
</span><span class=3D"cx"> %type &lt;value&gt; function
</span><span class=3D"cx"> %type &lt;value&gt; calc_func_term
</span><span class=3D"cx"> %type &lt;character&gt; calc_func_operator
</span><span class=3D"cx"> %type &lt;valueList&gt; calc_func_expr
</span><ins>+%type &lt;valueList&gt; valid_calc_func_expr
</ins><span class=3D"cx"> %type &lt;valueList&gt; calc_func_expr_list
</span><span class=3D"cx"> %type &lt;valueList&gt; calc_func_paren_expr
</span><span class=3D"cx"> %type &lt;value&gt; calc_function
</span><span class=3D"lines">@@ -1638,11 +1640,16 @@
</span><span class=3D"cx">   ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> expr:
</span><ins>+    valid_expr
+    | valid_expr expr_recovery { $$ =3D 0; }
+  ;
+
+valid_expr:
</ins><span class=3D"cx">     term {
</span><span class=3D"cx">         $$ =3D parser-&gt;createFloatingValueL=
ist();
</span><span class=3D"cx">         $$-&gt;addValue(parser-&gt;sinkFloatin=
gValue($1));
</span><span class=3D"cx">     }
</span><del>-    | expr operator term {
</del><ins>+    | valid_expr operator term {
</ins><span class=3D"cx">         $$ =3D $1;
</span><span class=3D"cx">         if ($$) {
</span><span class=3D"cx">             if ($2) {
</span><span class=3D"lines">@@ -1655,9 +1662,6 @@
</span><span class=3D"cx">             $$-&gt;addValue(parser-&gt;sinkFlo=
atingValue($3));
</span><span class=3D"cx">         }
</span><span class=3D"cx">     }
</span><del>-    | expr expr_recovery {
-        $$ =3D 0;
-    }
</del><span class=3D"cx">   ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> expr_recovery:
</span><span class=3D"lines">@@ -1829,6 +1833,11 @@
</span><span class=3D"cx">   ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> calc_func_expr:
</span><ins>+    valid_calc_func_expr
+    | valid_calc_func_expr expr_recovery { $$ =3D 0; }
+  ;
+
+valid_calc_func_expr:
</ins><span class=3D"cx">     calc_func_term {
</span><span class=3D"cx">         $$ =3D parser-&gt;createFloatingValueL=
ist();
</span><span class=3D"cx">         $$-&gt;addValue(parser-&gt;sinkFloatin=
gValue($1));
</span><span class=3D"lines">@@ -1859,9 +1868,6 @@
</span><span class=3D"cx">             $$ =3D 0;
</span><span class=3D"cx">     }
</span><span class=3D"cx">     | calc_func_paren_expr
</span><del>-    | calc_func_expr error {
-        $$ =3D 0;
-    }
</del><span class=3D"cx">   ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> calc_func_expr_list:
</span><span class=3D"lines">@@ -1959,19 +1965,26 @@
</span><span class=3D"cx">     ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> invalid_block:
</span><del>-    '{' error invalid_block_list error closing_brace {
</del><ins>+    '{' error_recovery closing_brace {
</ins><span class=3D"cx">         parser-&gt;invalidBlockHit();
</span><span class=3D"cx">     }
</span><del>-  | '{' error closing_brace {
-        parser-&gt;invalidBlockHit();
-    }
</del><span class=3D"cx">     ;
</span><span class=3D"cx">=20
</span><del>-invalid_block_list:
-    invalid_block
-  | invalid_block_list error invalid_block
-;
</del><ins>+invalid_square_brackets_block:
+    '[' error_recovery ']'
+  | '[' error_recovery TOKEN_EOF
+    ;
</ins><span class=3D"cx">=20
</span><ins>+invalid_parentheses_block:
+    opening_parenthesis error_recovery closing_parenthesis;
+
+opening_parenthesis:
+    '(' | FUNCTION | CALCFUNCTION | VARFUNCTION | MINFUNCTION | MAXFUNCT=
ION | ANYFUNCTION | NOTFUNCTION
+#if ENABLE_VIDEO_TRACK
+    | CUEFUNCTION
+#endif
+    ;
+
</ins><span class=3D"cx"> error_location: {
</span><span class=3D"cx">         $$ =3D parser-&gt;currentLocation();
</span><span class=3D"cx">     }
</span><span class=3D"lines">@@ -1979,8 +1992,10 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> error_recovery:
</span><span class=3D"cx">     /* empty */
</span><ins>+  | error_recovery error
</ins><span class=3D"cx">   | error_recovery invalid_block
</span><del>-  | error_recovery error
</del><ins>+  | error_recovery invalid_square_brackets_block
+  | error_recovery invalid_parentheses_block
</ins><span class=3D"cx">     ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> %%
</span></span></pre>
</div>
</div>

</body>
</html>


More information about the webkit-changes mailing list