Changeset 150791 in webkit


Ignore:
Timestamp:
May 28, 2013 12:21:02 AM (11 years ago)
Author:
sergio@webkit.org
Message:

Web Inspector: Enable CSS logging
https://bugs.webkit.org/show_bug.cgi?id=113401

Reviewed by Benjamin Poulain.

From Blink r149265 by <serya@chromium.org>

Source/WebCore:

CSS logging was disabled in r147028 to prevent message overflow in
the inspector console. This change restores it by modifying the
CSS grammar in order to reduce as much consecutive errors as
possible in 'declaration_list' and 'decl_list' rules.

This way, for rules like 'x { color: ### }' only the first '#'
will be reported as error (instead of 3 identical errors).

The rule 'declaration' still produces multiple errors, because it
does not eat as much errors as possible. So in order not to create
a complex risky patch we just disable logging in the parser for
that rule.

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

(WebCore::CSSParser::CSSParser):
(WebCore::CSSParser::parseSheet):
(WebCore::CSSParser::syntaxError):
(WebCore::CSSParser::isLoggingErrors):
(WebCore::CSSParser::rewriteSpecifiers):

  • css/CSSParser.h:

(CSSParser):

LayoutTests:

Unskipped console-css-warnings.html now that it's working.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r150776 r150791  
     12013-05-28  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Web Inspector: Enable CSS logging
     4        https://bugs.webkit.org/show_bug.cgi?id=113401
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        From Blink r149265 by <serya@chromium.org>
     9
     10        Unskipped console-css-warnings.html now that it's working.
     11
     12        * TestExpectations:
     13
    1142013-05-27  Claudio Saavedra  <csaavedra@igalia.com>
    215
  • trunk/LayoutTests/TestExpectations

    r150579 r150791  
    99webkit.org/b/109570 media/track/regions-webvtt [ Skip ]
    1010
    11 # pending CSS grammar refactoring
    12 webkit.org/b/113401 inspector/console/console-css-warnings.html [ Skip ]
    13 
    1411# media/video-seek-after-end.html is flaky
    1512webkit.org/b/116293 media/video-seek-after-end.html [ Pass Failure ]
  • trunk/Source/WebCore/ChangeLog

    r150789 r150791  
     12013-05-28  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Web Inspector: Enable CSS logging
     4        https://bugs.webkit.org/show_bug.cgi?id=113401
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        From Blink r149265 by <serya@chromium.org>
     9
     10        CSS logging was disabled in r147028 to prevent message overflow in
     11        the inspector console. This change restores it by modifying the
     12        CSS grammar in order to reduce as much consecutive errors as
     13        possible in 'declaration_list' and 'decl_list' rules.
     14
     15        This way, for rules like 'x { color: ### }' only the first '#'
     16        will be reported as error (instead of 3 identical errors).
     17
     18        The rule 'declaration' still produces multiple errors, because it
     19        does not eat as much errors as possible. So in order not to create
     20        a complex risky patch we just disable logging in the parser for
     21        that rule.
     22
     23        * css/CSSGrammar.y.in:
     24        * css/CSSParser.cpp:
     25        (WebCore::CSSParser::CSSParser):
     26        (WebCore::CSSParser::parseSheet):
     27        (WebCore::CSSParser::syntaxError):
     28        (WebCore::CSSParser::isLoggingErrors):
     29        (WebCore::CSSParser::rewriteSpecifiers):
     30        * css/CSSParser.h:
     31        (CSSParser):
     32
    1332013-05-27  Patrick Gansterer  <paroga@webkit.org>
    234
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r150682 r150791  
    15331533        $$ = $1;
    15341534    }
    1535     | errors decl_list_recovery {
    1536         parser->syntaxError($1, CSSParser::PropertyDeclarationError);
     1535    | decl_list_recovery {
    15371536        $$ = false;
    15381537    }
    1539     | decl_list errors decl_list_recovery {
    1540         parser->syntaxError($2, CSSParser::PropertyDeclarationError);
     1538    | decl_list decl_list_recovery {
    15411539        $$ = $1;
    15421540    }
     
    15561554        $$ = false;
    15571555    }
    1558     | errors decl_list_recovery ';' maybe_space {
    1559         parser->syntaxError($1, CSSParser::PropertyDeclarationError);
     1556    | decl_list_recovery ';' maybe_space {
    15601557        parser->markPropertyStart();
    15611558        $$ = false;
     
    15671564            $$ = $2;
    15681565    }
    1569     | decl_list errors decl_list_recovery ';' maybe_space {
     1566    | decl_list decl_list_recovery ';' maybe_space {
     1567        parser->markPropertyStart();
     1568        $$ = $1;
     1569    }
     1570    ;
     1571
     1572decl_list_recovery:
     1573    error error_location {
    15701574        parser->syntaxError($2, CSSParser::PropertyDeclarationError);
    1571         parser->markPropertyStart();
    1572         $$ = $1;
    1573     }
    1574     ;
    1575 
    1576 decl_list_recovery:
    1577     invalid_block_list error
    1578     | /* empty */
     1575    }
     1576    | decl_list_recovery invalid_block
     1577    | decl_list_recovery error
    15791578    ;
    15801579
  • trunk/Source/WebCore/css/CSSParser.cpp

    r150776 r150791  
    325325    , m_hadSyntacticallyValidCSSRule(false)
    326326    , m_logErrors(false)
     327    , m_ignoreErrorsInDeclaration(false)
    327328#if ENABLE(CSS_SHADERS)
    328329    , m_inFilterRule(false)
     
    461462
    462463    m_logErrors = logErrors && sheet->singleOwnerDocument() && !sheet->baseURL().isEmpty() && sheet->singleOwnerDocument()->page();
     464    m_ignoreErrorsInDeclaration = false;
    463465    m_lineNumber = startLineNumber;
    464466    setupParser("", string, "");
     
    468470    m_ruleSourceDataResult = 0;
    469471    m_rule = 0;
     472    m_ignoreErrorsInDeclaration = false;
    470473    m_logErrors = false;
    471474}
     
    1149911502
    1150011503    logError(builder.toString(), location.lineNumber);
     11504
     11505    m_ignoreErrorsInDeclaration = true;
    1150111506}
    1150211507
    1150311508bool CSSParser::isLoggingErrors()
    1150411509{
    11505     // FIXME: return logging back (https://bugs.webkit.org/show_bug.cgi?id=113401).
    11506     return false;
     11510    return m_logErrors && !m_ignoreErrorsInDeclaration;
    1150711511}
    1150811512
     
    1195011954void CSSParser::markPropertyStart()
    1195111955{
     11956    m_ignoreErrorsInDeclaration = false;
    1195211957    if (!isExtractingSourceData())
    1195311958        return;
  • trunk/Source/WebCore/css/CSSParser.h

    r150734 r150791  
    398398    bool m_hadSyntacticallyValidCSSRule;
    399399    bool m_logErrors;
     400    bool m_ignoreErrorsInDeclaration;
    400401
    401402#if ENABLE(CSS_SHADERS)
Note: See TracChangeset for help on using the changeset viewer.