Changeset 151510 in webkit


Ignore:
Timestamp:
Jun 12, 2013 10:23:31 AM (11 years ago)
Author:
sergio@webkit.org
Message:

Skipping {}, () and [] blocks while error recovering in CSS
https://bugs.webkit.org/show_bug.cgi?id=116071

Reviewed by Darin Adler.

From Blink r150201 and r150755 by <serya@chromium.org>

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.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r151506 r151510  
     12013-06-12  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Skipping {}, () and [] blocks while error recovering in CSS
     4        https://bugs.webkit.org/show_bug.cgi?id=116071
     5
     6        Reviewed by Darin Adler.
     7
     8        From Blink r150201 and r150755 by <serya@chromium.org>
     9
     10        * fast/css/parsing-expr-error-recovery-expected.txt: Added.
     11        * fast/css/parsing-expr-error-recovery.html: Added.
     12
    1132013-06-12  Sergio Villar Senin  <svillar@igalia.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r151507 r151510  
     12013-06-12  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Skipping {}, () and [] blocks while error recovering in CSS
     4        https://bugs.webkit.org/show_bug.cgi?id=116071
     5
     6        Reviewed by Darin Adler.
     7
     8        From Blink r150201 and r150755 by <serya@chromium.org>
     9
     10        Test: fast/css/parsing-expr-error-recovery.html
     11
     12        The CSS parser should properly recover from invalid {}, () and []
     13        blocks skipping them instead of discarding the whole declaration
     14        as invalid. This merge is actually made of two different changes
     15        from Blink, the original one that fixes the bug and another one
     16        which refactors a bit the code making it more legible.
     17
     18        * css/CSSGrammar.y.in:
     19
    1202013-06-12  Alberto Garcia  <agarcia@igalia.com>
    221
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r151488 r151510  
    322322
    323323%type <valueList> expr
     324%type <valueList> valid_expr
    324325%type <value> term
    325326%type <value> unary_term
     
    328329%type <character> calc_func_operator
    329330%type <valueList> calc_func_expr
     331%type <valueList> valid_calc_func_expr
    330332%type <valueList> calc_func_expr_list
    331333%type <valueList> calc_func_paren_expr
     
    16391641
    16401642expr:
     1643    valid_expr
     1644    | valid_expr expr_recovery { $$ = 0; }
     1645  ;
     1646
     1647valid_expr:
    16411648    term {
    16421649        $$ = parser->createFloatingValueList();
    16431650        $$->addValue(parser->sinkFloatingValue($1));
    16441651    }
    1645     | expr operator term {
     1652    | valid_expr operator term {
    16461653        $$ = $1;
    16471654        if ($$) {
     
    16551662            $$->addValue(parser->sinkFloatingValue($3));
    16561663        }
    1657     }
    1658     | expr expr_recovery {
    1659         $$ = 0;
    16601664    }
    16611665  ;
     
    18301834
    18311835calc_func_expr:
     1836    valid_calc_func_expr
     1837    | valid_calc_func_expr expr_recovery { $$ = 0; }
     1838  ;
     1839
     1840valid_calc_func_expr:
    18321841    calc_func_term {
    18331842        $$ = parser->createFloatingValueList();
     
    18601869    }
    18611870    | calc_func_paren_expr
    1862     | calc_func_expr error {
    1863         $$ = 0;
    1864     }
    18651871  ;
    18661872
     
    19601966
    19611967invalid_block:
    1962     '{' error invalid_block_list error closing_brace {
     1968    '{' error_recovery closing_brace {
    19631969        parser->invalidBlockHit();
    19641970    }
    1965   | '{' error closing_brace {
    1966         parser->invalidBlockHit();
    1967     }
    1968     ;
    1969 
    1970 invalid_block_list:
    1971     invalid_block
    1972   | invalid_block_list error invalid_block
    1973 ;
     1971    ;
     1972
     1973invalid_square_brackets_block:
     1974    '[' error_recovery ']'
     1975  | '[' error_recovery TOKEN_EOF
     1976    ;
     1977
     1978invalid_parentheses_block:
     1979    opening_parenthesis error_recovery closing_parenthesis;
     1980
     1981opening_parenthesis:
     1982    '(' | FUNCTION | CALCFUNCTION | VARFUNCTION | MINFUNCTION | MAXFUNCTION | ANYFUNCTION | NOTFUNCTION
     1983#if ENABLE_VIDEO_TRACK
     1984    | CUEFUNCTION
     1985#endif
     1986    ;
    19741987
    19751988error_location: {
     
    19801993error_recovery:
    19811994    /* empty */
     1995  | error_recovery error
    19821996  | error_recovery invalid_block
    1983   | error_recovery error
     1997  | error_recovery invalid_square_brackets_block
     1998  | error_recovery invalid_parentheses_block
    19841999    ;
    19852000
Note: See TracChangeset for help on using the changeset viewer.