Title: [196593] trunk
Revision
196593
Author
[email protected]
Date
2016-02-15 13:16:40 -0800 (Mon, 15 Feb 2016)

Log Message

Web Inspector: CSS variables are not formatted correctly
https://bugs.webkit.org/show_bug.cgi?id=154217
rdar://problem/24644154

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Views/CodeMirrorFormatters.js:
(newlineBeforeToken): Check for `variable-2` token in the `maybeprop` state.

LayoutTests:

* inspector/codemirror/prettyprinting-css-rules-expected.txt:
* inspector/codemirror/prettyprinting-css-rules.html:
* inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables-expected.css: Added.
* inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables.css: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (196592 => 196593)


--- trunk/LayoutTests/ChangeLog	2016-02-15 21:13:24 UTC (rev 196592)
+++ trunk/LayoutTests/ChangeLog	2016-02-15 21:16:40 UTC (rev 196593)
@@ -1,3 +1,16 @@
+2016-02-15  Timothy Hatcher  <[email protected]>
+
+        Web Inspector: CSS variables are not formatted correctly
+        https://bugs.webkit.org/show_bug.cgi?id=154217
+        rdar://problem/24644154
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/codemirror/prettyprinting-css-rules-expected.txt:
+        * inspector/codemirror/prettyprinting-css-rules.html:
+        * inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables-expected.css: Added.
+        * inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables.css: Added.
+
 2016-02-15  Chris Dumez  <[email protected]>
 
         Regression(r196563): It is no longer possible to call window.addEventListener without an explicit 'this'

Modified: trunk/LayoutTests/inspector/codemirror/prettyprinting-css-rules-expected.txt (196592 => 196593)


--- trunk/LayoutTests/inspector/codemirror/prettyprinting-css-rules-expected.txt	2016-02-15 21:13:24 UTC (rev 196592)
+++ trunk/LayoutTests/inspector/codemirror/prettyprinting-css-rules-expected.txt	2016-02-15 21:16:40 UTC (rev 196593)
@@ -86,3 +86,6 @@
 -- Running test case: CodeMirror.PrettyPrinting.CSSRules.keep-prefixed-value.css
 PASS
 
+-- Running test case: CodeMirror.PrettyPrinting.CSSRules.css-variables.css
+PASS
+

Modified: trunk/LayoutTests/inspector/codemirror/prettyprinting-css-rules.html (196592 => 196593)


--- trunk/LayoutTests/inspector/codemirror/prettyprinting-css-rules.html	2016-02-15 21:13:24 UTC (rev 196592)
+++ trunk/LayoutTests/inspector/codemirror/prettyprinting-css-rules.html	2016-02-15 21:16:40 UTC (rev 196593)
@@ -37,6 +37,7 @@
         "resources/prettyprinting/css-rule-tests/do-not-append-semicolon.css",
         "resources/prettyprinting/css-rule-tests/do-not-add-whitespace-before-prefixed-property-value.css",
         "resources/prettyprinting/css-rule-tests/keep-prefixed-value.css",
+        "resources/prettyprinting/css-rule-tests/css-variables.css",
     ]);
 
     suite.runTestCasesAndFinish();

Added: trunk/LayoutTests/inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables-expected.css (0 => 196593)


--- trunk/LayoutTests/inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables-expected.css	                        (rev 0)
+++ trunk/LayoutTests/inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables-expected.css	2016-02-15 21:16:40 UTC (rev 196593)
@@ -0,0 +1,4 @@
+color: var(--foo-color);
+--foo-color: red;
+--foo-index: 1;
+--foo-bar: 0;

Added: trunk/LayoutTests/inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables.css (0 => 196593)


--- trunk/LayoutTests/inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables.css	                        (rev 0)
+++ trunk/LayoutTests/inspector/codemirror/resources/prettyprinting/css-rule-tests/css-variables.css	2016-02-15 21:16:40 UTC (rev 196593)
@@ -0,0 +1,3 @@
+color: var(--foo-color);
+--foo-color: red; --foo-index: 1;
+--foo-bar:0;
\ No newline at end of file

Modified: trunk/Source/WebInspectorUI/ChangeLog (196592 => 196593)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-02-15 21:13:24 UTC (rev 196592)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-02-15 21:16:40 UTC (rev 196593)
@@ -1,5 +1,16 @@
 2016-02-15  Timothy Hatcher  <[email protected]>
 
+        Web Inspector: CSS variables are not formatted correctly
+        https://bugs.webkit.org/show_bug.cgi?id=154217
+        rdar://problem/24644154
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/CodeMirrorFormatters.js:
+        (newlineBeforeToken): Check for `variable-2` token in the `maybeprop` state.
+
+2016-02-15  Timothy Hatcher  <[email protected]>
+
         Web Inspector: CodeMirror styles needs updated for CSS variables
         https://bugs.webkit.org/show_bug.cgi?id=154216
         rdar://problem/24644146

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js (196592 => 196593)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js	2016-02-15 21:13:24 UTC (rev 196592)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js	2016-02-15 21:16:40 UTC (rev 196593)
@@ -519,6 +519,10 @@
         if (/\bproperty\b/.test(token))
             return !(/\bmeta\b/.test(lastToken));
 
+        // Add new line before a CSS variable like `--foo`.
+        if (state.state === "maybeprop" && /\bvariable-2\b/.test(token))
+            return true;
+
         return false;
     },
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to