Title: [111682] trunk/Source/WebCore
Revision
111682
Author
pfeld...@chromium.org
Date
2012-03-22 06:25:59 -0700 (Thu, 22 Mar 2012)

Log Message

Web Inspector: make CSS and _javascript_ files editable by default.
https://bugs.webkit.org/show_bug.cgi?id=81787

Reviewed by Vsevolod Vlasov.

This change removes cancelEditing and setReadOnly capabilities from source frame.
It removes dblclick handler as well since one does not need to enter editing mode.
It also establishes proper content dispatching so that views are updated with the
resource content. All these are inter-dependent, need to be landed simultaneously.
Drive-by follow up to the r111675 where range is modified prior to the exiting
edit mode.

* inspector/front-end/_javascript_SourceFrame.js:
(WebInspector._javascript_SourceFrame):
(WebInspector._javascript_SourceFrame.prototype.requestContent):
(WebInspector._javascript_SourceFrame.prototype.afterTextChanged):
(WebInspector._javascript_SourceFrame.prototype.beforeTextChanged):
(WebInspector._javascript_SourceFrame.prototype.didEditContent):
(WebInspector._javascript_SourceFrame.prototype._lineNumberAfterEditing):
* inspector/front-end/ResourceView.js:
(WebInspector.ResourceSourceFrame):
(WebInspector.ResourceSourceFrame.prototype.suggestedFileName):
(WebInspector.ResourceSourceFrame.prototype._contentChanged):
(WebInspector.EditableResourceSourceFrame.prototype.canEditSource):
(WebInspector.EditableResourceSourceFrame.prototype.editContent.callbackWrapper):
(WebInspector.EditableResourceSourceFrame.prototype.editContent):
(WebInspector.EditableResourceSourceFrame.prototype._contentChanged):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype._innerShowView):
(WebInspector.FrameResourceTreeElement.prototype._appendRevision):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.setScriptSourceIsDirty):
* inspector/front-end/Settings.js:
(WebInspector.ExperimentsSettings):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
(WebInspector.SourceFrame.prototype.wasShown):
(WebInspector.SourceFrame.prototype.willHide):
(WebInspector.SourceFrame.prototype.beforeTextChanged):
(WebInspector.SourceFrame.prototype.setContent):
(WebInspector.SourceFrame.prototype.commitEditing):
(WebInspector.SourceFrame.prototype.didEditContent):
(WebInspector.SourceFrame.prototype.editContent):
* inspector/front-end/TextPrompt.js:
(WebInspector.TextPrompt.prototype._startEditing):
(WebInspector.TextPrompt.prototype._stopEditing):
* inspector/front-end/TextViewer.js:
(WebInspector.TextViewer):
(WebInspector.TextViewer.prototype._registerShortcuts):
(WebInspector.TextEditorMainPanel.prototype.handleEnterKey):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111681 => 111682)


