Changeset 116848 in webkit


Ignore:
Timestamp:
May 12, 2012 4:09:27 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: shrink SourceFrame editing API to two methods (was 4).
https://bugs.webkit.org/show_bug.cgi?id=86288

Reviewed by Yury Semikhatsky.

Used specific workflow in two SourceFrame implementations.

  • inspector/front-end/JavaScriptSourceFrame.js:

(WebInspector.JavaScriptSourceFrame.prototype.commitEditing):
(WebInspector.JavaScriptSourceFrame.prototype.afterTextChanged):
(WebInspector.JavaScriptSourceFrame.prototype._didEditContent):

  • inspector/front-end/ResourceView.js:

(WebInspector.EditableResourceSourceFrame.prototype.commitEditing.callbackWrapper):
(WebInspector.EditableResourceSourceFrame.prototype.commitEditing):

  • inspector/front-end/SourceFrame.js:

(WebInspector.SourceFrame.prototype.commitEditing):
(WebInspector.TextViewerDelegateForSourceFrame.prototype.commitEditing):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116847 r116848  
     12012-05-12  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: shrink SourceFrame editing API to two methods (was 4).
     4        https://bugs.webkit.org/show_bug.cgi?id=86288
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Used specific workflow in two SourceFrame implementations.
     9
     10        * inspector/front-end/JavaScriptSourceFrame.js:
     11        (WebInspector.JavaScriptSourceFrame.prototype.commitEditing):
     12        (WebInspector.JavaScriptSourceFrame.prototype.afterTextChanged):
     13        (WebInspector.JavaScriptSourceFrame.prototype._didEditContent):
     14        * inspector/front-end/ResourceView.js:
     15        (WebInspector.EditableResourceSourceFrame.prototype.commitEditing.callbackWrapper):
     16        (WebInspector.EditableResourceSourceFrame.prototype.commitEditing):
     17        * inspector/front-end/SourceFrame.js:
     18        (WebInspector.SourceFrame.prototype.commitEditing):
     19        (WebInspector.TextViewerDelegateForSourceFrame.prototype.commitEditing):
     20
    1212012-05-11  Yury Semikhatsky  <yurys@chromium.org>
    222
  • trunk/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js

    r116791 r116848  
    109109    },
    110110
    111     editContent: function(newContent, callback)
     111    /**
     112     * @param {string} text
     113     */
     114    commitEditing: function(text)
    112115    {
    113116        this._editingContent = true;
    114         WebInspector.DebuggerResourceBinding.setScriptSource(this._uiSourceCode, newContent, callback);
     117        WebInspector.DebuggerResourceBinding.setScriptSource(this._uiSourceCode, text, this._didEditContent.bind(this, text));
    115118    },
    116119
     
    174177            this._setScriptSourceIsDirty(true);
    175178        else
    176             this.didEditContent(null, this._originalContent);
     179            this._didEditContent(this._originalContent, null);
    177180    },
    178181
     
    201204    },
    202205
    203     didEditContent: function(error, content)
     206    _didEditContent: function(content, error)
    204207    {
    205208        delete this._editingContent;
    206209
    207         WebInspector.SourceFrame.prototype.didEditContent.call(this, error, content);
    208         if (error)
    209             return;
     210        if (error) {
     211            WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
     212            return;
     213        }
    210214
    211215        this._originalContent = content;
  • trunk/Source/WebCore/inspector/front-end/ResourceView.js

    r115984 r116848  
    133133
    134134WebInspector.EditableResourceSourceFrame.prototype = {
     135    /**
     136     * @return {boolean}
     137     */
    135138    canEditSource: function()
    136139    {
     
    139142    },
    140143
    141     editContent: function(newText, callback)
     144    /**
     145     * @param {string} text
     146     */
     147    commitEditing: function(text)
    142148    {
    143149        this._clearIncrementalUpdateTimer();
     
    146152        function callbackWrapper(text)
    147153        {
    148             callback(text);
    149154            delete this._settingContent;
     155            this.dispatchEventToListeners(WebInspector.EditableResourceSourceFrame.Events.TextEdited, this);
    150156        }
    151         this.resource.setContent(newText, majorChange, callbackWrapper.bind(this));
    152     },
    153 
     157        this.resource.setContent(text, majorChange, callbackWrapper.bind(this));
     158    },
     159   
    154160    afterTextChanged: function(oldRange, newRange)
    155161    {
     
    177183    },
    178184
    179     didEditContent: function(error, content)
    180     {
    181         WebInspector.SourceFrame.prototype.didEditContent.call(this, error, content);
    182         this.dispatchEventToListeners(WebInspector.EditableResourceSourceFrame.Events.TextEdited, this);
    183     },
    184 
    185185    isDirty: function()
    186186    {
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r116789 r116848  
    517517    },
    518518
     519    /**
     520     * @return {boolean}
     521     */
    519522    canEditSource: function()
    520523    {
     
    522525    },
    523526
    524     commitEditing: function()
    525     {
    526         function callback(error)
    527         {
    528             this.didEditContent(error, this._textModel.text);
    529         }
    530         this.editContent(this._textModel.text, callback.bind(this));
    531     },
    532 
    533     didEditContent: function(error, content)
    534     {
    535         if (error) {
    536             WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
    537             return;
    538         }
    539     },
    540 
    541     editContent: function(newContent, callback)
     527    /**
     528     * @param {string} text
     529     */
     530    commitEditing: function(text)
    542531    {
    543532    }
     
    569558    commitEditing: function()
    570559    {
    571         this._sourceFrame.commitEditing();
     560        this._sourceFrame.commitEditing(this._sourceFrame._textModel.text);
    572561    },
    573562
Note: See TracChangeset for help on using the changeset viewer.