Title: [146588] trunk
Revision
146588
Author
[email protected]
Date
2013-03-22 04:26:57 -0700 (Fri, 22 Mar 2013)

Log Message

Web Inspector: Report more CSS errors
https://bugs.webkit.org/show_bug.cgi?id=113022

Patch by Sergey Ryazanov <[email protected]> on 2013-03-22
Reviewed by Pavel Feldman.

Source/WebCore:

Reporting next few CSS syntax errors in declaration_list.

* css/CSSGrammar.y.in:

LayoutTests:

* inspector/console/console-css-warnings-expected.txt:
* inspector/console/console-css-warnings.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (146587 => 146588)


--- trunk/LayoutTests/ChangeLog	2013-03-22 11:00:50 UTC (rev 146587)
+++ trunk/LayoutTests/ChangeLog	2013-03-22 11:26:57 UTC (rev 146588)
@@ -1,3 +1,13 @@
+2013-03-22  Sergey Ryazanov  <[email protected]>
+
+        Web Inspector: Report more CSS errors
+        https://bugs.webkit.org/show_bug.cgi?id=113022
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/console/console-css-warnings-expected.txt:
+        * inspector/console/console-css-warnings.html:
+
 2013-03-22  Kunihiko Sakamoto  <[email protected]>
 
         INPUT_MULTIPLE_FIELDS_UI: Incomplete datetime format should fallback to default

Modified: trunk/LayoutTests/inspector/console/console-css-warnings-expected.txt (146587 => 146588)


--- trunk/LayoutTests/inspector/console/console-css-warnings-expected.txt	2013-03-22 11:00:50 UTC (rev 146587)
+++ trunk/LayoutTests/inspector/console/console-css-warnings-expected.txt	2013-03-22 11:26:57 UTC (rev 146588)
@@ -1,5 +1,13 @@
 Tests CSS warnings are properly exposed.
 
 Unexpected CSS token: # console-css-warnings.html:10