--- trunk/Source/WebCore/ChangeLog	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/ChangeLog	2012-03-22 13:25:59 UTC (rev 111682)
@@ -1,3 +1,56 @@
+2012-03-22  Pavel Feldman  <pfeld...@chromium.org>
+
+        Web Inspector: make CSS and _javascript_ files editable by default.
+        https://bugs.webkit.org/show_bug.cgi?id=81787
+
+        Reviewed by Vsevolod Vlasov.
+
+        This change removes cancelEditing and setReadOnly capabilities from source frame.
+        It removes dblclick handler as well since one does not need to enter editing mode.
+        It also establishes proper content dispatching so that views are updated with the
+        resource content. All these are inter-dependent, need to be landed simultaneously.
+        Drive-by follow up to the r111675 where range is modified prior to the exiting
+        edit mode.
+
+        * inspector/front-end/_javascript_SourceFrame.js:
+        (WebInspector._javascript_SourceFrame):
+        (WebInspector._javascript_SourceFrame.prototype.requestContent):
+        (WebInspector._javascript_SourceFrame.prototype.afterTextChanged):
+        (WebInspector._javascript_SourceFrame.prototype.beforeTextChanged):
+        (WebInspector._javascript_SourceFrame.prototype.didEditContent):
+        (WebInspector._javascript_SourceFrame.prototype._lineNumberAfterEditing):
+        * inspector/front-end/ResourceView.js:
+        (WebInspector.ResourceSourceFrame):
+        (WebInspector.ResourceSourceFrame.prototype.suggestedFileName):
+        (WebInspector.ResourceSourceFrame.prototype._contentChanged):
+        (WebInspector.EditableResourceSourceFrame.prototype.canEditSource):
+        (WebInspector.EditableResourceSourceFrame.prototype.editContent.callbackWrapper):
+        (WebInspector.EditableResourceSourceFrame.prototype.editContent):
+        (WebInspector.EditableResourceSourceFrame.prototype._contentChanged):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel.prototype._innerShowView):
+        (WebInspector.FrameResourceTreeElement.prototype._appendRevision):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.setScriptSourceIsDirty):
+        * inspector/front-end/Settings.js:
+        (WebInspector.ExperimentsSettings):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame):
+        (WebInspector.SourceFrame.prototype.wasShown):
+        (WebInspector.SourceFrame.prototype.willHide):
+        (WebInspector.SourceFrame.prototype.beforeTextChanged):
+        (WebInspector.SourceFrame.prototype.setContent):
+        (WebInspector.SourceFrame.prototype.commitEditing):
+        (WebInspector.SourceFrame.prototype.didEditContent):
+        (WebInspector.SourceFrame.prototype.editContent):
+        * inspector/front-end/TextPrompt.js:
+        (WebInspector.TextPrompt.prototype._startEditing):
+        (WebInspector.TextPrompt.prototype._stopEditing):
+        * inspector/front-end/TextViewer.js:
+        (WebInspector.TextViewer):
+        (WebInspector.TextViewer.prototype._registerShortcuts):
+        (WebInspector.TextEditorMainPanel.prototype.handleEnterKey):
+
 2012-03-22  Allan Sandfeld Jensen  <allan.jen...@nokia.com>
 
         [Qt] Enable FAST_MOBILE_SCROLLING when scrolling is delegated.

Modified: trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js (111681 => 111682)


--- trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -48,6 +48,7 @@
             this._getPopoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), this._onHidePopover.bind(this), true);
 
     this.textViewer.element.addEventListener("mousedown", this._onMouseDown.bind(this), true);
+    this.textViewer.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
     this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this);
     this.addEventListener(WebInspector.SourceFrame.Events.Loaded, this._onTextViewerContentLoaded, this);
 }
@@ -68,7 +69,12 @@
     // SourceFrame overrides
     requestContent: function(callback)
     {
-        this._uiSourceCode.requestContent(callback);
+        function mycallback(mimeType, content)
+        {
+            this._originalContent = content;
+            callback(mimeType, content);
+        }
+        this._uiSourceCode.requestContent(mycallback.bind(this));
     },
 
     canEditSource: function()
@@ -83,25 +89,16 @@
 
     editContent: function(newContent, callback)
     {
+        this._editingContent = true;
         this._model.setScriptSource(this._uiSourceCode, newContent, callback);
     },
 
     _onContentChanged: function()
     {
-        if (!this.textViewer.readOnly)
-            return;
-        this.requestContent(this.setContent.bind(this));
+        if (this._editingContent)
+            this.requestContent(this.setContent.bind(this));
     },
 
-    setReadOnly: function(readOnly)
-    {
-        if (this._popoverHelper && !readOnly)
-            this._popoverHelper.hidePopover();
-        WebInspector.SourceFrame.prototype.setReadOnly.call(this, readOnly);
-        if (readOnly)
-            this._scriptsPanel.setScriptSourceIsBeingEdited(this._uiSourceCode, false);
-    },
-
     populateLineGutterContextMenu: function(contextMenu, lineNumber)
     {
         contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Continue to here" : "Continue to Here"), this._model.continueToLine.bind(this._model, this._uiSourceCode, lineNumber));
@@ -186,6 +183,8 @@
                 this.addBreakpoint(newLineNumber, breakpoint.resolved, breakpoint.conditional, breakpoint.enabled);
             }
         }
+
+        this._scriptsPanel.setScriptSourceIsDirty(this._uiSourceCode, this.textModel.copyRange() !== this._originalContent);
     },
 
     beforeTextChanged: function()
