Changeset 151395 in webkit


Ignore:
Timestamp:
Jun 10, 2013 8:26:02 AM (11 years ago)
Author:
sergio@webkit.org
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 <serya@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:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151394 r151395  
     12013-06-10  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Refactor CALCFUNCTION rules in the CSS grammar
     4        https://bugs.webkit.org/show_bug.cgi?id=117401
     5
     6        Reviewed by Andreas Kling.
     7
     8        From Blink r149862 by <serya@chromium.org>.
     9
     10        Reduce the number of CALCFUNCTION rules by refactoring the closing
     11        parenthesis handling code.
     12
     13        No new tests required as this is a refactoring, no new functionality
     14        added.
     15
     16        * css/CSSGrammar.y.in:
     17
    1182013-06-10  Radu Stavila  <stavila@adobe.com>
    219
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r150972 r151395  
    18001800        $$ = '-';
    18011801    }
    1802     | WHITESPACE '*' maybe_space {
     1802    | calc_maybe_space '*' maybe_space {
    18031803        $$ = '*';
    18041804    }
    1805     | WHITESPACE '/' maybe_space {
     1805    | calc_maybe_space '/' maybe_space {
    18061806        $$ = '/';
    18071807    }
    1808     | '*' maybe_space {
    1809         $$ = '*';
    1810     }
    1811     | '/' maybe_space {
    1812         $$ = '/';
    1813     }
     1808  ;
     1809
     1810calc_maybe_space:
     1811    /* empty */
     1812    | WHITESPACE
    18141813  ;
    18151814
    18161815calc_func_paren_expr:
    1817     '(' maybe_space calc_func_expr calc_closing_paren {
     1816    '(' maybe_space calc_func_expr calc_maybe_space ')' {
    18181817        if ($3) {
    18191818            $$ = $3;
     
    18281827            $$ = 0;
    18291828    }
    1830 
    1831 calc_closing_paren:
    1832     WHITESPACE ')'
    1833     | ')'
     1829  ;
    18341830
    18351831calc_func_expr:
     
    18701866
    18711867calc_func_expr_list:
    1872     calc_func_expr WHITESPACE {
    1873         $$ = $1;
    1874     }   
    1875     | calc_func_expr {
    1876         $$ = $1;
    1877     }
    1878     | calc_func_expr_list ',' maybe_space calc_func_expr WHITESPACE {
     1868    calc_func_expr calc_maybe_space {
     1869        $$ = $1;
     1870    }
     1871    | calc_func_expr_list ',' maybe_space calc_func_expr calc_maybe_space {
    18791872        if ($1 && $4) {
    18801873            $$ = $1;
     
    18881881            $$ = 0;
    18891882    }
    1890     | calc_func_expr_list ',' maybe_space calc_func_expr {
    1891         if ($1 && $4) {
    1892             $$ = $1;
    1893             CSSParserValue v;
    1894             v.id = 0;
    1895             v.unit = CSSParserValue::Operator;
    1896             v.iValue = ',';
    1897             $$->addValue(v);
    1898             $$->extend(*($4));
    1899         } else
    1900             $$ = 0;
    1901     }
    1902    
     1883  ;
    19031884
    19041885calc_function:
    1905     CALCFUNCTION maybe_space calc_func_expr calc_closing_paren maybe_space {
     1886    CALCFUNCTION maybe_space calc_func_expr calc_maybe_space ')' maybe_space {
    19061887        CSSParserFunction* f = parser->createFloatingFunction();
    19071888        f->name = $1;
Note: See TracChangeset for help on using the changeset viewer.