-Unexpected CSS token: * console-css-warnings.html:14
+Unexpected CSS token: { console-css-warnings.html:15
+Unexpected CSS token: # console-css-warnings.html:18
+Unexpected CSS token: # console-css-warnings.html:22
+Unexpected CSS token: # console-css-warnings.html:32
+Unexpected CSS token: { console-css-warnings.html:37
+Unexpected CSS token: { console-css-warnings.html:38
+Unexpected CSS token: { console-css-warnings.html:39
+Unexpected CSS token: { console-css-warnings.html:40
+Unexpected CSS token: * console-css-warnings.html:44
 

Modified: trunk/LayoutTests/inspector/console/console-css-warnings.html (146587 => 146588)


--- trunk/LayoutTests/inspector/console/console-css-warnings.html	2013-03-22 11:00:50 UTC (rev 146587)
+++ trunk/LayoutTests/inspector/console/console-css-warnings.html	2013-03-22 11:26:57 UTC (rev 146588)
@@ -11,6 +11,36 @@
 }
 
 x {
+    color: red;
+    {}}
+
+x {
+    ### {}}
+
+x {
+   color: red;
+   #########
+}
+
+x {
+   color: red {};
+   color: #;
+}
+
+x {
+   color: red;
+   ###;
+   color: #;
+}
+
+x {
+    color{};
+    color{#};
+    color{###};
+    color{{{}}};
+}
+
+x {
     color: *;  /* Test simple error to ensure parsing recovered. */
 }
 

Modified: trunk/Source/WebCore/ChangeLog (146587 => 146588)


--- trunk/Source/WebCore/ChangeLog	2013-03-22 11:00:50 UTC (rev 146587)
+++ trunk/Source/WebCore/ChangeLog	2013-03-22 11:26:57 UTC (rev 146588)
@@ -1,3 +1,14 @@
+2013-03-22  Sergey Ryazanov  <[email protected]>
+
+        Web Inspector: Report more CSS errors
+        https://bugs.webkit.org/show_bug.cgi?id=113022
+
+        Reviewed by Pavel Feldman.
+
+        Reporting next few CSS syntax errors in declaration_list.
+
+        * css/CSSGrammar.y.in:
+
 2013-03-18  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: use individual samples to construct CPU profile flame chart

Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (146587 => 146588)


--- trunk/Source/WebCore/css/CSSGrammar.y.in	2013-03-22 11:00:50 UTC (rev 146587)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in	2013-03-22 11:26:57 UTC (rev 146588)
@@ -338,6 +338,7 @@
 %type <string> attr_name
 
 %type <location> errors
+%type <location> error_location
 
 %%
 
@@ -1557,10 +1558,12 @@
         parser->syntaxError($1);
         $$ = false;
     }
-    | decl_list error {
+    | decl_list errors {
+        parser->syntaxError($2);
         $$ = $1;
     }
-    | decl_list invalid_block_list {
+    | decl_list error_location invalid_block_list {
+        parser->syntaxError($2);
         $$ = $1;
     }
     ;
@@ -1570,10 +1573,12 @@
         parser->markPropertyStart();
         $$ = $1;
     }
-    | declaration invalid_block_list maybe_space {
+    | declaration error_location invalid_block_list maybe_space {
+        parser->syntaxError($2);
         $$ = false;
     }
-    | declaration invalid_block_list ';' maybe_space {
+    | declaration error_location invalid_block_list ';' maybe_space {
+        parser->syntaxError($2);
         $$ = false;
     }
     | errors ';' maybe_space {
@@ -1591,11 +1596,13 @@
         if ($2)
             $$ = $2;
     }
-    | decl_list error ';' maybe_space {
+    | decl_list errors ';' maybe_space {
+        parser->syntaxError($2);
         parser->markPropertyStart();
         $$ = $1;
     }
-    | decl_list error invalid_block_list error ';' maybe_space {
+    | decl_list errors invalid_block_list error ';' maybe_space {
+        parser->syntaxError($2);
         parser->markPropertyStart();
         $$ = $1;
     }
@@ -1628,14 +1635,16 @@
         parser->markPropertyEnd($5, isPropertyParsed);
     }
     |
-    property error {
+    property errors {
+        parser->syntaxError($2);
         $$ = false;
     }
     |
-    property ':' maybe_space error expr prio {
+    property ':' maybe_space errors expr prio {
         /* The default movable type template has letter-spacing: .none;  Handle this by looking for
         error tokens at the start of an expr, recover the expr and then treat as an error, cleaning
         up and deleting the shifted expr.  */
+        parser->syntaxError($4);
         parser->markPropertyEnd(false, false);
         $$ = false;
     }
@@ -1646,25 +1655,29 @@
         $$ = false;
     }
     |
-    IMPORTANT_SYM maybe_space {
+    IMPORTANT_SYM maybe_space error_location {
         /* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */
+        parser->syntaxError($3);
         $$ = false;
     }
     |
-    property ':' maybe_space {
+    property ':' maybe_space error_location {
         /* div { font-family: } Just reduce away this property with no value. */
+        parser->syntaxError($4);
         parser->markPropertyEnd(false, false);
         $$ = false;
     }
     |
-    property ':' maybe_space error {
+    property ':' maybe_space errors {
         /* if we come across rules with invalid values like this case: p { weight: *; }, just discard the rule */
+        parser->syntaxError($4);
         parser->markPropertyEnd(false, false);
         $$ = false;
     }
     |
-    property invalid_block {
+    property error_location invalid_block {
         /* if we come across: div { color{;color:maroon} }, ignore everything within curly brackets */
+        parser->syntaxError($2);
         $$ = false;
     }
   ;
@@ -2028,5 +2041,10 @@
     }
     ;
 
+error_location: {
+        $$ = parser->currentLocation();
+    }
+    ;
+
 %%
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to