[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

bweinstein at apple.com bweinstein at apple.com
Thu Oct 29 20:38:49 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 43cb7f778a1cb606e998e41cf12c18b79a5f4d9b
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 5 04:16:40 2009 +0000

    2009-10-04  Brian Weinstein  <bweinstein at apple.com>
    
            Reviewed by Timothy Hatcher.
    
            Fixes <https://bugs.webkit.org/show_bug.cgi?id=30062>
            Inspector should syntax highlight JS/CSS in elements view.
    
            Add syntax highlighting of CSS and JavaScript tags to the elements panel.
            Copied CSS rules from SourceFrame.js to inspector.css, and have the text nodes
            in utilities.js call the CSS or JS Syntax highlighters if their parent is a script
            or style tag.
    
            * inspector/front-end/inspector.css:
            * inspector/front-end/utilities.js:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49081 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 00ed2f7..ae4f8eb 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-10-04  Brian Weinstein  <bweinstein at apple.com>
+
+        Reviewed by Timothy Hatcher.
+        
+        Fixes <https://bugs.webkit.org/show_bug.cgi?id=30062>
+        Inspector should syntax highlight JS/CSS in elements view.
+
+        Add syntax highlighting of CSS and JavaScript tags to the elements panel.
+        Copied CSS rules from SourceFrame.js to inspector.css, and have the text nodes
+        in utilities.js call the CSS or JS Syntax highlighters if their parent is a script
+        or style tag.
+
+        * inspector/front-end/inspector.css:
+        * inspector/front-end/utilities.js:
+
 2009-10-04  Fumitoshi Ukai  <ukai at chromium.org>
 
         Reviewed by Eric Seidel
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 1efe8c9..89a2f2d 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -3422,3 +3422,51 @@ ol.breakpoint-list {
 .breakpoint-list a:hover {
     color: rgb(15%, 15%, 15%);
 }
+
+.webkit-html-js-node, .webkit-html-css-node {
+    white-space: pre;
+}
+
+.webkit-css-comment { 
+    color: rgb(0, 116, 0);
+}
+
+.webkit-css-string, .webkit-css-keyword, .webkit-css-unit {
+    color: rgb(7, 144, 154);
+}
+
+.webkit-css-number {
+    color: rgb(50, 0, 255);
+}
+
+.webkit-css-property, .webkit-css-at-rule {
+    color: rgb(200, 0, 0);
+}
+
+.webkit-css-url {
+    color: rgb(0, 0, 0);
+}
+
+.webkit-css-selector {
+    color: rgb(0, 0, 0);
+}
+
+.webkit-css-pseudo-class {
+    color: rgb(128, 128, 128);
+}
+
+.webkit-javascript-comment {
+    color: rgb(0, 116, 0);
+}
+
+.webkit-javascript-keyword {
+    color: rgb(170, 13, 145);
+}
+
+.webkit-javascript-number {
+    color: rgb(28, 0, 207);
+}
+
+.webkit-javascript-string, .webkit-javascript-regexp {
+    color: rgb(196, 26, 22);
+}
diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js
index 5f41b56..85dd8a8 100644
--- a/WebCore/inspector/front-end/utilities.js
+++ b/WebCore/inspector/front-end/utilities.js
@@ -594,9 +594,28 @@ function nodeTitleInfo(hasChildren, linkify)
         case Node.TEXT_NODE:
             if (isNodeWhitespace.call(this))
                 info.title = "(whitespace)";
-            else
-                info.title = "\"<span class=\"webkit-html-text-node\">" + this.nodeValue.escapeHTML() + "</span>\"";
-            break
+            else {
+                if (this.parentNode && this.parentNode.nodeName.toLowerCase() == "script") {
+                    var newNode = document.createElement("span");
+                    newNode.textContent = this.textContent;
+                    
+                    var javascriptSyntaxHighlighter = new WebInspector.JavaScriptSourceSyntaxHighlighter(null, null);
+                    javascriptSyntaxHighlighter.syntaxHighlightLine(newNode, null);
+                    
+                    info.title = "<span class=\"webkit-html-text-node webkit-html-js-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
+                } else if (this.parentNode && this.parentNode.nodeName.toLowerCase() == "style") {
+                    var newNode = document.createElement("span");
+                    newNode.textContent = this.textContent;
+                    
+                    var cssSyntaxHighlighter = new WebInspector.CSSSourceSyntaxHighligher(null, null);
+                    cssSyntaxHighlighter.syntaxHighlightLine(newNode, null);
+                    
+                    info.title = "<span class=\"webkit-html-text-node webkit-html-css-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
+                } else {
+                    info.title = "\"<span class=\"webkit-html-text-node\">" + this.nodeValue.escapeHTML() + "</span>\""; 
+                }
+            } 
+            break;
 
         case Node.COMMENT_NODE:
             info.title = "<span class=\"webkit-html-comment\">&lt;!--" + this.nodeValue.escapeHTML() + "--&gt;</span>";

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list