Title: [139607] trunk
Revision
139607
Author
apav...@chromium.org
Date
2013-01-14 04:36:30 -0800 (Mon, 14 Jan 2013)

Log Message

Web Inspector: [Styles] Color names parsed inside "background-image" values
https://bugs.webkit.org/show_bug.cgi?id=106770

Reviewed by Pavel Feldman.

Source/WebCore:

Test: inspector/styles/url-color-swatch.html

Spaces were not allowed in url(...) CSS property values.

* inspector/front-end/StylesSidebarPane.js:

LayoutTests:

* inspector/styles/url-color-swatch-expected.txt: Added.
* inspector/styles/url-color-swatch.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139606 => 139607)


--- trunk/LayoutTests/ChangeLog	2013-01-14 12:10:56 UTC (rev 139606)
+++ trunk/LayoutTests/ChangeLog	2013-01-14 12:36:30 UTC (rev 139607)
@@ -1,3 +1,13 @@
+2013-01-14  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Styles] Color names parsed inside "background-image" values
+        https://bugs.webkit.org/show_bug.cgi?id=106770
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/styles/url-color-swatch-expected.txt: Added.
+        * inspector/styles/url-color-swatch.html: Added.
+
 2013-01-14  Andrey Lushnikov  <lushni...@chromium.org>
 
         Web Inspector: InspectorTest.createTestEditor should not set any text in editor

Added: trunk/LayoutTests/inspector/styles/url-color-swatch-expected.txt (0 => 139607)


--- trunk/LayoutTests/inspector/styles/url-color-swatch-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/url-color-swatch-expected.txt	2013-01-14 12:36:30 UTC (rev 139607)
@@ -0,0 +1,5 @@
+Tests that url(...) with space-delimited color names as filename segments do not contain color swatches. Bug 106770.
+
+url("red green blue.jpg")
+[] red
+
Property changes on: trunk/LayoutTests/inspector/styles/url-color-swatch-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/styles/url-color-swatch.html (0 => 139607)


--- trunk/LayoutTests/inspector/styles/url-color-swatch.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/url-color-swatch.html	2013-01-14 12:36:30 UTC (rev 139607)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<style>
+#inspected {
+    background-image: url("red green blue.jpg");
+    color: red;
+}
+</style>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
+
+    function step1()
+    {
+        dumpDOM(InspectorTest.getMatchedStylePropertyTreeItem("background-image"));
+        dumpDOM(InspectorTest.getMatchedStylePropertyTreeItem("color"));
+        InspectorTest.completeTest();
+    }
+
+    function dumpDOM(treeItem)
+    {
+        var element = treeItem.listItemElement.getElementsByClassName("value")[0];
+        var result = [];
+        dumpNode(element, result);
+        InspectorTest.addResult(result.join(""));
+    }
+
+    function dumpNode(parentNode, result)
+    {
+        var childNodes = parentNode.childNodes;
+        for (var i = 0; i < childNodes.length; ++i) {
+            var node = childNodes[i];
+            switch (node.nodeType) {
+            case Node.ELEMENT_NODE:
+                if (node.hasStyleClass("swatch"))
+                    result.push("[] ");
+                else
+                    dumpNode(node, result);
+                break;
+            case Node.TEXT_NODE:
+                result.push(node.nodeValue);
+                break;
+            }
+        }
+    }
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>
+Tests that url(...) with space-delimited color names as filename segments do not contain color swatches. Bug <a href=""
+</p>
+<div id="inspected"></div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/styles/url-color-swatch.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (139606 => 139607)


--- trunk/Source/WebCore/ChangeLog	2013-01-14 12:10:56 UTC (rev 139606)
+++ trunk/Source/WebCore/ChangeLog	2013-01-14 12:36:30 UTC (rev 139607)
@@ -1,3 +1,16 @@
+2013-01-14  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Styles] Color names parsed inside "background-image" values
+        https://bugs.webkit.org/show_bug.cgi?id=106770
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/styles/url-color-swatch.html
+
+        Spaces were not allowed in url(...) CSS property values.
+
+        * inspector/front-end/StylesSidebarPane.js:
+
 2013-01-14  Kentaro Hara  <hara...@chromium.org>
 
         [V8] Pass an Isolate to associateObjectWithWrapper()

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (139606 => 139607)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2013-01-14 12:10:56 UTC (rev 139606)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2013-01-14 12:36:30 UTC (rev 139607)
@@ -1898,7 +1898,7 @@
             var colorRegex = /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g;
             var colorProcessor = processValue.bind(window, colorRegex, processColor, null);
 
-            valueElement.appendChild(processValue(/url\(\s*([^)\s]+)\s*\)/g, linkifyURL.bind(this), WebInspector.CSSMetadata.isColorAwareProperty(self.name) ? colorProcessor : null, value));
+            valueElement.appendChild(processValue(/url\(\s*([^)]+)\s*\)/g, linkifyURL.bind(this), WebInspector.CSSMetadata.isColorAwareProperty(self.name) ? colorProcessor : null, value));
         }
 
         this.listItemElement.removeChildren();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to