Web Inspector: CSS selectors containing a color name shouldn't be considered for...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Feb 2014 19:36:01 +0000 (19:36 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Feb 2014 19:36:01 +0000 (19:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=128909

Reviewed by Joseph Pecoraro.

Disregard any text that might be contained within a CSS selector.

* UserInterface/CodeMirrorAdditions.js:

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/CodeMirrorAdditions.js

index 515b6a4..13612ca 100644 (file)
@@ -1,3 +1,14 @@
+2014-02-17  Antoine Quint  <graouts@webkit.org>
+
+        Web Inspector: CSS selectors containing a color name shouldn't be considered for color editing
+        https://bugs.webkit.org/show_bug.cgi?id=128909
+
+        Reviewed by Joseph Pecoraro.
+
+        Disregard any text that might be contained within a CSS selector.
+
+        * UserInterface/CodeMirrorAdditions.js:
+
 2014-02-15  Chris J. Shull  <chrisjshull@gmail.com>
 
         Web Inspector: scope chain details sidebar doesn't update values modified via console
index 65260da..7276b92 100644 (file)
                     continue;
                 }
 
+                // We're not interested in text within a CSS selector.
+                var tokenType = this.getTokenTypeAt(from);
+                if (tokenType && (tokenType.indexOf("builtin") !== -1 || tokenType.indexOf("tag") !== -1)) {
+                    match = colorRegex.exec(lineContent);
+                    continue;
+                }
+
                 var colorString = match[0];
                 var color = WebInspector.Color.fromString(colorString);
                 if (!color) {