No subject


Mon Jan 28 08:41:14 PST 2013


9446">r149446</a> by &lt;serya at chromium.org&gt;

Source/WebCore:

Added a new rule &quot;declaration_recovery:&quot; which covers any kind =
of
&quot;invalid_block_list maybe_space&quot; sequence. By appending this ne=
w
rule to every rule reductable to &quot;declaration:&quot; we can remove s=
ome
redundant rules and improve error recovery of some others that
were only accepting exactly one error.

One of the rules being removed was preventing invalid blocks in a
declaration to invalidate the whole declaration. The rule was
reporting the syntax error but at the same time accepting the
invalid block as part of a valid declaration.

* css/CSSGrammar.y.in:

LayoutTests:

* fast/css/parsing-error-recovery.html: Added 2 new test cases.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a=
></li>
<li><a href=3D"#trunkLayoutTestsfastcssparsingerrorrecoveryhtml">trunk/La=
youtTests/fast/css/parsing-error-recovery.html</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>

</div>
<div id=3D"patch">
<h3>Diff</h3>
<a id=3D"trunkLayoutTestsChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (150802 =
=3D> 150803)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/ChangeLog	2013-05-28 14:08:55 =
UTC (rev 150802)
+++ trunk/LayoutTests/ChangeLog	2013-05-28 14:31:11 UTC (rev 150803)
</span><span class=3D"lines">@@ -1,3 +1,14 @@
</span><ins>+2013-05-28  Sergio Villar Senin  &lt;svillar at igalia.com&gt;
+
+        Invalid block doesn't make declaration invalid
+        https://bugs.webkit.org/show_bug.cgi?id=3D115709
+
+        Reviewed by Andreas Kling.
+
+        From Blink r149446 by &lt;serya at chromium.org&gt;
+
+        * fast/css/parsing-error-recovery.html: Added 2 new test cases.
+
</ins><span class=3D"cx"> 2013-05-28  =C3=81d=C3=A1m Kallai  &lt;kadam at in=
f.u-szeged.hu&gt;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         [Qt] Unreviewed gardening. Unskip now =
passing tests.
</span></span></pre></div>
<a id=3D"trunkLayoutTestsfastcssparsingerrorrecoveryhtml"></a>
<div class=3D"modfile"><h4>Modified: trunk/LayoutTests/fast/css/parsing-e=
rror-recovery.html (150802 =3D> 150803)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/parsing-error-recover=
y.html	2013-05-28 14:08:55 UTC (rev 150802)
+++ trunk/LayoutTests/fast/css/parsing-error-recovery.html	2013-05-28 14:=
31:11 UTC (rev 150803)
</span><span class=3D"lines">@@ -48,6 +48,18 @@
</span><span class=3D"cx">             display:none;
</span><span class=3D"cx">         }
</span><span class=3D"cx">=20
</span><ins>+        #test6 {
+            display: none !important;
+            display: block !important {invalid_block};
+        }
+
+        #test7 {
+            display: none !important;
+        }
+        #test7 {
+            display: block !important {invalid_block}
+        }
+
</ins><span class=3D"cx">         /* Successfully parsed */
</span><span class=3D"cx">         #last {
</span><span class=3D"cx">             display:block;
</span><span class=3D"lines">@@ -60,6 +72,8 @@
</span><span class=3D"cx">   &lt;div class=3D&quot;to_be_hidden&quot; id=3D=
&quot;test3&quot;&gt;FAIL: Test 3&lt;/div&gt;
</span><span class=3D"cx">   &lt;div class=3D&quot;to_be_hidden&quot; id=3D=
&quot;test4&quot;&gt;FAIL: Test 4&lt;/div&gt;
</span><span class=3D"cx">   &lt;div class=3D&quot;to_be_hidden&quot; id=3D=
&quot;test5&quot;&gt;FAIL: Test 5&lt;/div&gt;
</span><ins>+  &lt;div class=3D&quot;to_be_hidden&quot; id=3D&quot;test6&=
quot;&gt;FAIL: Test 6&lt;/div&gt;
+  &lt;div class=3D&quot;to_be_hidden&quot; id=3D&quot;test7&quot;&gt;FAI=
L: Test 7&lt;/div&gt;
</ins><span class=3D"cx">   &lt;div class=3D&quot;to_be_shown&quot; id=3D=
&quot;last&quot;&gt;PASS&lt;/div&gt;
</span><span class=3D"cx"> &lt;/body&gt;
</span><span class=3D"cx"> &lt;/html&gt;
</span></span></pre></div>
<a id=3D"trunkSourceWebCoreChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (1508=
02 =3D> 150803)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/ChangeLog	2013-05-28 14:08:=
55 UTC (rev 150802)
+++ trunk/Source/WebCore/ChangeLog	2013-05-28 14:31:11 UTC (rev 150803)
</span><span class=3D"lines">@@ -1,3 +1,25 @@
</span><ins>+2013-05-28  Sergio Villar Senin  &lt;svillar at igalia.com&gt;
+
+        Invalid block doesn't make declaration invalid
+        https://bugs.webkit.org/show_bug.cgi?id=3D115709
+
+        Reviewed by Andreas Kling.
+
+        From Blink r149446 by &lt;serya at chromium.org&gt;
+
+        Added a new rule &quot;declaration_recovery:&quot; which covers =
any kind of
+        &quot;invalid_block_list maybe_space&quot; sequence. By appendin=
g this new
+        rule to every rule reductable to &quot;declaration:&quot; we can=
 remove some
