Web Inspector: CSS Pretty Printing fails to put space between value functions around...
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Oct 2014 00:08:47 +0000 (00:08 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Oct 2014 00:08:47 +0000 (00:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137415

Reviewed by Timothy Hatcher.

Add a space after a closing parenthesis if we are still inside a property.
This adds space between space separated function lists such as
-webkit-transform:foo(...)bar(...). Also add a test for keyframe syntax.

* Tools/PrettyPrinting/CodeMirrorFormatters.js:
* Tools/PrettyPrinting/css-tests/keyframes-expected.css: Added.
* Tools/PrettyPrinting/css-tests/keyframes.css: Added.
* Tools/PrettyPrinting/index.html:
* UserInterface/Views/CodeMirrorFormatters.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174484 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js
Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/keyframes-expected.css [new file with mode: 0644]
Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/keyframes.css [new file with mode: 0644]
Source/WebInspectorUI/Tools/PrettyPrinting/index.html
Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js

index b583f74642290069f40de2f658ea1f7fb1ba31d0..ddcef51497cb40972cf4570b51ce702f0b8a7906 100644 (file)
@@ -1,3 +1,20 @@
+2014-10-08  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: CSS Pretty Printing fails to put space between value functions around ending parenthesis
+        https://bugs.webkit.org/show_bug.cgi?id=137415
+
+        Reviewed by Timothy Hatcher.
+
+        Add a space after a closing parenthesis if we are still inside a property.
+        This adds space between space separated function lists such as
+        -webkit-transform:foo(...)bar(...). Also add a test for keyframe syntax.
+
+        * Tools/PrettyPrinting/CodeMirrorFormatters.js:
+        * Tools/PrettyPrinting/css-tests/keyframes-expected.css: Added.
+        * Tools/PrettyPrinting/css-tests/keyframes.css: Added.
+        * Tools/PrettyPrinting/index.html:
+        * UserInterface/Views/CodeMirrorFormatters.js:
+
 2014-10-08  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: CSS Pretty Printing fails to put space between rgb(...) and numbers in minified gradients
index 1c28b936b9a27daaae6639693a46bdc8fa5406a9..81d74cbb63e479c2bb96a150abb32a61380ca8c8 100644 (file)
@@ -325,7 +325,11 @@ CodeMirror.extendMode("css", {
             if (lastContent === ")" && (content !== ")" && content !== ",")) {
                 if (token === "number") // linear-gradient(rgb(...)0%,rgb(...)100%)
                     return true;
-                return state.state === "media" || state.state === "media_parens"; // Space in "not(foo)and" but not at the end of "not(not(foo))" 
+                if (state.state === "prop") // -webkit-transform:rotate(...)translate(...);
+                    return true;
+                if (state.state === "media" || state.state === "media_parens") // Space in "not(foo)and" but not at the end of "not(not(foo))" 
+                    return true;
+                return false; // color: rgb(...);
             }
             return ">+~-*/".indexOf(lastContent) >= 0; // calc() expression or child/sibling selectors
         }
diff --git a/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/keyframes-expected.css b/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/keyframes-expected.css
new file mode 100644 (file)
index 0000000..e710672
--- /dev/null
@@ -0,0 +1,10 @@
+@-webkit-keyframes spin {
+    0% {
+        -webkit-transform: rotate(-180deg) translate(0px, 0px);
+    }
+
+    100% {
+        -webkit-transform: rotate(180deg) translate(10px, 75px);
+    }
+}
+
diff --git a/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/keyframes.css b/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/keyframes.css
new file mode 100644 (file)
index 0000000..bd88b56
--- /dev/null
@@ -0,0 +1 @@
+@-webkit-keyframes spin{0%{-webkit-transform:rotate(-180deg)translate(0px,0px);}100%{-webkit-transform:rotate(180deg)translate(10px,75px);}}
index a09ba7b7d57e8ea7e85bfcbeb41a1e6deda95e3d..1bc3f38bdc3f4c2119687c178c4662a57d37b27e 100644 (file)
             "css-tests/basic.css",
             "css-tests/calc.css",
             "css-tests/gradient.css",
+            "css-tests/keyframes.css",
             "css-tests/media-query.css",
             "css-tests/selectors.css",
             "css-tests/wrapping.css",
index 1c28b936b9a27daaae6639693a46bdc8fa5406a9..81d74cbb63e479c2bb96a150abb32a61380ca8c8 100644 (file)
@@ -325,7 +325,11 @@ CodeMirror.extendMode("css", {
             if (lastContent === ")" && (content !== ")" && content !== ",")) {
                 if (token === "number") // linear-gradient(rgb(...)0%,rgb(...)100%)
                     return true;
-                return state.state === "media" || state.state === "media_parens"; // Space in "not(foo)and" but not at the end of "not(not(foo))" 
+                if (state.state === "prop") // -webkit-transform:rotate(...)translate(...);
+                    return true;
+                if (state.state === "media" || state.state === "media_parens") // Space in "not(foo)and" but not at the end of "not(not(foo))" 
+                    return true;
+                return false; // color: rgb(...);
             }
             return ">+~-*/".indexOf(lastContent) >= 0; // calc() expression or child/sibling selectors
         }