Changeset 83719 in webkit


Ignore:
Timestamp:
Apr 13, 2011 4:37:10 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-04-13 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: inactive style sheets should be read only.
https://bugs.webkit.org/show_bug.cgi?id=58423

  • inspector/front-end/ResourceView.js: (WebInspector.CSSSourceFrame): (WebInspector.CSSSourceFrame.prototype.isContentEditable): (WebInspector.CSSSourceFrame.prototype._loadStyleSheet.didGetAllStyleSheets.didCreateForId): (WebInspector.CSSSourceFrame.prototype._loadStyleSheet):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83718 r83719  
     12011-04-13  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: inactive style sheets should be read only.
     6        https://bugs.webkit.org/show_bug.cgi?id=58423
     7
     8        * inspector/front-end/ResourceView.js:
     9        (WebInspector.CSSSourceFrame):
     10        (WebInspector.CSSSourceFrame.prototype.isContentEditable):
     11        (WebInspector.CSSSourceFrame.prototype._loadStyleSheet.didGetAllStyleSheets.didCreateForId):
     12        (WebInspector.CSSSourceFrame.prototype._loadStyleSheet):
     13
    1142011-04-13  Mikhail Naganov  <mnaganov@chromium.org>
    215
  • trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js

    r83713 r83719  
    131131    canEditScriptSource: function(sourceFileId)
    132132    {
    133         if (!Preferences.canEditScriptSource)
     133        if (!Preferences.canEditScriptSource || this._formatSourceFiles)
    134134            return false;
    135135        var script = this._scriptForSourceFileId(sourceFileId);
  • trunk/Source/WebCore/inspector/front-end/ResourceView.js

    r83438 r83719  
    161161{
    162162    WebInspector.ResourceSourceFrame.call(this, resource);
     163    this._loadStyleSheet();
    163164}
    164165
     
    166167    isContentEditable: function()
    167168    {
    168         return true;
    169     },
    170 
    171     _editContent: function(newText, callback)
    172     {
    173         function handleStyleSheet(newText, styleSheet)
     169        return !!this._styleSheet;
     170    },
     171
     172    _loadStyleSheet: function()
     173    {
     174        function didGetAllStyleSheets(error, infos)
    174175        {
    175             this._styleSheet = styleSheet;
    176             this._saveStyleSheet(newText, callback);
    177         }
    178 
    179         function handleInfos(newText, error, infos)
    180         {
    181             if (error) {
    182                 callback(error);
     176            if (error)
    183177                return;
    184             }
    185 
     178
     179            var stylesheetId;
    186180            for (var i = 0; i < infos.length; ++i) {
    187181                var info = infos[i];
    188182                if (info.sourceURL === this._resource.url) {
    189                     WebInspector.CSSStyleSheet.createForId(info.styleSheetId, handleStyleSheet.bind(this, newText));
     183                    stylesheetId = info.styleSheetId;
    190184                    break;
    191185                }
    192186            }
    193         }
    194 
    195         if (this._styleSheet)
    196             this._saveStyleSheet(newText, callback);
    197         else
    198             CSSAgent.getAllStyleSheets(handleInfos.bind(this, newText));
    199     },
    200 
    201     _saveStyleSheet: function(newText, callback)
    202     {
     187            if (!stylesheetId)
     188                return;
     189
     190            function didCreateForId(styleSheet)
     191            {
     192                this._styleSheet = styleSheet;
     193            }
     194            WebInspector.CSSStyleSheet.createForId(stylesheetId, didCreateForId.bind(this));
     195        }
     196        CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this));
     197    },
     198
     199    _editContent: function(newText, callback)
     200    {
     201        if (!this._styleSheet) {
     202            callback("Stylesheet not found.");
     203            return;
     204        }
     205
    203206        function didSetText(success)
    204207        {
Note: See TracChangeset for help on using the changeset viewer.