Title: [125201] trunk/Source/WebCore
Revision
125201
Author
[email protected]
Date
2012-08-09 14:00:46 -0700 (Thu, 09 Aug 2012)

Log Message

Web Inspector: replace the Web Inspector editor with CodeMirror
https://bugs.webkit.org/show_bug.cgi?id=92769

Patch by Jan Keromnes <[email protected]> on 2012-08-09
Reviewed by Pavel Feldman.

Integrating CodeMirror as a devtools experiment. Currently supporting
basic editing, search/replacing, and saving. Missing proper breakpoints
wiring, debugging, message bubbles, popovers and context menus. WIP.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.py:
* inspector/front-end/CodeMirrorTextEditor.js: Added.
(WebInspector.CodeMirrorTextEditor.this._codeMirror.CodeMirror):
(WebInspector.CodeMirrorTextEditor):
(WebInspector.CodeMirrorTextEditor.prototype.set mimeType):
(WebInspector.CodeMirrorTextEditor.prototype.setReadOnly):
(WebInspector.CodeMirrorTextEditor.prototype.readOnly):
(WebInspector.CodeMirrorTextEditor.prototype.defaultFocusedElement):
(WebInspector.CodeMirrorTextEditor.prototype.focus):
(WebInspector.CodeMirrorTextEditor.prototype.revealLine):
(WebInspector.CodeMirrorTextEditor.prototype.addDecoration):
(WebInspector.CodeMirrorTextEditor.prototype.removeDecoration):
(WebInspector.CodeMirrorTextEditor.prototype.markAndRevealRange):
(WebInspector.CodeMirrorTextEditor.prototype.highlightLine):
(WebInspector.CodeMirrorTextEditor.prototype.clearLineHighlight):
(WebInspector.CodeMirrorTextEditor.prototype.freeCachedElements):
(WebInspector.CodeMirrorTextEditor.prototype.elementsToRestoreScrollPositionsFor):
(WebInspector.CodeMirrorTextEditor.prototype.inheritScrollPositions):
(WebInspector.CodeMirrorTextEditor.prototype.beginUpdates):
(WebInspector.CodeMirrorTextEditor.prototype.endUpdates):
(WebInspector.CodeMirrorTextEditor.prototype.onResize):
(WebInspector.CodeMirrorTextEditor.prototype.editRange):
(WebInspector.CodeMirrorTextEditor.prototype._onChange):
(WebInspector.CodeMirrorTextEditor.prototype._commitEditing):
(WebInspector.CodeMirrorTextEditor.prototype.scrollToLine):
(WebInspector.CodeMirrorTextEditor.prototype.selection):
(WebInspector.CodeMirrorTextEditor.prototype.lastSelection):
(WebInspector.CodeMirrorTextEditor.prototype.setSelection):
(WebInspector.CodeMirrorTextEditor.prototype.setText):
(WebInspector.CodeMirrorTextEditor.prototype.text):
(WebInspector.CodeMirrorTextEditor.prototype.range):
(WebInspector.CodeMirrorTextEditor.prototype.line):
(WebInspector.CodeMirrorTextEditor.prototype.get linesCount):
(WebInspector.CodeMirrorTextEditor.prototype.setAttribute):
(WebInspector.CodeMirrorTextEditor.prototype.getAttribute):
(WebInspector.CodeMirrorTextEditor.prototype.removeAttribute):
(WebInspector.CodeMirrorTextEditor.prototype.wasShown):
(WebInspector.CodeMirrorTextEditor.prototype.willHide):
(WebInspector.CodeMirrorTextEditor.prototype._textChanged):
(WebInspector.CodeMirrorTextEditor.prototype._toPos):
(WebInspector.CodeMirrorTextEditor.prototype._toRange):
* inspector/front-end/Settings.js:
(WebInspector.ExperimentsSettings):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/cmdevtools.css: Added.
* inspector/front-end/inspector.html:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125200 => 125201)


