Changeset 83843 in webkit


Ignore:
Timestamp:
Apr 14, 2011 5:46:52 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2011-04-14 Pavel Feldman <pfeldman@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: implement incremental CSS free flow editing.
https://bugs.webkit.org/show_bug.cgi?id=58529

  • inspector/styles/get-set-stylesheet-text.html:

2011-04-14 Pavel Feldman <pfeldman@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: implement incremental CSS free flow editing.
https://bugs.webkit.org/show_bug.cgi?id=58529

  • inspector/front-end/CSSStyleModel.js: (WebInspector.CSSStyleSheet.prototype.setText):
  • inspector/front-end/Resource.js: (WebInspector.Resource.prototype.isResourceRevision): (WebInspector.Resource.prototype.setContent):
  • inspector/front-end/ResourceView.js: (WebInspector.CSSSourceFrame.prototype.isContentEditable): (WebInspector.CSSSourceFrame.prototype.editContent): (WebInspector.CSSSourceFrame.prototype.endEditing.commitIncrementalEdit): (WebInspector.CSSSourceFrame.prototype.endEditing):
  • inspector/front-end/SourceFrame.js: (WebInspector.SourceFrame.prototype.commitEditing): (WebInspector.SourceFrame.prototype.editContent):
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83840 r83843  
     12011-04-14  Pavel Feldman  <pfeldman@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: implement incremental CSS free flow editing.
     6        https://bugs.webkit.org/show_bug.cgi?id=58529
     7
     8        * inspector/styles/get-set-stylesheet-text.html:
     9
    1102011-04-14  Herczeg Zoltan  <zherczeg@webkit.org>
    211
  • trunk/LayoutTests/inspector/styles/get-set-stylesheet-text.html

    r83441 r83843  
    5252        InspectorTest.addResult("=== Original stylesheet text: ===");
    5353        InspectorTest.addResult(foundStyleSheet.getText());
    54         foundStyleSheet.setText("h1 { COLOR: Red; }", callback);
     54        foundStyleSheet.setText("h1 { COLOR: Red; }", true, callback);
    5555    }
    5656
  • trunk/Source/WebCore/ChangeLog

    r83841 r83843  
     12011-04-14  Pavel Feldman  <pfeldman@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: implement incremental CSS free flow editing.
     6        https://bugs.webkit.org/show_bug.cgi?id=58529
     7
     8        * inspector/front-end/CSSStyleModel.js:
     9        (WebInspector.CSSStyleSheet.prototype.setText):
     10        * inspector/front-end/Resource.js:
     11        (WebInspector.Resource.prototype.isResourceRevision):
     12        (WebInspector.Resource.prototype.setContent):
     13        * inspector/front-end/ResourceView.js:
     14        (WebInspector.CSSSourceFrame.prototype.isContentEditable):
     15        (WebInspector.CSSSourceFrame.prototype.editContent):
     16        (WebInspector.CSSSourceFrame.prototype.endEditing.commitIncrementalEdit):
     17        (WebInspector.CSSSourceFrame.prototype.endEditing):
     18        * inspector/front-end/SourceFrame.js:
     19        (WebInspector.SourceFrame.prototype.commitEditing):
     20        (WebInspector.SourceFrame.prototype.editContent):
     21
    1222011-04-14  Ilya Tikhonovsky  <loislo@chromium.org>
    223
  • trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js

    r82663 r83843  
    582582    },
    583583
    584     setText: function(newText, userCallback)
     584    setText: function(newText, majorChange, userCallback)
    585585    {
    586586        function callback(error, isChangeSuccessful)
     
    589589                 userCallback(isChangeSuccessful);
    590590             if (isChangeSuccessful)
    591                  WebInspector.cssModel._styleSheetChanged(this.id, true);
     591                 WebInspector.cssModel._styleSheetChanged(this.id, majorChange);
    592592        }
    593593
  • trunk/Source/WebCore/inspector/front-end/Resource.js

    r83564 r83843  
    641641    },
    642642
    643     isLocallyModified: function()
    644     {
    645         return !!this._baseRevision;
     643    isResourceRevision: function()
     644    {
     645        return !!this._actualResource;
    646646    },
    647647
     
    675675        this._content = newContent;
    676676        this.timestamp = new Date();
     677
    677678        this.dispatchEventToListeners("content-changed", data);
    678679    },
  • trunk/Source/WebCore/inspector/front-end/ResourceView.js

    r83719 r83843  
    167167    isContentEditable: function()
    168168    {
    169         return !!this._styleSheet;
     169        return !!this._styleSheet && !this._resource.isResourceRevision();
    170170    },
    171171
     
    197197    },
    198198
    199     _editContent: function(newText, callback)
     199    editContent: function(newText, callback)
    200200    {
    201201        if (!this._styleSheet) {
     
    203203            return;
    204204        }
     205
     206        this._resetIncrementalUpdateTimer();
    205207
    206208        function didSetText(success)
     
    211213            callback(error);
    212214        }
    213 
    214         this._styleSheet.setText(newText, didSetText.bind(this));
     215        this._styleSheet.setText(newText, true, didSetText.bind(this));
     216    },
     217
     218    endEditing: function(oldRange, newRange)
     219    {
     220        function commitIncrementalEdit()
     221        {
     222            var majorChange = false;
     223            this._styleSheet.setText(this._textModel.text, majorChange);
     224        }
     225        const updateTimeout = 200;
     226        this._incrementalUpdateTimer = setTimeout(commitIncrementalEdit.bind(this), updateTimeout);
     227    },
     228
     229    _resetIncrementalUpdateTimer: function()
     230    {
     231        if (this._incrementalUpdateTimer)
     232            clearTimeout(this._incrementalUpdateTimer);
     233        delete this._incrementalUpdateTimer;
    215234    }
    216235}
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r83748 r83843  
    924924            callback();
    925925        }
    926         this._editContent(this._textModel.text, didEditContent.bind(this));
    927     },
    928 
    929     _editContent: function(newContent, callback)
     926        this.editContent(this._textModel.text, didEditContent.bind(this));
     927    },
     928
     929    editContent: function(newContent, callback)
    930930    {
    931931        this._delegate.editScriptSource(newContent, callback);
Note: See TracChangeset for help on using the changeset viewer.