Changeset 125201 in webkit


Ignore:
Timestamp:
Aug 9, 2012 2:00:46 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Jan Keromnes <janx@linux.com> 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:
Location:
trunk/Source/WebCore
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r125196 r125201  
     12012-08-09  Jan Keromnes  <janx@linux.com>
     2
     3        Web Inspector: replace the Web Inspector editor with CodeMirror
     4        https://bugs.webkit.org/show_bug.cgi?id=92769
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Integrating CodeMirror as a devtools experiment. Currently supporting
     9        basic editing, search/replacing, and saving. Missing proper breakpoints
     10        wiring, debugging, message bubbles, popovers and context menus. WIP.
     11
     12        * WebCore.gypi:
     13        * WebCore.vcproj/WebCore.vcproj:
     14        * inspector/compile-front-end.py:
     15        * inspector/front-end/CodeMirrorTextEditor.js: Added.
     16        (WebInspector.CodeMirrorTextEditor.this._codeMirror.CodeMirror):
     17        (WebInspector.CodeMirrorTextEditor):
     18        (WebInspector.CodeMirrorTextEditor.prototype.set mimeType):
     19        (WebInspector.CodeMirrorTextEditor.prototype.setReadOnly):
     20        (WebInspector.CodeMirrorTextEditor.prototype.readOnly):
     21        (WebInspector.CodeMirrorTextEditor.prototype.defaultFocusedElement):
     22        (WebInspector.CodeMirrorTextEditor.prototype.focus):
     23        (WebInspector.CodeMirrorTextEditor.prototype.revealLine):
     24        (WebInspector.CodeMirrorTextEditor.prototype.addDecoration):
     25        (WebInspector.CodeMirrorTextEditor.prototype.removeDecoration):
     26        (WebInspector.CodeMirrorTextEditor.prototype.markAndRevealRange):
     27        (WebInspector.CodeMirrorTextEditor.prototype.highlightLine):
     28        (WebInspector.CodeMirrorTextEditor.prototype.clearLineHighlight):
     29        (WebInspector.CodeMirrorTextEditor.prototype.freeCachedElements):
     30        (WebInspector.CodeMirrorTextEditor.prototype.elementsToRestoreScrollPositionsFor):
     31        (WebInspector.CodeMirrorTextEditor.prototype.inheritScrollPositions):
     32        (WebInspector.CodeMirrorTextEditor.prototype.beginUpdates):
     33        (WebInspector.CodeMirrorTextEditor.prototype.endUpdates):
     34        (WebInspector.CodeMirrorTextEditor.prototype.onResize):
     35        (WebInspector.CodeMirrorTextEditor.prototype.editRange):
     36        (WebInspector.CodeMirrorTextEditor.prototype._onChange):
     37        (WebInspector.CodeMirrorTextEditor.prototype._commitEditing):
     38        (WebInspector.CodeMirrorTextEditor.prototype.scrollToLine):
     39        (WebInspector.CodeMirrorTextEditor.prototype.selection):
     40        (WebInspector.CodeMirrorTextEditor.prototype.lastSelection):
     41        (WebInspector.CodeMirrorTextEditor.prototype.setSelection):
     42        (WebInspector.CodeMirrorTextEditor.prototype.setText):
     43        (WebInspector.CodeMirrorTextEditor.prototype.text):
     44        (WebInspector.CodeMirrorTextEditor.prototype.range):
     45        (WebInspector.CodeMirrorTextEditor.prototype.line):
     46        (WebInspector.CodeMirrorTextEditor.prototype.get linesCount):
     47        (WebInspector.CodeMirrorTextEditor.prototype.setAttribute):
     48        (WebInspector.CodeMirrorTextEditor.prototype.getAttribute):
     49        (WebInspector.CodeMirrorTextEditor.prototype.removeAttribute):
     50        (WebInspector.CodeMirrorTextEditor.prototype.wasShown):
     51        (WebInspector.CodeMirrorTextEditor.prototype.willHide):
     52        (WebInspector.CodeMirrorTextEditor.prototype._textChanged):
     53        (WebInspector.CodeMirrorTextEditor.prototype._toPos):
     54        (WebInspector.CodeMirrorTextEditor.prototype._toRange):
     55        * inspector/front-end/Settings.js:
     56        (WebInspector.ExperimentsSettings):
     57        * inspector/front-end/SourceFrame.js:
     58        (WebInspector.SourceFrame):
     59        * inspector/front-end/WebKit.qrc:
     60        * inspector/front-end/cmdevtools.css: Added.
     61        * inspector/front-end/inspector.html:
     62
    1632012-08-09  Dana Jansens  <danakj@chromium.org>
    264
  • trunk/Source/WebCore/WebCore.gypi

    r125184 r125201  
    62546254            'inspector/front-end/CallStackSidebarPane.js',
    62556255            'inspector/front-end/Checkbox.js',
     6256            'inspector/front-end/CodeMirrorTextEditor.js',
    62566257            'inspector/front-end/Color.js',
    62576258            'inspector/front-end/CompilerScriptMapping.js',
     
    64446445            'inspector/front-end/auditsPanel.css',
    64456446            'inspector/front-end/cm/codemirror.css',
     6447            'inspector/front-end/cmdevtools.css',
    64466448            'inspector/front-end/dataGrid.css',
    64476449            'inspector/front-end/elementsPanel.css',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r125184 r125201  
    7541975419                                </File>
    7542075420                                <File
     75421                                        RelativePath="..\inspector\front-end\CodeMirrorTextEditor.js"
     75422                                        >
     75423                                </File>
     75424                                <File
    7542175425                                        RelativePath="..\inspector\front-end\Color.js"
    7542275426                                        >
     
    7550875512                                <File
    7550975513                                        RelativePath="..\inspector\front-end\cm\xml.js"
     75514                                        >
     75515                                </File>
     75516                                <File
     75517                                        RelativePath="..\inspector\front-end\cmdevtools.css"
    7551075518                                        >
    7551175519                                </File>
  • trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js

    r124638 r125201  
    183183    },
    184184
    185     freeCachedElements: function()
    186     {
    187         this._mainPanel.freeCachedElements();
    188         this._gutterPanel.freeCachedElements();
     185    _freeCachedElements: function()
     186    {
     187        this._mainPanel._freeCachedElements();
     188        this._gutterPanel._freeCachedElements();
    189189    },
    190190
     
    522522        if (!this.readOnly())
    523523            WebInspector.markBeingEdited(this.element, false);
     524        this._freeCachedElements();
    524525    }
    525526}
     
    878879    this.element.addEventListener("scroll", this._scroll.bind(this), false);
    879880
    880     this.freeCachedElements();
     881    this._freeCachedElements();
    881882    this._buildChunks();
    882883    this._decorations = {};
     
    884885
    885886WebInspector.TextEditorGutterPanel.prototype = {
    886     freeCachedElements: function()
     887    _freeCachedElements: function()
    887888    {
    888889        this._cachedRows = [];
     
    12021203    this._container.addEventListener("DOMSubtreeModified", this._handleDOMUpdatesCallback, false);
    12031204
    1204     this.freeCachedElements();
     1205    this._freeCachedElements();
    12051206    this._buildChunks();
    12061207}
     
    13771378    },
    13781379
    1379     freeCachedElements: function()
     1380    _freeCachedElements: function()
    13801381    {
    13811382        this._cachedSpans = [];
  • trunk/Source/WebCore/inspector/front-end/Settings.js

    r124765 r125201  
    194194    this.deviceOrientationOverride = this._createExperiment("deviceOrientationOverride", "Override Device Orientation");
    195195    this.sass = this._createExperiment("sass", "Support for SASS");
     196    this.codemirror = this._createExperiment("codemirror", "Use CodeMirror editor");
    196197
    197198    this._cleanUpSetting();
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r124638 r125201  
    4343
    4444    var textEditorDelegate = new WebInspector.TextEditorDelegateForSourceFrame(this);
    45     this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate);
     45
     46    if (WebInspector.experimentsSettings.codemirror.isEnabled())
     47        this._textEditor = new WebInspector.CodeMirrorTextEditor(this._url, textEditorDelegate);
     48    else
     49        this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate);
    4650
    4751    this._currentSearchResultIndex = -1;
     
    9599    {
    96100        WebInspector.View.prototype.willHide.call(this);
    97         if (this.loaded)
    98             this._textEditor.freeCachedElements();
    99101
    100102        this._clearLineHighlight();
  • trunk/Source/WebCore/inspector/front-end/TextEditor.js

    r124638 r125201  
    8686    clearLineHighlight: function() { },
    8787
    88     freeCachedElements: function() { },
    89 
    9088    /**
    9189     * @return {Array.<Element>}
  • trunk/Source/WebCore/inspector/front-end/WebKit.qrc

    r125184 r125201  
    1616    <file>CallStackSidebarPane.js</file>
    1717    <file>Checkbox.js</file>
     18    <file>CodeMirrorTextEditor.js</file>
    1819    <file>Color.js</file>
    1920    <file>CompilerScriptMapping.js</file>
     
    205206    <file>auditsPanel.css</file>
    206207    <file>dataGrid.css</file>
     208    <file>cmdevtools.css</file>
    207209    <file>dialog.css</file>
    208210    <file>elementsPanel.css</file>
  • trunk/Source/WebCore/inspector/front-end/externs.js

    r123223 r125201  
    237237difflib.SequenceMatcher = function(baseText, newText) { }
    238238difflib.SequenceMatcher.prototype.get_opcodes = function() { return []; }
     239
     240/** @constructor */
     241WebInspector.CodeMirrorTextEditor = function(url, delegate) { }
  • trunk/Source/WebCore/inspector/front-end/inspector.html

    r124878 r125201  
    121121    <script type="text/javascript" src="TextEditor.js"></script>
    122122    <script type="text/javascript" src="DefaultTextEditor.js"></script>
     123    <script type="text/javascript" src="CodeMirrorTextEditor.js"></script>
    123124    <script type="text/javascript" src="SourceFrame.js"></script>
    124125    <script type="text/javascript" src="UISourceCodeFrame.js"></script>
Note: See TracChangeset for help on using the changeset viewer.