@@ -195,48 +194,18 @@
                 executionLineNumber: this._executionLineNumber,
                 breakpoints: this._breakpoints
             }
-            this._scriptsPanel.setScriptSourceIsBeingEdited(this._uiSourceCode, true);
         }
         WebInspector.SourceFrame.prototype.beforeTextChanged.call(this);
     },
 
-    cancelEditing: function()
+    didEditContent: function(error, content)
     {
-        if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
-            return false;
-
-        WebInspector.SourceFrame.prototype.cancelEditing.call(this);
-
-        if (!this._javaScriptSourceFrameState)
-            return true;
-
-        if (typeof this._javaScriptSourceFrameState.executionLineNumber === "number") {
-            this.clearExecutionLine();
-            this.setExecutionLine(this._javaScriptSourceFrameState.executionLineNumber);
-        }
-
-        var oldBreakpoints = this._breakpoints;
-        this._breakpoints = {};
-        for (var lineNumber in oldBreakpoints)
-            this.removeBreakpoint(Number(lineNumber));
-
-        var newBreakpoints = this._javaScriptSourceFrameState.breakpoints;
-        for (var lineNumber in newBreakpoints) {
-            lineNumber = Number(lineNumber);
-            var breakpoint = newBreakpoints[lineNumber];
-            this.addBreakpoint(lineNumber, breakpoint.resolved, breakpoint.conditional, breakpoint.enabled);
-        }
-
-        delete this._javaScriptSourceFrameState;
-        return true;
-    },
-
-    didEditContent: function(error)
-    {
-        WebInspector.SourceFrame.prototype.didEditContent.call(this, error);
+        delete this._editingContent;
+        WebInspector.SourceFrame.prototype.didEditContent.call(this, error, content);
         if (error)
             return;
 
+        this._originalContent = content;
         var newBreakpoints = {};
         for (var lineNumber in this._breakpoints) {
             newBreakpoints[lineNumber] = this._breakpoints[lineNumber];
@@ -250,7 +219,7 @@
             var breakpoint = newBreakpoints[lineNumber];
             this._setBreakpoint(Number(lineNumber), breakpoint.condition, breakpoint.enabled);
         }
-        this._scriptsPanel.setScriptSourceIsBeingEdited(this._uiSourceCode, false);
+        this._scriptsPanel.setScriptSourceIsDirty(this._uiSourceCode, false);
         delete this._javaScriptSourceFrameState;
     },
 
