Title: [151488] trunk
Revision
151488
Author
[email protected]
Date
2013-06-12 00:20:20 -0700 (Wed, 12 Jun 2013)

Log Message

Add CSS parsing recovery to functions
https://bugs.webkit.org/show_bug.cgi?id=117500

Reviewed by Andreas Kling.

>From Blink r150205 by <[email protected]>

Source/WebCore:

Add parsing recovery capabilities to functions. Errors were
correctly detected without this change but then the whole
declaration was invalidated. By using expr_recovery to handle them
we can recover from those errors and go on with the parsing.

* css/CSSGrammar.y.in:

LayoutTests:

* fast/css/parsing-error-recovery.html: added some test cases for
parsing recovery inside functions.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151487 => 151488)


--- trunk/LayoutTests/ChangeLog	2013-06-12 06:05:58 UTC (rev 151487)
+++ trunk/LayoutTests/ChangeLog	2013-06-12 07:20:20 UTC (rev 151488)
@@ -1,3 +1,15 @@
+2013-06-12  Sergio Villar Senin  <[email protected]>
+
+        Add CSS parsing recovery to functions
+        https://bugs.webkit.org/show_bug.cgi?id=117500
+
+        Reviewed by Andreas Kling.
+
+        From Blink r150205 by <[email protected]>
+
+        * fast/css/parsing-error-recovery.html: added some test cases for
+        parsing recovery inside functions.
+
 2013-06-11  Gyuyoung Kim  <[email protected]>
 
         Unreviewed, EFL Gardening. Unskip fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html

Modified: trunk/LayoutTests/fast/css/parsing-error-recovery.html (151487 => 151488)


--- trunk/LayoutTests/fast/css/parsing-error-recovery.html	2013-06-12 06:05:58 UTC (rev 151487)
+++ trunk/LayoutTests/fast/css/parsing-error-recovery.html	2013-06-12 07:20:20 UTC (rev 151488)
@@ -60,6 +60,36 @@
             display: block !important {invalid_block}
         }
 
+        #test8 {
+            color: rgb(1,});
+            display: none;
+        }
+
+        #test9 {
+            color: rgb(});
+            display: none;
+        }
+
+        #test10 {
+            width: calc(1,});
+            display: none;
+        }
+
+        #test11 {
+            width: calc(});
+            display: none;
+        }
+
+        #test12 {
+            width: -webkit-min(1,});
+            display: none;
+        }
+
+        #test13 {
+            width: -webkit-min(});
+            display: none;
+        }
+
         /* Successfully parsed */
         #last {
             display:block;
@@ -74,6 +104,12 @@
   <div class="to_be_hidden" id="test5">FAIL: Test 5</div>
   <div class="to_be_hidden" id="test6">FAIL: Test 6</div>
   <div class="to_be_hidden" id="test7">FAIL: Test 7</div>
+  <div class="to_be_hidden" id="test8">FAIL: Test 8</div>
+  <div class="to_be_hidden" id="test9">FAIL: Test 9</div>
+  <div class="to_be_hidden" id="test10">FAIL: Test 10</div>
+  <div class="to_be_hidden" id="test11">FAIL: Test 11</div>
+  <div class="to_be_hidden" id="test12">FAIL: Test 12</div>
+  <div class="to_be_hidden" id="test13">FAIL: Test 13</div>
   <div class="to_be_shown" id="last">PASS</div>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (151487 => 151488)


--- trunk/Source/WebCore/ChangeLog	2013-06-12 06:05:58 UTC (rev 151487)
+++ trunk/Source/WebCore/ChangeLog	2013-06-12 07:20:20 UTC (rev 151488)
@@ -1,3 +1,19 @@
+2013-06-12  Sergio Villar Senin  <[email protected]>
+
+        Add CSS parsing recovery to functions
+        https://bugs.webkit.org/show_bug.cgi?id=117500
+
+        Reviewed by Andreas Kling.
+
+        From Blink r150205 by <[email protected]>
+
+        Add parsing recovery capabilities to functions. Errors were
+        correctly detected without this change but then the whole
+        declaration was invalidated. By using expr_recovery to handle them
+        we can recover from those errors and go on with the parsing.
+
+        * css/CSSGrammar.y.in:
+
 2013-06-11  Christophe Dumez  <[email protected]>
 
         Unreviewed, rolling out r151378.

Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (151487 => 151488)


--- trunk/Source/WebCore/css/CSSGrammar.y.in	2013-06-12 06:05:58 UTC (rev 151487)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in	2013-06-12 07:20:20 UTC (rev 151488)
@@ -88,9 +88,9 @@
 %}
 
 #if ENABLE_SHADOW_DOM
-%expect 33
+%expect 32
 #else
-%expect 32
+%expect 31
 #endif
 
 %nonassoc LOWEST_PREC
@@ -1700,13 +1700,13 @@
 #endif
   }
   /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */
-  | function {
+  | function maybe_space {
       $$ = $1;
   }
-  | calc_function {
+  | calc_function maybe_space {
       $$ = $1;
   }
-  | min_or_max_function {
+  | min_or_max_function maybe_space {
       $$ = $1;
   }
   | '%' maybe_space { /* Handle width: %; */
@@ -1753,7 +1753,7 @@
   ;
 
 function:
-    FUNCTION maybe_space expr closing_parenthesis maybe_space {
+    FUNCTION maybe_space expr closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = parser->sinkFloatingValueList($3);
@@ -1761,7 +1761,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     } |
-    FUNCTION maybe_space closing_parenthesis maybe_space {
+    FUNCTION maybe_space closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         CSSParserValueList* valueList = parser->createFloatingValueList();
@@ -1770,7 +1770,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     } |
-    FUNCTION maybe_space error {
+    FUNCTION maybe_space expr_recovery closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = nullptr;
@@ -1883,7 +1883,7 @@
   ;
 
 calc_function:
-    CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis maybe_space {
+    CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = parser->sinkFloatingValueList($3);
@@ -1891,7 +1891,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     }
-    | CALCFUNCTION maybe_space error {
+    | CALCFUNCTION maybe_space expr_recovery closing_parenthesis {
         YYERROR;
     }
     ;
@@ -1907,7 +1907,7 @@
     ;
 
 min_or_max_function:
-    min_or_max maybe_space calc_func_expr_list closing_parenthesis maybe_space {
+    min_or_max maybe_space calc_func_expr_list closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = parser->sinkFloatingValueList($3);
@@ -1915,7 +1915,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     } 
-    | min_or_max maybe_space error {
+    | min_or_max maybe_space expr_recovery closing_parenthesis {
         YYERROR;
     }
     ;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to