Changeset 122482 in webkit


Ignore:
Timestamp:
Jul 12, 2012 10:59:02 AM (12 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: Simplify UISourceCode code after moving revisions support inside it.
https://bugs.webkit.org/show_bug.cgi?id=91118

Reviewed by Pavel Feldman.

  • inspector/front-end/UISourceCode.js:

(WebInspector.UISourceCode.prototype._setContent):
(WebInspector.UISourceCode.prototype.revertToOriginal):
(WebInspector.UISourceCode.prototype.revertAndClearHistory):
(WebInspector.UISourceCode.prototype.contentChanged):
(WebInspector.UISourceCode.prototype.commitWorkingCopy):
(WebInspector.Revision.prototype.revertToThis):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122474 r122482  
     12012-07-12  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Simplify UISourceCode code after moving revisions support inside it.
     4        https://bugs.webkit.org/show_bug.cgi?id=91118
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/UISourceCode.js:
     9        (WebInspector.UISourceCode.prototype._setContent):
     10        (WebInspector.UISourceCode.prototype.revertToOriginal):
     11        (WebInspector.UISourceCode.prototype.revertAndClearHistory):
     12        (WebInspector.UISourceCode.prototype.contentChanged):
     13        (WebInspector.UISourceCode.prototype.commitWorkingCopy):
     14        (WebInspector.Revision.prototype.revertToThis):
     15
    1162012-07-12  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
    217
  • trunk/Source/WebCore/inspector/front-end/UISourceCode.js

    r122454 r122482  
    150150    /**
    151151     * @param {string} newContent
    152      * @param {function(?string)} callback
    153      */
    154     _setContent: function(newContent, callback)
    155     {
    156         if (!this.isEditable())
    157             return;
     152     */
     153    _setContent: function(newContent)
     154    {
    158155        this.setWorkingCopy(newContent);
    159         this.commitWorkingCopy(callback);
     156        this.commitWorkingCopy(function() {});
    160157    },
    161158
     
    207204    revertToOriginal: function()
    208205    {
     206        /**
     207         * @param {?string} content
     208         * @param {boolean} contentEncoded
     209         * @param {string} mimeType
     210         */
     211      function callback(content, contentEncoded, mimeType)
     212        {
     213            this._setContent();
     214        }
     215
     216        this.requestOriginalContent(callback.bind(this));
     217    },
     218
     219    revertAndClearHistory: function(callback)
     220    {
    209221        function revert(content)
    210222        {
    211             this._setContent(content, function() {});
    212         }
    213         this.requestOriginalContent(revert.bind(this));
    214     },
    215 
    216     revertAndClearHistory: function(callback)
    217     {
    218         function revert(content)
    219         {
    220             this._setContent(content, clearHistory.bind(this));
    221         }
    222 
    223         function clearHistory()
    224         {
     223            this._setContent(content);
    225224            this._clearRevisionHistory();
    226225            this.history = [];
     
    237236    contentChanged: function(newContent, mimeType)
    238237    {
    239         if (this._committingWorkingCopy)
    240             return;
    241 
    242238        this._content = newContent;
    243239        this._mimeType = mimeType;
     
    295291
    296292        var newContent = this._workingCopy;
    297         this._committingWorkingCopy = true;
    298293        this.workingCopyCommitted(callback);
    299294        this.addRevision(newContent);
    300         delete this._committingWorkingCopy;
    301         this.contentChanged(newContent, this._mimeType);
    302 
    303295    },
    304296
     
    620612        {
    621613            if (this._uiSourceCode._content !== content)
    622                 this._uiSourceCode._setContent(content, function() {});
     614                this._uiSourceCode._setContent(content);
    623615        }
    624616        this.requestContent(revert.bind(this));
Note: See TracChangeset for help on using the changeset viewer.