--- trunk/Source/WebCore/ChangeLog	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/ChangeLog	2012-08-09 21:00:46 UTC (rev 125201)
@@ -1,3 +1,65 @@
+2012-08-09  Jan Keromnes  <[email protected]>
+
+        Web Inspector: replace the Web Inspector editor with CodeMirror
+        https://bugs.webkit.org/show_bug.cgi?id=92769
+
+        Reviewed by Pavel Feldman.
+
+        Integrating CodeMirror as a devtools experiment. Currently supporting
+        basic editing, search/replacing, and saving. Missing proper breakpoints
+        wiring, debugging, message bubbles, popovers and context menus. WIP.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.py:
+        * inspector/front-end/CodeMirrorTextEditor.js: Added.
+        (WebInspector.CodeMirrorTextEditor.this._codeMirror.CodeMirror):
+        (WebInspector.CodeMirrorTextEditor):
+        (WebInspector.CodeMirrorTextEditor.prototype.set mimeType):
+        (WebInspector.CodeMirrorTextEditor.prototype.setReadOnly):
+        (WebInspector.CodeMirrorTextEditor.prototype.readOnly):
+        (WebInspector.CodeMirrorTextEditor.prototype.defaultFocusedElement):
+        (WebInspector.CodeMirrorTextEditor.prototype.focus):
+        (WebInspector.CodeMirrorTextEditor.prototype.revealLine):
+        (WebInspector.CodeMirrorTextEditor.prototype.addDecoration):
+        (WebInspector.CodeMirrorTextEditor.prototype.removeDecoration):
+        (WebInspector.CodeMirrorTextEditor.prototype.markAndRevealRange):
+        (WebInspector.CodeMirrorTextEditor.prototype.highlightLine):
+        (WebInspector.CodeMirrorTextEditor.prototype.clearLineHighlight):
+        (WebInspector.CodeMirrorTextEditor.prototype.freeCachedElements):
+        (WebInspector.CodeMirrorTextEditor.prototype.elementsToRestoreScrollPositionsFor):
+        (WebInspector.CodeMirrorTextEditor.prototype.inheritScrollPositions):
+        (WebInspector.CodeMirrorTextEditor.prototype.beginUpdates):
+        (WebInspector.CodeMirrorTextEditor.prototype.endUpdates):
+        (WebInspector.CodeMirrorTextEditor.prototype.onResize):
+        (WebInspector.CodeMirrorTextEditor.prototype.editRange):
+        (WebInspector.CodeMirrorTextEditor.prototype._onChange):
+        (WebInspector.CodeMirrorTextEditor.prototype._commitEditing):
+        (WebInspector.CodeMirrorTextEditor.prototype.scrollToLine):
+        (WebInspector.CodeMirrorTextEditor.prototype.selection):
+        (WebInspector.CodeMirrorTextEditor.prototype.lastSelection):
+        (WebInspector.CodeMirrorTextEditor.prototype.setSelection):
+        (WebInspector.CodeMirrorTextEditor.prototype.setText):
+        (WebInspector.CodeMirrorTextEditor.prototype.text):
+        (WebInspector.CodeMirrorTextEditor.prototype.range):
+        (WebInspector.CodeMirrorTextEditor.prototype.line):
+        (WebInspector.CodeMirrorTextEditor.prototype.get linesCount):
+        (WebInspector.CodeMirrorTextEditor.prototype.setAttribute):
+        (WebInspector.CodeMirrorTextEditor.prototype.getAttribute):
+        (WebInspector.CodeMirrorTextEditor.prototype.removeAttribute):
+        (WebInspector.CodeMirrorTextEditor.prototype.wasShown):
+        (WebInspector.CodeMirrorTextEditor.prototype.willHide):
+        (WebInspector.CodeMirrorTextEditor.prototype._textChanged):
+        (WebInspector.CodeMirrorTextEditor.prototype._toPos):
+        (WebInspector.CodeMirrorTextEditor.prototype._toRange):
+        * inspector/front-end/Settings.js:
+        (WebInspector.ExperimentsSettings):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/cmdevtools.css: Added.
+        * inspector/front-end/inspector.html:
+
 2012-08-09  Dana Jansens  <[email protected]>
 
         [chromium] Do partial-swap scissoring on quads during draw instead of on layers

Modified: trunk/Source/WebCore/WebCore.gypi (125200 => 125201)


