Changeset 142640 in webkit


Ignore:
Timestamp:
Feb 12, 2013 10:40:48 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Handle error recovery in @supports
https://bugs.webkit.org/show_bug.cgi?id=103934

Patch by Pablo Flouret <pablof@motorola.com> on 2013-02-12
Reviewed by Antti Koivisto.

Source/WebCore:

Tests 021, 024, 031, and 033 in
http://hg.csswg.org/test/file/5f94e4b03ed9/contributors/opera/submitted/css3-conditional
fail because there's no explicit error recovery in @support's grammar.
Opera and Firefox pass the tests.

No new tests, modified css3/supports{,-cssom}.html

  • css/CSSGrammar.y.in:
  • css/CSSParser.cpp:

(WebCore::CSSParser::createSupportsRule):
(WebCore::CSSParser::markSupportsRuleHeaderEnd):
(WebCore::CSSParser::popSupportsRuleData):

  • css/CSSParser.h:

LayoutTests:

  • css3/supports-cssom.html:
  • css3/supports-expected.txt:
  • css3/supports.html:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142638 r142640  
     12013-02-12  Pablo Flouret  <pablof@motorola.com>
     2
     3        Handle error recovery in @supports
     4        https://bugs.webkit.org/show_bug.cgi?id=103934
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * css3/supports-cssom.html:
     9        * css3/supports-expected.txt:
     10        * css3/supports.html:
     11
    1122013-02-12  Emil A Eklund  <eae@chromium.org>
    213
  • trunk/LayoutTests/css3/supports-cssom.html

    r139866 r142640  
    1717    @supports  ((  (     padding: 0)    and (display: none)) or (display: rainbow))  {
    1818        dfn { width:0; }
     19
    1920        @supports (width: 0) {
    2021            br { height:0; }
    2122        }
     23
     24        /* Rules with syntax errors should be ignored. */
     25        @supports (display: none);
     26        @supports (display: none)) ;
     27        @supports;
     28        @supports ;
     29        @supports (display: none)) {}
     30        @supports (display: )) {}
     31        @supports ((display: none) and {}
     32        @supports (display: none) {}
     33        );
     34        @supports ((display: none) and ;
     35        @supports (display: none) {}
     36        );
     37
    2238        ol { display:none; }
    2339    }
  • trunk/LayoutTests/css3/supports-expected.txt

    r139866 r142640  
    4141PASS getComputedStyle(document.getElementById('t35')).content is "APPLIED"
    4242PASS getComputedStyle(document.getElementById('t36')).content is "UNTOUCHED"
     43PASS getComputedStyle(document.getElementById('t37')).content is "APPLIED"
     44PASS getComputedStyle(document.getElementById('t38')).content is "APPLIED"
     45PASS getComputedStyle(document.getElementById('t39')).content is "APPLIED"
     46PASS getComputedStyle(document.getElementById('t40')).content is "APPLIED"
     47PASS getComputedStyle(document.getElementById('t41')).content is "APPLIED"
     48PASS getComputedStyle(document.getElementById('t42')).content is "APPLIED"
     49PASS getComputedStyle(document.getElementById('t43')).content is "UNTOUCHED"
     50PASS getComputedStyle(document.getElementById('t44')).content is "UNTOUCHED"
    4351PASS successfullyParsed is true
    4452
  • trunk/LayoutTests/css3/supports.html

    r139866 r142640  
    173173        }
    174174    }
     175
     176    /* Invalid syntax error recovery */
     177
     178    @supports (display: none);
     179    @supports (display: none) and ( (display: none) ) {
     180        #t37 { content: "APPLIED" }
     181    }
     182
     183    @supports (display: none)) ;
     184    @supports (display: none) {
     185        #t38 { content: "APPLIED" }
     186    }
     187
     188    @supports;
     189    @supports (display: none) {
     190        #t39 { content: "APPLIED" }
     191    }
     192
     193    @supports ;
     194    @supports (display: none) {
     195        #t40 { content: "APPLIED" }
     196    }
     197
     198    @supports (display: none)) {
     199        #t41 { content: "FAIL" }
     200    }
     201    @supports (display: none) {
     202        #t41 { content: "APPLIED" }
     203    }
     204
     205    @supports (display: )) {
     206        #t42 { content: "FAIL" }
     207    }
     208    @supports (display: none) {
     209        #t42 { content: "APPLIED" }
     210    }
     211
     212    @supports ((display: none) and {
     213        #t43 { content: "FAIL" }
     214    }
     215    @supports (display: none) {
     216        #t43 { content: "FAIL" }
     217    }
     218    );
     219
     220    @supports ((display: none) and ;
     221    @supports (display: none) {
     222        #t44 { content: "FAIL" }
     223    }
     224    );
     225
    175226</style>
    176227</head>
     
    180231<script>
    181232    description("Test the @supports rule.");
    182     var numTests = 37;
    183     var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 28, 29, 34, 36]; // Tests whose content shouldn't change from the UNTOUCHED default.
     233    var numTests = 45;
     234    var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 28, 29, 34, 36, 43, 44]; // Tests whose content shouldn't change from the UNTOUCHED default.
    184235
    185236    var container = document.getElementById("test_container");
  • trunk/Source/WebCore/ChangeLog

    r142639 r142640  
     12013-02-12  Pablo Flouret  <pablof@motorola.com>
     2
     3        Handle error recovery in @supports
     4        https://bugs.webkit.org/show_bug.cgi?id=103934
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Tests 021, 024, 031, and 033 in
     9        http://hg.csswg.org/test/file/5f94e4b03ed9/contributors/opera/submitted/css3-conditional
     10        fail because there's no explicit error recovery in @support's grammar.
     11        Opera and Firefox pass the tests.
     12
     13        No new tests, modified css3/supports{,-cssom}.html
     14
     15        * css/CSSGrammar.y.in:
     16        * css/CSSParser.cpp:
     17        (WebCore::CSSParser::createSupportsRule):
     18        (WebCore::CSSParser::markSupportsRuleHeaderEnd):
     19        (WebCore::CSSParser::popSupportsRuleData):
     20        * css/CSSParser.h:
     21
    1222013-02-12  Eric Carlson  <eric.carlson@apple.com>
    223
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r142021 r142640  
    250250%type <boolean> supports_disjunction
    251251%type <boolean> supports_declaration_condition
     252%type <boolean> supports_error
    252253#endif
    253254
     
    693694        $$ = parser->createSupportsRule($4, $9);
    694695    }
    695     ;
     696    | before_supports_rule SUPPORTS_SYM supports_error {
     697        parser->popRuleData();
     698        parser->popSupportsRuleData();
     699    }
     700    ;
     701
     702supports_error:
     703    error ';'
     704    | error invalid_block
    696705
    697706before_supports_rule:
     
    745754    }
    746755    | supports_declaration_condition
     756    | '(' error ')'
    747757    ;
    748758
  • trunk/Source/WebCore/css/CSSParser.cpp

    r142168 r142640  
    1086210862    m_allowImportRules = m_allowNamespaceDeclarations = false;
    1086310863
    10864     ASSERT(!m_supportsRuleDataStack->isEmpty());
    10865     RefPtr<CSSRuleSourceData> data = m_supportsRuleDataStack->last();
    10866     m_supportsRuleDataStack->removeLast();
    10867     if (m_supportsRuleDataStack->isEmpty())
    10868         m_supportsRuleDataStack.clear();
    10869 
     10864    RefPtr<CSSRuleSourceData> data = popSupportsRuleData();
    1087010865    RefPtr<StyleRuleSupports> rule;
    1087110866    String conditionText;
     
    1090410899void CSSParser::markSupportsRuleHeaderEnd()
    1090510900{
    10906     ASSERT(!m_supportsRuleDataStack->isEmpty());
     10901    ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty());
    1090710902
    1090810903    if (is8BitSource())
     
    1091110906        m_supportsRuleDataStack->last()->ruleHeaderRange.end = tokenStart<UChar>() - m_dataStart16.get();
    1091210907}
     10908
     10909PassRefPtr<CSSRuleSourceData> CSSParser::popSupportsRuleData()
     10910{
     10911    ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty());
     10912    RefPtr<CSSRuleSourceData> data = m_supportsRuleDataStack->last();
     10913    m_supportsRuleDataStack->removeLast();
     10914    return data.release();
     10915}
     10916
    1091310917#endif
    1091410918
  • trunk/Source/WebCore/css/CSSParser.h

    r141480 r142640  
    301301    void markSupportsRuleHeaderStart();
    302302    void markSupportsRuleHeaderEnd();
     303    PassRefPtr<CSSRuleSourceData> popSupportsRuleData();
    303304#endif
    304305#if ENABLE(SHADOW_DOM)
Note: See TracChangeset for help on using the changeset viewer.