Title: [174483] trunk/Source/WebInspectorUI
Revision
174483
Author
[email protected]
Date
2014-10-08 17:08:45 -0700 (Wed, 08 Oct 2014)

Log Message

Web Inspector: CSS Pretty Printing fails to put space between rgb(...) and numbers in minified gradients
https://bugs.webkit.org/show_bug.cgi?id=137414

Reviewed by Timothy Hatcher.

Add whitespace between rgb(...) and a number, possible in gradient
syntax like "linear-gradient(rgb(...)0%,rgb(...)100%)".

* Tools/PrettyPrinting/CodeMirrorFormatters.js:
* Tools/PrettyPrinting/css-tests/gradient-expected.css: Added.
(.dot-nav:nth-child(1n) li a.active):
* Tools/PrettyPrinting/css-tests/gradient.css: Added.
(.dot-nav:nth-child(1n) li a.active):
* Tools/PrettyPrinting/index.html:
* UserInterface/Views/CodeMirrorFormatters.js:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (174482 => 174483)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-10-09 00:08:44 UTC (rev 174482)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-10-09 00:08:45 UTC (rev 174483)
@@ -1,5 +1,23 @@
 2014-10-08  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: CSS Pretty Printing fails to put space between rgb(...) and numbers in minified gradients
+        https://bugs.webkit.org/show_bug.cgi?id=137414
+
+        Reviewed by Timothy Hatcher.
+
+        Add whitespace between rgb(...) and a number, possible in gradient
+        syntax like "linear-gradient(rgb(...)0%,rgb(...)100%)".
+
+        * Tools/PrettyPrinting/CodeMirrorFormatters.js:
+        * Tools/PrettyPrinting/css-tests/gradient-expected.css: Added.
+        (.dot-nav:nth-child(1n) li a.active):
+        * Tools/PrettyPrinting/css-tests/gradient.css: Added.
+        (.dot-nav:nth-child(1n) li a.active):
+        * Tools/PrettyPrinting/index.html:
+        * UserInterface/Views/CodeMirrorFormatters.js:
+
+2014-10-08  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: CSS Pretty Printing fails to wrap long lines of selectors with pseudo classes/elements
         https://bugs.webkit.org/show_bug.cgi?id=137413
 

Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js (174482 => 174483)


--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js	2014-10-09 00:08:44 UTC (rev 174482)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js	2014-10-09 00:08:45 UTC (rev 174483)
@@ -322,8 +322,11 @@
                 return true;
             if (lastContent === ":") // Space in "prop: value" but not in a selectors "a:link" or "div::after" or media queries "(max-device-width:480px)".
                 return state.state === "prop";
-            if (lastContent === ")" && (content !== ")" && content !== ",")) // Space in "not(foo)and" but not at the end of "not(not(foo))"
-                return state.state === "media" || state.state === "media_parens";
+            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))" 
+            }
             return ">+~-*/".indexOf(lastContent) >= 0; // calc() _expression_ or child/sibling selectors
         }
 

Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/gradient-expected.css (0 => 174483)


--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/gradient-expected.css	                        (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/gradient-expected.css	2014-10-09 00:08:45 UTC (rev 174483)
@@ -0,0 +1,9 @@
+.dot-nav:nth-child(1n) li a.active {
+    top: 0;
+    background: #08c;
+    background: -webkit-gradient(linear, lefttop, leftbottom, color-stop(0%, rgb(126, 198, 234)), color-stop(24%, rgb(70, 179, 234)), color-stop(100%, rgb(3, 135, 201)));
+    background: -webkit-linear-gradient(top, rgb(126, 198, 234) 0%, rgb(70, 179, 234) 45%, rgb(3, 135, 201) 100%);
+    background: -moz-linear-gradient(top, rgb(126, 198, 234) 0%, rgb(70, 179, 234) 45%, rgb(3, 135, 201) 100%);
+    background: linear-gradient(top, rgb(126, 198, 234) 0%, rgb(70, 179, 234) 45%, rgb(3, 135, 201) 100%);
+}
+

Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/gradient.css (0 => 174483)


--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/gradient.css	                        (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/gradient.css	2014-10-09 00:08:45 UTC (rev 174483)
@@ -0,0 +1,7 @@
+.dot-nav:nth-child(1n) li a.active {
+    top:0;background:#08c;
+	background:-webkit-gradient(linear,lefttop,leftbottom,color-stop(0%,rgb(126,198,234)),color-stop(24%,rgb(70,179,234)),color-stop(100%,rgb(3,135,201)));
+	background:-webkit-linear-gradient(top,rgb(126,198,234)0%,rgb(70,179,234)45%,rgb(3,135,201)100%);
+	background:   -moz-linear-gradient(top,rgb(126,198,234)0%,rgb(70,179,234)45%,rgb(3,135,201)100%);
+	background:        linear-gradient(top,rgb(126,198,234)0%,rgb(70,179,234)45%,rgb(3,135,201)100%);
+}

Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html (174482 => 174483)


--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html	2014-10-09 00:08:44 UTC (rev 174482)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html	2014-10-09 00:08:45 UTC (rev 174483)
@@ -244,6 +244,7 @@
         _runTests(callback, [
             "css-tests/basic.css",
             "css-tests/calc.css",
+            "css-tests/gradient.css",
             "css-tests/media-query.css",
             "css-tests/selectors.css",
             "css-tests/wrapping.css",

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js (174482 => 174483)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js	2014-10-09 00:08:44 UTC (rev 174482)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js	2014-10-09 00:08:45 UTC (rev 174483)
@@ -322,8 +322,11 @@
                 return true;
             if (lastContent === ":") // Space in "prop: value" but not in a selectors "a:link" or "div::after" or media queries "(max-device-width:480px)".
                 return state.state === "prop";
-            if (lastContent === ")" && (content !== ")" && content !== ",")) // Space in "not(foo)and" but not at the end of "not(not(foo))"
-                return state.state === "media" || state.state === "media_parens";
+            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))" 
+            }
             return ">+~-*/".indexOf(lastContent) >= 0; // calc() _expression_ or child/sibling selectors
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to