Title: [151395] trunk/Source/WebCore
Revision
151395
Author
ser...@webkit.org
Date
2013-06-10 08:26:02 -0700 (Mon, 10 Jun 2013)

Log Message

Refactor CALCFUNCTION rules in the CSS grammar
https://bugs.webkit.org/show_bug.cgi?id=117401

Reviewed by Andreas Kling.

>From Blink r149862 by <se...@chromium.org>.

Reduce the number of CALCFUNCTION rules by refactoring the closing
parenthesis handling code.

No new tests required as this is a refactoring, no new functionality
added.

* css/CSSGrammar.y.in:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151394 => 151395)


--- trunk/Source/WebCore/ChangeLog	2013-06-10 14:19:13 UTC (rev 151394)
+++ trunk/Source/WebCore/ChangeLog	2013-06-10 15:26:02 UTC (rev 151395)
@@ -1,3 +1,20 @@
+2013-06-10  Sergio Villar Senin  <svil...@igalia.com>
+
+        Refactor CALCFUNCTION rules in the CSS grammar
+        https://bugs.webkit.org/show_bug.cgi?id=117401
+
+        Reviewed by Andreas Kling.
+
+        From Blink r149862 by <se...@chromium.org>.
+
+        Reduce the number of CALCFUNCTION rules by refactoring the closing
+        parenthesis handling code.
+
+        No new tests required as this is a refactoring, no new functionality
+        added.
+
+        * css/CSSGrammar.y.in:
+
 2013-06-10  Radu Stavila  <stav...@adobe.com>
 
         [CSS Regions] Rename region-overflow to region-fragment

Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (151394 => 151395)


--- trunk/Source/WebCore/css/CSSGrammar.y.in	2013-06-10 14:19:13 UTC (rev 151394)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in	2013-06-10 15:26:02 UTC (rev 151395)
@@ -1799,22 +1799,21 @@
     | WHITESPACE '-' WHITESPACE {
         $$ = '-';
     }
-    | WHITESPACE '*' maybe_space {
+    | calc_maybe_space '*' maybe_space {
         $$ = '*';
     }
-    | WHITESPACE '/' maybe_space {
+    | calc_maybe_space '/' maybe_space {
         $$ = '/';
     }
-    | '*' maybe_space {
-        $$ = '*';
-    }
-    | '/' maybe_space {
-        $$ = '/';
-    }
   ;
 
+calc_maybe_space:
+    /* empty */
+    | WHITESPACE
+  ;
+
 calc_func_paren_expr:
-    '(' maybe_space calc_func_expr calc_closing_paren {
+    '(' maybe_space calc_func_expr calc_maybe_space ')' {
         if ($3) {
             $$ = $3;
             CSSParserValue v;
@@ -1827,11 +1826,8 @@
         } else
             $$ = 0;
     }
+  ;
 
-calc_closing_paren:
-    WHITESPACE ')'
-    | ')'
-
 calc_func_expr:
     calc_func_term {
         $$ = parser->createFloatingValueList();
@@ -1869,13 +1865,10 @@
   ;
 
 calc_func_expr_list:
-    calc_func_expr WHITESPACE {
+    calc_func_expr calc_maybe_space {
         $$ = $1;
-    }    
-    | calc_func_expr {
-        $$ = $1;
     }
-    | calc_func_expr_list ',' maybe_space calc_func_expr WHITESPACE {
+    | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space {
         if ($1 && $4) {
             $$ = $1;
             CSSParserValue v;
@@ -1887,22 +1880,10 @@
         } else
             $$ = 0;
     }
-    | calc_func_expr_list ',' maybe_space calc_func_expr {
-        if ($1 && $4) {
-            $$ = $1;
-            CSSParserValue v;
-            v.id = 0;
-            v.unit = CSSParserValue::Operator;
-            v.iValue = ',';
-            $$->addValue(v);
-            $$->extend(*($4));
-        } else
-            $$ = 0;
-    }
-    
+  ;
 
 calc_function:
-    CALCFUNCTION maybe_space calc_func_expr calc_closing_paren maybe_space {
+    CALCFUNCTION maybe_space calc_func_expr calc_maybe_space ')' maybe_space {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = parser->sinkFloatingValueList($3);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to