@@ -490,7 +459,7 @@
         if (lineNumber === oldRange.startLine) {
             var whiteSpacesRegex = /^[\s\xA0]*$/;
             for (var i = 0; lineNumber + i <= newRange.endLine; ++i) {
-                if (!whiteSpacesRegex.test(this._textModel.line(lineNumber + i))) {
+                if (!whiteSpacesRegex.test(this.textModel.line(lineNumber + i))) {
                     shiftOffset = i;
                     break;
                 }

Modified: trunk/Source/WebCore/inspector/front-end/ResourceView.js (111681 => 111682)


--- trunk/Source/WebCore/inspector/front-end/ResourceView.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/ResourceView.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -84,6 +84,7 @@
 {
     this._resource = resource;
     WebInspector.SourceFrame.call(this, resource.url);
+    this._resource.addEventListener(WebInspector.Resource.Events.RevisionAdded, this._contentChanged, this);
 }
 
 //This is a map from resource.type to mime types
@@ -118,6 +119,11 @@
     suggestedFileName: function()
     {
         return this.resource.displayName;
+    },
+
+    _contentChanged: function(event)
+    {
+        this.setContent(WebInspector.ResourceSourceFrame.mimeTypeForResource[this._resource], this._resource.content);
     }
 }
 
@@ -135,29 +141,23 @@
 WebInspector.EditableResourceSourceFrame.prototype = {
     canEditSource: function()
     {
-        return this.resource.isEditable() && !this._commitEditingInProgress;
+        //FIXME: make live edit stop using resource content binding.
+        return this._resource.isEditable() && this._resource.type === WebInspector.Resource.Type.Stylesheet;
     },
 
     editContent: function(newText, callback)
     {
         this._clearIncrementalUpdateTimer();
         var majorChange = true;
-        this.resource.setContent(newText, majorChange, callback);
+        this._settingContent = true;
+        function callbackWrapper(text)
+        {
+            callback(text);
+            delete this._settingContent;
+        }
+        this.resource.setContent(newText, majorChange, callbackWrapper.bind(this));
     },
 
-    cancelEditing: function()
-    {
-        if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
-            return false;
-
-        this._clearIncrementalUpdateTimer();
-        const majorChange = false;
-        if (this._viewerState)
-            this.resource.setContent(this._viewerState.textModelContent, majorChange);
-        WebInspector.SourceFrame.prototype.cancelEditing.call(this);
-        return true;
-    },
-
     afterTextChanged: function(oldRange, newRange)
     {
         function commitIncrementalEdit()
@@ -175,6 +175,12 @@
             clearTimeout(this._incrementalUpdateTimer);
         delete this._incrementalUpdateTimer;
     },
+
+    _contentChanged: function(event)
+    {
+        if (!this._settingContent)
+            WebInspector.ResourceSourceFrame.prototype._contentChanged.call(this, event);
+    }
 }
 
 WebInspector.EditableResourceSourceFrame.prototype.__proto__ = WebInspector.ResourceSourceFrame.prototype;

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (111681 => 111682)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -513,6 +513,9 @@
 
     _innerShowView: function(view)
     {
+        if (this.visibleView === view)
+            return;
+
         if (this.visibleView)
             this.visibleView.detach();
 
@@ -1381,13 +1384,8 @@
     _appendRevision: function(revision)
     {
         this.insertChild(new WebInspector.ResourceRevisionTreeElement(this._storagePanel, revision), 0);
-        var oldView = this._sourceView;
-        if (oldView) {
-            // This is needed when resource content was changed from scripts panel.
-            var newView = this._recreateSourceView();
-            if (oldView === this._storagePanel.visibleView)
-                this._storagePanel._showResourceView(this._resource);
-        }
+        if (this._sourceView === this._storagePanel.visibleView)
+            this._storagePanel._showResourceView(this._resource);
     },
 
     sourceView: function()

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (111681 => 111682)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -284,12 +284,12 @@
 
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
-     * @param {boolean} inEditMode
+     * @param {boolean} isDirty
      */
-    setScriptSourceIsBeingEdited: function(uiSourceCode, inEditMode)
+    setScriptSourceIsDirty: function(uiSourceCode, isDirty)
     {
-        this._fileSelector.setScriptSourceIsDirty(uiSourceCode, inEditMode);
-        this._editorContainer.setFileIsDirty(uiSourceCode, inEditMode);
+        this._fileSelector.setScriptSourceIsDirty(uiSourceCode, isDirty);
+        this._editorContainer.setFileIsDirty(uiSourceCode, isDirty);
     },
 
     _consoleMessagesCleared: function()

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


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -174,7 +174,6 @@
     this._enabledForTest = {};
     
     // Add currently running experiments here.
-    this.sourceFrameAlwaysEditable = this._createExperiment("sourceFrameAlwaysEditable", "Make resources always editable");
     this.timelineVerticalOverview = this._createExperiment("timelineStartAtZero", "Enable vertical overview mode in the Timeline panel");
     // FIXME: Enable http/tests/inspector/indexeddb/resources-panel.html when removed from experiments.
     this.showIndexedDB = this._createExperiment("showIndexedDB", "Show IndexedDB in Resources panel");

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


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -44,9 +44,6 @@
     var textViewerDelegate = new WebInspector.TextViewerDelegateForSourceFrame(this);
     this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform(), this._url, textViewerDelegate);
 
-    this._editButton = new WebInspector.StatusBarButton(WebInspector.UIString("Edit"), "edit-source-status-bar-item");
-    this._editButton.addEventListener("click", this._editButtonClicked.bind(this), this);
-
     this._currentSearchResultIndex = -1;
     this._searchResults = [];
 
@@ -54,8 +51,7 @@
     this._rowMessages = {};
     this._messageBubbles = {};
 
-    if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
-        this.startEditing();
+    this._textViewer.readOnly = !this.canEditSource();
 }
 
 WebInspector.SourceFrame.Events = {
@@ -86,8 +82,6 @@
     {
         this._ensureContentLoaded();
         this._textViewer.show(this.element);
-        if (this._wasHiddenWhileEditing)
-            this.setReadOnly(false);
     },
 
     willHide: function()
@@ -98,10 +92,6 @@
 
         this._clearLineHighlight();
         this._clearLineToReveal();
-        
-        if (!this._textViewer.readOnly)
-            this._wasHiddenWhileEditing = true;
-        this.setReadOnly(true);
     },
 
     focus: function()
@@ -109,11 +99,6 @@
         this._textViewer.focus();
     },
 
