Skip to content
Permalink
Browse files
Add CSS parsing recovery to functions
https://bugs.webkit.org/show_bug.cgi?id=117500

Reviewed by Andreas Kling.

From Blink r150205 by <serya@chromium.org>

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.

Canonical link: https://commits.webkit.org/135697@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Sergio Villar Senin committed Jun 12, 2013
1 parent e0d21e9 commit eb16f5c068530146ea454bb95399bc36c86b18f1
Showing 4 changed files with 76 additions and 12 deletions.
@@ -1,3 +1,15 @@
2013-06-12 Sergio Villar Senin <svillar@igalia.com>

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

Reviewed by Andreas Kling.

From Blink r150205 by <serya@chromium.org>

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

2013-06-11 Gyuyoung Kim <gyuyoung.kim@samsung.com>

Unreviewed, EFL Gardening. Unskip fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html
@@ -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>
@@ -1,3 +1,19 @@
2013-06-12 Sergio Villar Senin <svillar@igalia.com>

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

Reviewed by Andreas Kling.

From Blink r150205 by <serya@chromium.org>

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 <ch.dumez@sisa.samsung.com>

Unreviewed, rolling out r151378.
@@ -88,9 +88,9 @@ static inline bool isCSSTokenAString(int yytype)
%}

#if ENABLE_SHADOW_DOM
%expect 33
#else
%expect 32
#else
%expect 31
#endif

%nonassoc LOWEST_PREC
@@ -1700,13 +1700,13 @@ term:
#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,15 +1753,15 @@ unary_term:
;

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);
$$.id = 0;
$$.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 @@ function:
$$.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,15 +1883,15 @@ calc_func_expr_list:
;

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);
$$.id = 0;
$$.unit = CSSParserValue::Function;
$$.function = f;
}
| CALCFUNCTION maybe_space error {
| CALCFUNCTION maybe_space expr_recovery closing_parenthesis {
YYERROR;
}
;
@@ -1907,15 +1907,15 @@ min_or_max:
;

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);
$$.id = 0;
$$.unit = CSSParserValue::Function;
$$.function = f;
}
| min_or_max maybe_space error {
| min_or_max maybe_space expr_recovery closing_parenthesis {
YYERROR;
}
;

0 comments on commit eb16f5c

Please sign in to comment.