+        redundant rules and improve error recovery of some others that
+        were only accepting exactly one error.
+
+        One of the rules being removed was preventing invalid blocks in =
a
+        declaration to invalidate the whole declaration. The rule was
+        reporting the syntax error but at the same time accepting the
+        invalid block as part of a valid declaration.
+
+        * css/CSSGrammar.y.in:
+
</ins><span class=3D"cx"> 2013-05-28  Andreas Kling  &lt;akling at apple.com=
&gt;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         Move dispatching of focus-related even=
ts from Node to Element.
</span></span></pre></div>
<a id=3D"trunkSourceWebCorecssCSSGrammaryin"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.=
y.in (150802 =3D> 150803)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/css/CSSGrammar.y.in	2013-05=
-28 14:08:55 UTC (rev 150802)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in	2013-05-28 14:31:11 UTC (rev=
 150803)
</span><span class=3D"lines">@@ -88,9 +88,9 @@
</span><span class=3D"cx"> %}
</span><span class=3D"cx">=20
</span><span class=3D"cx"> #if ENABLE_SHADOW_DOM
</span><del>-%expect 68
</del><ins>+%expect 65
</ins><span class=3D"cx"> #else
</span><del>-%expect 67
</del><ins>+%expect 64
</ins><span class=3D"cx"> #endif
</span><span class=3D"cx">=20
</span><span class=3D"cx"> %nonassoc LOWEST_PREC
</span><span class=3D"lines">@@ -336,7 +336,6 @@
</span><span class=3D"cx"> %type &lt;string&gt; element_name
</span><span class=3D"cx"> %type &lt;string&gt; attr_name
</span><span class=3D"cx">=20
</span><del>-%type &lt;location&gt; errors
</del><span class=3D"cx"> %type &lt;location&gt; error_location
</span><span class=3D"cx">=20
</span><span class=3D"cx"> %%
</span><span class=3D"lines">@@ -1545,14 +1544,6 @@
</span><span class=3D"cx">         parser-&gt;markPropertyStart();
</span><span class=3D"cx">         $$ =3D $1;
</span><span class=3D"cx">     }
</span><del>-    | declaration error_location invalid_block_list maybe_sp=
ace {
-        parser-&gt;syntaxError($2);
-        $$ =3D false;
-    }
-    | declaration error_location invalid_block_list ';' maybe_space {
-        parser-&gt;syntaxError($2);
-        $$ =3D false;
-    }
</del><span class=3D"cx">     | decl_list_recovery ';' maybe_space {
</span><span class=3D"cx">         parser-&gt;markPropertyStart();
</span><span class=3D"cx">         $$ =3D false;
</span><span class=3D"lines">@@ -1604,51 +1595,34 @@
</span><span class=3D"cx">         parser-&gt;markPropertyEnd($5, isPrope=
rtyParsed);
</span><span class=3D"cx">     }
</span><span class=3D"cx">     |
</span><del>-    property errors {
-        parser-&gt;syntaxError($2);
</del><ins>+    property declaration_recovery {
</ins><span class=3D"cx">         $$ =3D false;
</span><span class=3D"cx">     }
</span><span class=3D"cx">     |
</span><del>-    property ':' maybe_space errors expr prio {
-        /* The default movable type template has letter-spacing: .none; =
 Handle this by looking for
-        error tokens at the start of an expr, recover the expr and then =
treat as an error, cleaning
-        up and deleting the shifted expr.  */
-        parser-&gt;syntaxError($4);
-        parser-&gt;markPropertyEnd(false, false);
-        $$ =3D false;
-    }
-    |
-    property ':' maybe_space expr prio error {
</del><ins>+    property ':' maybe_space expr prio declaration_recovery {
</ins><span class=3D"cx">         /* When we encounter something like p {=
color: red !important fail;} we should drop the declaration */
</span><span class=3D"cx">         parser-&gt;markPropertyEnd(false, fals=
e);
</span><span class=3D"cx">         $$ =3D false;
</span><span class=3D"cx">     }
</span><span class=3D"cx">     |
</span><del>-    IMPORTANT_SYM maybe_space error_location {
</del><ins>+    IMPORTANT_SYM maybe_space declaration_recovery {
</ins><span class=3D"cx">         /* Handle this case: div { text-align: =
center; !important } Just reduce away the stray !important. */
</span><del>-        parser-&gt;syntaxError($3);
</del><span class=3D"cx">         $$ =3D false;
</span><span class=3D"cx">     }
</span><span class=3D"cx">     |
</span><del>-    property ':' maybe_space error_location {
-        /* div { font-family: } Just reduce away this property with no v=
alue. */
-        parser-&gt;syntaxError($4);
-        parser-&gt;markPropertyEnd(false, false);
-        $$ =3D false;
-    }
-    |
-    property ':' maybe_space errors {
</del><ins>+    property ':' maybe_space declaration_recovery {
</ins><span class=3D"cx">         /* if we come across rules with invalid=
 values like this case: p { weight: *; }, just discard the rule */
</span><del>-        parser-&gt;syntaxError($4);
</del><span class=3D"cx">         parser-&gt;markPropertyEnd(false, false=
);
</span><span class=3D"cx">         $$ =3D false;
</span><span class=3D"cx">     }
</span><del>-    |
-    property error_location invalid_block {
-        /* if we come across: div { color{;color:maroon} }, ignore every=
thing within curly brackets */
</del><ins>+  ;
+
+declaration_recovery:
+    error error_location {
</ins><span class=3D"cx">         parser-&gt;syntaxError($2);
</span><del>-        $$ =3D false;
</del><span class=3D"cx">     }
</span><ins>+    | declaration_recovery invalid_block
+    | declaration_recovery error
</ins><span class=3D"cx">   ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> property:
</span><span class=3D"lines">@@ -2001,12 +1975,6 @@
</span><span class=3D"cx">   | invalid_block_list error invalid_block
</span><span class=3D"cx"> ;
</span><span class=3D"cx">=20
</span><del>-errors:
-    error error_location {
-        $$ =3D $2;
-    }
-    ;
-
</del><span class=3D"cx"> error_location: {
</span><span class=3D"cx">         $$ =3D parser-&gt;currentLocation();
</span><span class=3D"cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>


More information about the webkit-changes mailing list