-    get statusBarItems()
-    {
-        return WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled() ? [] : [this._editButton.element];
-    },
-
     get loaded()
     {
         return this._loaded;
@@ -216,33 +201,8 @@
         delete this._lineToReveal;
     },
 
-    _saveViewerState: function()
-    {
-        this._viewerState = {
-            textModelContent: this._textModel.text,
-            messages: this._messages,
-            diffLines: this._diffLines,
-        };
-    },
-
-    _restoreViewerState: function()
-    {
-        if (!this._viewerState)
-            return;
-        this._textModel.setText(null, this._viewerState.textModelContent);
-
-        this._messages = this._viewerState.messages;
-        this._diffLines = this._viewerState.diffLines;
-        this._setTextViewerDecorations();
-
-        delete this._viewerState;
-    },
-
     beforeTextChanged: function()
     {
-        if (!this._viewerState)
-            this._saveViewerState();
-
         WebInspector.searchController.cancelSearch();
         this.clearMessages();
     },
@@ -280,9 +240,6 @@
         this.dispatchEventToListeners(WebInspector.SourceFrame.Events.Loaded);
 
         this._textViewer.endUpdates();
-
-        if (!this.canEditSource())
-            this._editButton.disabled = true;
     },
 
     _setTextViewerDecorations: function()
@@ -530,88 +487,31 @@
         this._textViewer.inheritScrollPositions(sourceFrame._textViewer);
     },
 
-    _editButtonClicked: function()
-    {
-        if (!this.canEditSource())
-            return;
-
-        const shouldStartEditing = !this._editButton.toggled;
-        if (shouldStartEditing)
-            this.startEditing();
-        else
-            this.commitEditing();
-    },
-
     canEditSource: function()
     {
         return false;
     },
 