--- trunk/Source/WebCore/WebCore.gypi	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/WebCore.gypi	2012-08-09 21:00:46 UTC (rev 125201)
@@ -6253,6 +6253,7 @@
             'inspector/front-end/BreakpointsSidebarPane.js',
             'inspector/front-end/CallStackSidebarPane.js',
             'inspector/front-end/Checkbox.js',
+            'inspector/front-end/CodeMirrorTextEditor.js',
             'inspector/front-end/Color.js',
             'inspector/front-end/CompilerScriptMapping.js',
             'inspector/front-end/ConsoleMessage.js',
@@ -6443,6 +6444,7 @@
         'webinspector_standalone_css_files': [
             'inspector/front-end/auditsPanel.css',
             'inspector/front-end/cm/codemirror.css',
+            'inspector/front-end/cmdevtools.css',
             'inspector/front-end/dataGrid.css',
             'inspector/front-end/elementsPanel.css',
             'inspector/front-end/filteredItemSelectionDialog.css',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (125200 => 125201)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-08-09 21:00:46 UTC (rev 125201)
@@ -75418,6 +75418,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\CodeMirrorTextEditor.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\Color.js"
 					>
 				</File>
@@ -75510,6 +75514,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\cmdevtools.css"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\Database.js"
 					>
 				</File>

Added: trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js (0 => 125201)


--- trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	2012-08-09 21:00:46 UTC (rev 125201)
@@ -0,0 +1,354 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.View}
+ * @implements {WebInspector.TextEditor}
+ * @param {?string} url
+ * @param {WebInspector.TextEditorDelegate} delegate
+ */
+WebInspector.CodeMirrorTextEditor = function(url, delegate)
+{
+    WebInspector.View.call(this);
+    this._delegate = delegate;
+    this._url = url;
+
+    this._loadLibraries();
+    this.registerRequiredCSS("codemirror.css");
+    this.registerRequiredCSS("cmdevtools.css");
+
+    this._codeMirror = window.CodeMirror(this.element, {
+        lineNumbers: true,
+        fixedGutter: true,
+        onChange: this._onChange.bind(this),
+    });
+
+    this._lastRange = this.range();
+
+    this.element.firstChild.addStyleClass("source-code");
+    this.element.firstChild.addStyleClass("fill");
+}
+
+WebInspector.CodeMirrorTextEditor.prototype = {
+    /**
+     * @param {string} mimeType
+     */
+    set mimeType(mimeType)
+    {
+        this._codeMirror.setOption("mode", mimeType);
+        switch(mimeType) {
+            case "text/html": this._codeMirror.setOption("theme", "web-inspector-html"); break;
+            case "text/css": this._codeMirror.setOption("theme", "web-inspector-css"); break;
+            case "text/_javascript_": this._codeMirror.setOption("theme", "web-inspector-js"); break;
+        }
+    },
+
+    /**
+     * @param {boolean} readOnly
+     */
+    setReadOnly: function(readOnly)
+    {
+        this._codeMirror.setOption("readOnly", readOnly);
+    },
+
+    /**
+     * @return {boolean}
+     */
+    readOnly: function()
+    {
+        return !!this._codeMirror.getOption("readOnly");
+    },
+
+    /**
+     * @return {Element}
+     */
+    defaultFocusedElement: function()
+    {
+        return this.element.firstChild;
+    },
+
+    focus: function()
+    {
+        this._codeMirror.focus();
+    },
+
+    beginUpdates: function() { },
+
+    endUpdates: function() { },
+
+    /**
+     * @param {number} lineNumber
+     */
+    revealLine: function(lineNumber)
+    {
+        this._codeMirror.setCursor({ line: lineNumber, ch: 0 });
+        var coords = this._codeMirror.cursorCoords();
+        this._codeMirror.scrollTo(coords.x, coords.y);
+    },
+
+    /**
+     * @param {number} lineNumber
+     * @param {string|Element} decoration
+     */
+    addDecoration: function(lineNumber, decoration)
+    {
+    },
+
+    /**
+     * @param {number} lineNumber
+     * @param {string|Element} decoration
+     */
+    removeDecoration: function(lineNumber, decoration)
+    {
+    },
+
+    /**
+     * @param {WebInspector.TextRange} range
+     */
+    markAndRevealRange: function(range)
+    {
+        if (range)
+            this.setSelection(range);
+    },
+
+    /**
+     * @param {number} lineNumber
+     */
+    highlightLine: function(lineNumber)
+    {
+        var line = this._codeMirror.getLine(lineNumber);
+        var mark = this._codeMirror.markText({ line: lineNumber, ch: 0 }, { line: lineNumber, ch: line.length }, "CodeMirror-searching");
+        setTimeout(mark.clear.bind(mark), 1000);
+    },
+
+    clearLineHighlight: function()
+    {
+    },
+
+    /**
+     * @return {Array.<Element>}
+     */
+    elementsToRestoreScrollPositionsFor: function()
+    {
+        return [];
+    },
+
+    /**
+     * @param {WebInspector.TextEditor} textEditor
+     */
+    inheritScrollPositions: function(textEditor)
+    {
+    },
+
+    onResize: function()
+    {
+        this._codeMirror.refresh();
+    },
+
+    /**
+     * @param {WebInspector.TextRange} range
+     * @param {string} text
+     * @return {WebInspector.TextRange}
+     */
+    editRange: function(range, text)
+    {
+        this._delegate.beforeTextChanged();
+
+        var pos = this._toPos(range);
+        this._codeMirror.replaceRange(text, pos.start, pos.end);
+        var newRange = this._toRange(pos.start, this._codeMirror.posFromIndex(this._codeMirror.indexFromPos(pos.start) + text.length));
+
+        this._delegate.afterTextChanged(range, newRange);
+
+        return newRange;
+    },
+
+    _onChange: function()
+    {
+        this._delegate.beforeTextChanged();
+        var newRange = this.range();
+        this._delegate.afterTextChanged(this._lastRange, newRange);
+        this._lastRange = newRange;
+    },
+
+    /**
+     * @param {number} lineNumber
+     */
+    scrollToLine: function(lineNumber)
+    {
+        this._codeMirror.setCursor({line:lineNumber, ch:0});
+    },
+
+    /**
+     * @return {WebInspector.TextRange}
+     */
+    selection: function(textRange)
+    {
+        var start = this._codeMirror.cursorCoords(true);
+        var end = this._codeMirror.cursorCoords(false);
+
+        if (start.line > end.line || (start.line == end.line && start.ch > end.ch))
+            return this._toRange(end, start);
+
+        return this._toRange(start, end);
+    },
+
+    /**
+     * @return {WebInspector.TextRange?}
+     */
+    lastSelection: function()
+    {
+        return this._lastSelection;
+    },
+
+    /**
+     * @param {WebInspector.TextRange} textRange
+     */
+    setSelection: function(textRange)
+    {
+        this._lastSelection = textRange;
+        var pos = this._toPos(textRange);
+        this._codeMirror.setSelection(pos.start, pos.end);
+    },
+
+    /**
+     * @param {string} text
+     */
+    setText: function(text)
+    {
+        this._codeMirror.setValue(text);
+    },
+
+    /**
+     * @return {string}
+     */
+    text: function()
+    {
+        return this._codeMirror.getValue();
+    },
+
+    /**
+     * @return {WebInspector.TextRange}
+     */
+    range: function()
+    {
+        var lineCount = this.linesCount;
+        var lastLine = this._codeMirror.getLine(lineCount - 1);
+        return this._toRange({ line: 0, ch: 0 }, { line: lineCount - 1, ch: lastLine.length });
+    },
+
+    /**
+     * @param {number} lineNumber
+     * @return {string}
+     */
+    line: function(lineNumber)
+    {
+        return this._codeMirror.getLine(lineNumber);
+    },
+
+    /**
+     * @return {number}
+     */
+    get linesCount()
+    {
+        return this._codeMirror.lineCount();
+    },
+
+    /**
+     * @param {number} line
+     * @param {string} name
+     * @param {Object?} value
+     */
+    setAttribute: function(line, name, value)
+    {
+        var handle = this._codeMirror.getLineHandle(line);
+        if (handle.attributes === undefined) handle.attributes = {};
+        handle.attributes[name] = value;
+    },
+
+    /**
+     * @param {number} line
+     * @param {string} name
+     * @return {Object|null} value
+     */
+    getAttribute: function(line, name)
+    {
+        var handle = this._codeMirror.getLineHandle(line);
+        return handle.attributes && handle.attributes[name] !== undefined ? handle.attributes[name] : null;
+    },
+
+    /**
+     * @param {number} line
+     * @param {string} name
+     */
+    removeAttribute: function(line, name)
+    {
+        var handle = this._codeMirror.getLineHandle(line);
+        if (handle.attributes)
+            delete handle.attributes[name];
+    },
+
+    _toPos: function(range)
+    {
+        return {
+            start: {line: range.startLine, ch: range.startColumn},
+            end: {line: range.endLine, ch: range.endColumn}
+        }
+    },
+
+    _toRange: function(start, end)
+    {
+        return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch);
+    },
+
+    _loadLibraries: function()
+    {
+        if (window.CodeMirror)
+            return;
+
+        function loadLibrary(file)
+        {
+            var xhr = new XMLHttpRequest();
+            xhr.open("GET", file, false);
+            xhr.send(null);
+            console.log(xhr.responseText);
+            window.eval(xhr.responseText);
+        }
+
+        loadLibrary("codemirror.js");
+        loadLibrary("css.js");
+        loadLibrary("_javascript_.js");
+        loadLibrary("xml.js");
+        loadLibrary("htmlmixed.js");
+    }
+}
+
+WebInspector.CodeMirrorTextEditor.prototype.__proto__ = WebInspector.View.prototype;

Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (125200 => 125201)


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-09 21:00:46 UTC (rev 125201)
@@ -182,10 +182,10 @@
         this._mainPanel.clearLineHighlight();
     },
 
