Changeset 157720 in webkit


Ignore:
Timestamp:
Oct 21, 2013 9:53:23 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Regions] Fix WHITESPACE issues in the CSS grammar.
https://bugs.webkit.org/show_bug.cgi?id=123082

Patch by Mihai Maerean <Mihai Maerean> on 2013-10-21
Reviewed by Andreas Kling.

This is a port of Rune Lillesveen's patch from https://codereview.chromium.org/25607005

Source/WebCore:

Fix WHITESPACE issues in the CSS grammar.

A single WHITESPACE token consumes consecutive spaces, but does not consume
spaces separated by comments. That means S* and S+ in CSS grammars need to
accept multiple WHITESPACE tokens. Additionally, white spaces are not
mandatory to separate an @-symbol and the rest of the prelude.

Use space non-terminal instead of WHITESPACE for S+ in calc expressions.

Use maybe_space non-terminal instead of WHITESPACE for S* after @-webkit-filter
and @-webkit-region.

Tests: fast/css/calc-comments-allowed.html

fast/regions/webkit-region-syntax-space.html

  • css/CSSGrammar.y.in:

LayoutTests:

  • css3/filters/custom-with-at-rule-syntax/parsing-at-rule-valid-expected.txt:
  • css3/filters/custom-with-at-rule-syntax/script-tests/parsing-at-rule-valid.js:
  • fast/css/calc-comments-allowed-expected.html: Added.
  • fast/css/calc-comments-allowed.html: Added.
  • fast/regions/webkit-region-syntax-space-expected.txt: Added.
  • fast/regions/webkit-region-syntax-space.html: Added.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r157710 r157720  
     12013-10-21  Mihai Maerean  <mmaerean@adobe.com>
     2
     3        [CSS Regions] Fix WHITESPACE issues in the CSS grammar.
     4        https://bugs.webkit.org/show_bug.cgi?id=123082
     5
     6        Reviewed by Andreas Kling.
     7
     8        This is a port of Rune Lillesveen's patch from https://codereview.chromium.org/25607005
     9
     10        * css3/filters/custom-with-at-rule-syntax/parsing-at-rule-valid-expected.txt:
     11        * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-at-rule-valid.js:
     12        * fast/css/calc-comments-allowed-expected.html: Added.
     13        * fast/css/calc-comments-allowed.html: Added.
     14        * fast/regions/webkit-region-syntax-space-expected.txt: Added.
     15        * fast/regions/webkit-region-syntax-space.html: Added.
     16
    1172013-10-21  Santosh Mahto  <santosh.ma@samsung.com>
    218
  • trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-at-rule-valid-expected.txt

    r142149 r157720  
    4747PASS declaration.length is 2
    4848
     49Empty rule, comment separators
     50@-webkit-filter/**/my-filter/**/{ }
     51PASS cssRule.cssText is "@-webkit-filter my-filter { }"
     52PASS cssRule.type is CSSRule.WEBKIT_FILTER_RULE
     53PASS cssRule instanceof WebKitCSSFilterRule is true
     54PASS cssRule.constructor === WebKitCSSFilterRule is true
     55PASS cssRule.__proto__ === WebKitCSSFilterRule.prototype is true
     56PASS declaration.length is 0
     57
     58Empty rule, comment+space separators
     59@-webkit-filter/**/ my-filter/**/ { }
     60PASS cssRule.cssText is "@-webkit-filter my-filter { }"
     61PASS cssRule.type is CSSRule.WEBKIT_FILTER_RULE
     62PASS cssRule instanceof WebKitCSSFilterRule is true
     63PASS cssRule.constructor === WebKitCSSFilterRule is true
     64PASS cssRule.__proto__ === WebKitCSSFilterRule.prototype is true
     65PASS declaration.length is 0
     66
     67Empty rule, space+comment separators
     68@-webkit-filter /**/my-filter /**/{ }
     69PASS cssRule.cssText is "@-webkit-filter my-filter { }"
     70PASS cssRule.type is CSSRule.WEBKIT_FILTER_RULE
     71PASS cssRule instanceof WebKitCSSFilterRule is true
     72PASS cssRule.constructor === WebKitCSSFilterRule is true
     73PASS cssRule.__proto__ === WebKitCSSFilterRule.prototype is true
     74PASS declaration.length is 0
     75
     76Empty rule, space+comment+space separators
     77@-webkit-filter /**/ my-filter /**/ { }
     78PASS cssRule.cssText is "@-webkit-filter my-filter { }"
     79PASS cssRule.type is CSSRule.WEBKIT_FILTER_RULE
     80PASS cssRule instanceof WebKitCSSFilterRule is true
     81PASS cssRule.constructor === WebKitCSSFilterRule is true
     82PASS cssRule.__proto__ === WebKitCSSFilterRule.prototype is true
     83PASS declaration.length is 0
     84
    4985========================================
    5086Nested filter at-rule tests.
  • trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-at-rule-valid.js

    r142149 r157720  
    7171    "@-webkit-filter my-filter { width: 100px; height: 100px; }",
    7272    {width: "100px", height: "100px"});
     73testFilterAtRule("Empty rule, comment separators",
     74    "@-webkit-filter/**/my-filter/**/{ }",
     75    "@-webkit-filter my-filter { }");
     76testFilterAtRule("Empty rule, comment+space separators",
     77    "@-webkit-filter/**/ my-filter/**/ { }",
     78    "@-webkit-filter my-filter { }");
     79testFilterAtRule("Empty rule, space+comment separators",
     80    "@-webkit-filter /**/my-filter /**/{ }",
     81    "@-webkit-filter my-filter { }");
     82testFilterAtRule("Empty rule, space+comment+space separators",
     83    "@-webkit-filter /**/ my-filter /**/ { }",
     84    "@-webkit-filter my-filter { }");
    7385
    7486heading("Nested filter at-rule tests.");
  • trunk/Source/WebCore/ChangeLog

    r157718 r157720  
     12013-10-21  Mihai Maerean  <mmaerean@adobe.com>
     2
     3        [CSS Regions] Fix WHITESPACE issues in the CSS grammar.
     4        https://bugs.webkit.org/show_bug.cgi?id=123082
     5
     6        Reviewed by Andreas Kling.
     7
     8        This is a port of Rune Lillesveen's patch from https://codereview.chromium.org/25607005
     9
     10        Fix WHITESPACE issues in the CSS grammar.
     11
     12        A single WHITESPACE token consumes consecutive spaces, but does not consume
     13        spaces separated by comments. That means S* and S+ in CSS grammars need to
     14        accept multiple WHITESPACE tokens. Additionally, white spaces are not
     15        mandatory to separate an @-symbol and the rest of the prelude.
     16
     17        Use space non-terminal instead of WHITESPACE for S+ in calc expressions.
     18
     19        Use maybe_space non-terminal instead of WHITESPACE for S* after @-webkit-filter
     20        and @-webkit-region.
     21
     22        Tests: fast/css/calc-comments-allowed.html
     23               fast/regions/webkit-region-syntax-space.html
     24
     25        * css/CSSGrammar.y.in:
     26
    1272013-10-21  Anton Obzhirov  <a.obzhirov@samsung.com>
    228
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r157702 r157720  
    370370#endif
    371371
     372/* for expressions that require at least one whitespace to be present, like the + and - operators in calc expressions */
     373space: WHITESPACE | space WHITESPACE ;
     374
    372375maybe_space: /* empty */ %prec UNIMPORTANT_TOK | maybe_space WHITESPACE ;
    373376
     
    955958
    956959region:
    957     before_region_rule WEBKIT_REGION_RULE_SYM WHITESPACE selector_list at_rule_header_end '{' at_rule_body_start maybe_space block_valid_rule_list save_block {
     960    before_region_rule WEBKIT_REGION_RULE_SYM maybe_space selector_list at_rule_header_end '{' at_rule_body_start maybe_space block_valid_rule_list save_block {
    958961        OwnPtr<Vector<RefPtr<StyleRuleBase>>> ruleList = adoptPtr($9);
    959962        if ($4)
     
    976979
    977980filter:
    978     before_filter_rule WEBKIT_FILTER_RULE_SYM WHITESPACE IDENT at_rule_header_end_maybe_space '{' at_rule_body_start maybe_space_before_declaration declaration_list closing_brace {
     981    before_filter_rule WEBKIT_FILTER_RULE_SYM maybe_space IDENT at_rule_header_end_maybe_space '{' at_rule_body_start maybe_space_before_declaration declaration_list closing_brace {
    979982        parser->m_inFilterRule = false;
    980983        $$ = parser->createFilterRule($4).leakRef();
     
    15841587  ;
    15851588
     1589/*
     1590 * The grammar requires spaces around binary ‘+’ and ‘-’ operators.
     1591 * The '*' and '/' operators do not require spaces.
     1592 * http://www.w3.org/TR/css3-values/#calc-syntax
     1593 */
    15861594calc_func_operator:
    1587     WHITESPACE '+' WHITESPACE {
     1595    space '+' space {
    15881596        $$ = '+';
    15891597    }
    1590     | WHITESPACE '-' WHITESPACE {
     1598    | space '-' space {
    15911599        $$ = '-';
    15921600    }
Note: See TracChangeset for help on using the changeset viewer.