-    startEditing: function()
-    {
-        if (!this.canEditSource())
-            return false;
-
-        if (this._commitEditingInProgress)
-            return false;
-
-        this.setReadOnly(false);
-        return true;
-    },
-
     commitEditing: function()
     {
-        if (!this._viewerState) {
-            // No editing was actually done.
-            this.setReadOnly(true);
-            return;
+        function callback(error)
+        {
+            this.didEditContent(error, this._textModel.text);
         }
-
-        this._commitEditingInProgress = true;
-        this._textViewer.readOnly = true;
-        this._editButton.toggled = false;
-        this.editContent(this._textModel.text, this.didEditContent.bind(this));
+        this.editContent(this._textModel.text, callback.bind(this));
     },
 
-    didEditContent: function(error)
+    didEditContent: function(error, content)
     {
-        this._commitEditingInProgress = false;
-        this._textViewer.readOnly = false;
-
         if (error) {
             if (error.message)
                 WebInspector.log(error.message, WebInspector.ConsoleMessage.MessageLevel.Error, true);
             return;
         }
-
-        delete this._viewerState;
     },
 
     editContent: function(newContent, callback)
     {
-    },
-
-    cancelEditing: function()
-    {
-        if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
-            return false;
-
-        this._restoreViewerState();
-        this.setReadOnly(true);
-        return true;
-    },
-
-    get readOnly()
-    {
-        return this._textViewer.readOnly;
-    },
-
-    setReadOnly: function(readOnly)
-    {
-        if (readOnly && WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
-            return;
-        this._textViewer.readOnly = readOnly;
-        this._editButton.toggled = !readOnly;
     }
 }
 
@@ -628,11 +528,6 @@
 }
 
 WebInspector.TextViewerDelegateForSourceFrame.prototype = {
-    doubleClick: function(lineNumber)
-    {
-        this._sourceFrame.startEditing(lineNumber);
-    },
-
     beforeTextChanged: function()
     {
         this._sourceFrame.beforeTextChanged();
@@ -648,11 +543,6 @@
         this._sourceFrame.commitEditing();
     },
 
-    cancelEditing: function()
-    {
-        return this._sourceFrame.cancelEditing();
-    },
-
     populateLineGutterContextMenu: function(contextMenu, lineNumber)
     {
         this._sourceFrame.populateLineGutterContextMenu(contextMenu, lineNumber);

Modified: trunk/Source/WebCore/inspector/front-end/TextPrompt.js (111681 => 111682)


--- trunk/Source/WebCore/inspector/front-end/TextPrompt.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/TextPrompt.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -161,8 +161,6 @@
 
     _startEditing: function(blurListener)
     {
-        if (!WebInspector.markBeingEdited(this._element, true))
-            return;
         this._isEditing = true;
         this._element.addStyleClass("editing");
         if (blurListener) {
@@ -182,7 +180,6 @@
             this._element.removeEventListener("blur", this._blurListener, false);
         this._element.removeStyleClass("editing");
         delete this._isEditing;
-        WebInspector.markBeingEdited(this._element, false);
     },
 
     _removeSuggestionAids: function()

Modified: trunk/Source/WebCore/inspector/front-end/TextViewer.js (111681 => 111682)


--- trunk/Source/WebCore/inspector/front-end/TextViewer.js	2012-03-22 13:24:25 UTC (rev 111681)
+++ trunk/Source/WebCore/inspector/front-end/TextViewer.js	2012-03-22 13:25:59 UTC (rev 111682)
@@ -68,7 +68,6 @@
     }
     this._gutterPanel.element.addEventListener("mousewheel", forwardWheelEvent.bind(this), false);
 
-    this.element.addEventListener("dblclick", this._doubleClick.bind(this), true);
     this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
     this.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
 
@@ -247,19 +246,6 @@
         }
     },
 
-    _doubleClick: function(event)
-    {
-        if (!this.readOnly)
-            return;
-
-        var lineRow = event.target.enclosingNodeOrSelfWithClass("webkit-line-content");
-        if (!lineRow)
-            return;  // Do not trigger editing from line numbers.
-
-        this._delegate.doubleClick(lineRow.lineNumber);
-        window.getSelection().collapseToStart();
-    },
-
     _registerShortcuts: function()
     {
         var keys = WebInspector.KeyboardShortcut.Keys;
@@ -267,10 +253,7 @@
 
         this._shortcuts = {};
         var commitEditing = this._commitEditing.bind(this);
-        var cancelEditing = this._cancelEditing.bind(this);
         this._shortcuts[WebInspector.KeyboardShortcut.makeKey("s", modifiers.CtrlOrMeta)] = commitEditing;
-        this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Enter.code, modifiers.CtrlOrMeta)] = commitEditing;
-        this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Esc.code)] = cancelEditing;
 
         var handleEnterKey = this._mainPanel.handleEnterKey.bind(this._mainPanel);
         this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Enter.code, WebInspector.KeyboardShortcut.Modifiers.None)] = handleEnterKey;
@@ -323,14 +306,6 @@
         return true;
     },
 
-    _cancelEditing: function()
-    {
-        if (this.readOnly)
-            return false;
-
-        return this._delegate.cancelEditing();
-    },
-
     wasShown: function()
     {
         if (!this.readOnly)
@@ -354,16 +329,12 @@
 }
 
 WebInspector.TextViewerDelegate.prototype = {
-    doubleClick: function(lineNumber) { },
-
     beforeTextChanged: function() { },
 
     afterTextChanged: function(oldRange, newRange) { },
 
     commitEditing: function() { },
 
-    cancelEditing: function() { },
-
     populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
 
     populateTextAreaContextMenu: function(contextMenu, lineNumber) { },
@@ -1197,11 +1168,9 @@
         } else
             newRange = this._setText(range, lineBreak + indent);
 
-        newRange = newRange.collapseToEnd();
-
         this._exitTextChangeMode(range, newRange);
         this.endUpdates();
-        this._restoreSelection(newRange, true);
+        this._restoreSelection(newRange.collapseToEnd(), true);
 
         return true;
     },
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to