-    freeCachedElements: function()
+    _freeCachedElements: function()
     {
-        this._mainPanel.freeCachedElements();
-        this._gutterPanel.freeCachedElements();
+        this._mainPanel._freeCachedElements();
+        this._gutterPanel._freeCachedElements();
     },
 
     /**
@@ -521,6 +521,7 @@
 
         if (!this.readOnly())
             WebInspector.markBeingEdited(this.element, false);
+        this._freeCachedElements();
     }
 }
 
@@ -877,13 +878,13 @@
 
     this.element.addEventListener("scroll", this._scroll.bind(this), false);
 
-    this.freeCachedElements();
+    this._freeCachedElements();
     this._buildChunks();
     this._decorations = {};
 }
 
 WebInspector.TextEditorGutterPanel.prototype = {
-    freeCachedElements: function()
+    _freeCachedElements: function()
     {
         this._cachedRows = [];
     },
@@ -1201,7 +1202,7 @@
     this._container.addEventListener("DOMNodeInserted", this._handleDOMUpdatesCallback, false);
     this._container.addEventListener("DOMSubtreeModified", this._handleDOMUpdatesCallback, false);
 
-    this.freeCachedElements();
+    this._freeCachedElements();
     this._buildChunks();
 }
 
@@ -1376,7 +1377,7 @@
         }
     },
 
-    freeCachedElements: function()
+    _freeCachedElements: function()
     {
         this._cachedSpans = [];
         this._cachedTextNodes = [];

Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (125200 => 125201)


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-08-09 21:00:46 UTC (rev 125201)
@@ -193,6 +193,7 @@
     this.geolocationOverride = this._createExperiment("geolocationOverride", "Override Device Geolocation");
     this.deviceOrientationOverride = this._createExperiment("deviceOrientationOverride", "Override Device Orientation");
     this.sass = this._createExperiment("sass", "Support for SASS");
+    this.codemirror = this._createExperiment("codemirror", "Use CodeMirror editor");
 
     this._cleanUpSetting();
 }

Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (125200 => 125201)


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-08-09 21:00:46 UTC (rev 125201)
@@ -42,8 +42,12 @@
     this._contentProvider = contentProvider;
 
     var textEditorDelegate = new WebInspector.TextEditorDelegateForSourceFrame(this);
-    this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate);
 
+    if (WebInspector.experimentsSettings.codemirror.isEnabled())
+        this._textEditor = new WebInspector.CodeMirrorTextEditor(this._url, textEditorDelegate);
+    else
+        this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate);
+
     this._currentSearchResultIndex = -1;
     this._searchResults = [];
 
@@ -94,8 +98,6 @@
     willHide: function()
     {
         WebInspector.View.prototype.willHide.call(this);
-        if (this.loaded)
-            this._textEditor.freeCachedElements();
 
         this._clearLineHighlight();
         this._clearLineToReveal();

Modified: trunk/Source/WebCore/inspector/front-end/TextEditor.js (125200 => 125201)


--- trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-08-09 21:00:46 UTC (rev 125201)
@@ -85,8 +85,6 @@
 
     clearLineHighlight: function() { },
 
-    freeCachedElements: function() { },
-
     /**
      * @return {Array.<Element>}
      */

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (125200 => 125201)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-08-09 21:00:46 UTC (rev 125201)
@@ -15,6 +15,7 @@
     <file>BreakpointsSidebarPane.js</file>
     <file>CallStackSidebarPane.js</file>
     <file>Checkbox.js</file>
+    <file>CodeMirrorTextEditor.js</file>
     <file>Color.js</file>
     <file>CompilerScriptMapping.js</file>
     <file>ConsoleMessage.js</file>
@@ -204,6 +205,7 @@
     <file>UglifyJS/parse-js.js</file>
     <file>auditsPanel.css</file>
     <file>dataGrid.css</file>
+    <file>cmdevtools.css</file>
     <file>dialog.css</file>
     <file>elementsPanel.css</file>
     <file>filteredItemSelectionDialog.css</file>

Added: trunk/Source/WebCore/inspector/front-end/cmdevtools.css (0 => 125201)


--- trunk/Source/WebCore/inspector/front-end/cmdevtools.css	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/cmdevtools.css	2012-08-09 21:00:46 UTC (rev 125201)
@@ -0,0 +1,28 @@
+.CodeMirror-scroll {
+  height: 100% !important;
+}
+
+.CodeMirror {
+  line-height: 1.2em !important;
+}
+
+.cm-s-web-inspector-js span.cm-keyword {color: rgb(170, 13, 145);}
+.cm-s-web-inspector-js span.cm-number {color: rgb(28, 0, 207);}
+.cm-s-web-inspector-js span.cm-comment {color: rgb(0, 116, 0);}
+.cm-s-web-inspector-js span.cm-string {color: rgb(196, 26, 22);}
+.cm-s-web-inspector-js span.cm-string-2 {color: rgb(196, 26, 22);}
+
+.cm-s-web-inspector-css span.cm-keyword { color: rgb(7, 144, 154);}
+.cm-s-web-inspector-css span.cm-number {color: rgb(50, 0, 255);}
+.cm-s-web-inspector-css span.cm-comment {color: rgb(0, 116, 0);}
+.cm-s-web-inspector-css span.cm-string {color: rgb(7, 144, 154);}
+.cm-s-web-inspector-css span.cm-string-2 {color: rgb(7, 144, 154);}
+.cm-s-web-inspector-css span.cm-link {color: rgb(7, 144, 154);}
+.cm-s-web-inspector-css span.cm-variable {color: rgb(200, 0, 0);}
+
+.cm-s-web-inspector-html span.cm-meta {color: rgb(192, 192, 192);}
+.cm-s-web-inspector-html span.cm-comment {color: rgb(35, 110, 37);}
+.cm-s-web-inspector-html span.cm-string {color: rgb(26, 26, 166);}
+.cm-s-web-inspector-html span.cm-tag {color: rgb(136, 18, 128);}
+.cm-s-web-inspector-html span.cm-attribute {color: rgb(153, 69, 0);}
+.cm-s-web-inspector-html span.cm-link {color: #00e;}

Modified: trunk/Source/WebCore/inspector/front-end/externs.js (125200 => 125201)


--- trunk/Source/WebCore/inspector/front-end/externs.js	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/inspector/front-end/externs.js	2012-08-09 21:00:46 UTC (rev 125201)
@@ -236,3 +236,6 @@
 /** @constructor */
 difflib.SequenceMatcher = function(baseText, newText) { }
 difflib.SequenceMatcher.prototype.get_opcodes = function() { return []; }
+
+/** @constructor */
+WebInspector.CodeMirrorTextEditor = function(url, delegate) { }

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (125200 => 125201)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-08-09 20:58:43 UTC (rev 125200)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-08-09 21:00:46 UTC (rev 125201)
@@ -120,6 +120,7 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to