2010-11-24 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Nov 2010 18:06:12 +0000 (18:06 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Nov 2010 18:06:12 +0000 (18:06 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: place local modifications to under original
        resource nodes in the resource panel.
        https://bugs.webkit.org/show_bug.cgi?id=50029

        * English.lproj/localizedStrings.js:
        * inspector/Inspector.idl:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest):
        (WebCore::InspectorController::scriptImported):
        * inspector/InspectorResourceAgent.cpp:
        (WebCore::InspectorResourceAgent::setInitialContent):
        * inspector/InspectorResourceAgent.h:
        * inspector/front-end/CSSStyleModel.js:
        (WebInspector.CSSStyleModel.prototype.setRuleSelector):
        (WebInspector.CSSStyleModel.prototype.addRule):
        (WebInspector.CSSStyleModel.prototype._styleSheetChanged.callback):
        (WebInspector.CSSStyleModel.prototype._styleSheetChanged):
        (WebInspector.CSSStyleDeclaration.prototype.insertPropertyAt):
        (WebInspector.CSSProperty.prototype.setText):
        (WebInspector.CSSProperty.prototype.setDisabled.callback):
        (WebInspector.CSSProperty.prototype.setDisabled):
        (WebInspector.CSSStyleSheet.prototype.setText):
        * inspector/front-end/NetworkPanel.js:
        (WebInspector.NetworkPanel.prototype.refreshResource):
        * inspector/front-end/Resource.js:
        (WebInspector.Resource.prototype.set content):
        (WebInspector.Resource.prototype.get contentTimestamp):
        (WebInspector.Resource.prototype.setInitialContent):
        * inspector/front-end/ResourceManager.js:
        (WebInspector.ResourceManager):
        (WebInspector.ResourceManager.prototype.setInitialContent):
        * inspector/front-end/ResourcesPanel.js:
        (WebInspector.ResourcesPanel):
        (WebInspector.ResourcesPanel.prototype.reset):
        (WebInspector.ResourcesPanel.prototype._innerShowView):
        (WebInspector.FrameResourceTreeElement):
        (WebInspector.FrameResourceTreeElement.prototype._errorsWarningsUpdated):
        (WebInspector.FrameResourceTreeElement.prototype._contentChanged.else.finished):
        (WebInspector.FrameResourceTreeElement.prototype._contentChanged):
        (WebInspector.ResourceRevisionTreeElement):
        * inspector/front-end/SourceFrame.js:
        (WebInspector.SourceFrame.prototype.get scrollTop):
        (WebInspector.SourceFrame.prototype.set scrollTop):
        * inspector/front-end/SourceView.js:
        (WebInspector.SourceView.prototype.get scrollTop):
        (WebInspector.SourceView.prototype.set scrollTop):
        (WebInspector.SourceView.prototype._editLine):
        (WebInspector.SourceView.prototype._editLineComplete):
        * inspector/front-end/StylesSidebarPane.js:
        (WebInspector.StylePropertyTreeElement.prototype):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72684 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
WebCore/ChangeLog
WebCore/English.lproj/localizedStrings.js
WebCore/inspector/Inspector.idl
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorResourceAgent.cpp
WebCore/inspector/InspectorResourceAgent.h
WebCore/inspector/front-end/CSSStyleModel.js
WebCore/inspector/front-end/NetworkPanel.js
WebCore/inspector/front-end/Resource.js
WebCore/inspector/front-end/ResourceManager.js
WebCore/inspector/front-end/ResourcesPanel.js
WebCore/inspector/front-end/SourceFrame.js
WebCore/inspector/front-end/SourceView.js
WebCore/inspector/front-end/StylesSidebarPane.js

index a3ffc21..fcc74ab 100644 (file)
@@ -1,3 +1,58 @@
+2010-11-24  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: place local modifications to under original
+        resource nodes in the resource panel.
+        https://bugs.webkit.org/show_bug.cgi?id=50029
+
+        * English.lproj/localizedStrings.js:
+        * inspector/Inspector.idl:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest):
+        (WebCore::InspectorController::scriptImported):
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::setInitialContent):
+        * inspector/InspectorResourceAgent.h:
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSStyleModel.prototype.setRuleSelector):
+        (WebInspector.CSSStyleModel.prototype.addRule):
+        (WebInspector.CSSStyleModel.prototype._styleSheetChanged.callback):
+        (WebInspector.CSSStyleModel.prototype._styleSheetChanged):
+        (WebInspector.CSSStyleDeclaration.prototype.insertPropertyAt):
+        (WebInspector.CSSProperty.prototype.setText):
+        (WebInspector.CSSProperty.prototype.setDisabled.callback):
+        (WebInspector.CSSProperty.prototype.setDisabled):
+        (WebInspector.CSSStyleSheet.prototype.setText):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkPanel.prototype.refreshResource):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.prototype.set content):
+        (WebInspector.Resource.prototype.get contentTimestamp):
+        (WebInspector.Resource.prototype.setInitialContent):
+        * inspector/front-end/ResourceManager.js:
+        (WebInspector.ResourceManager):
+        (WebInspector.ResourceManager.prototype.setInitialContent):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel):
+        (WebInspector.ResourcesPanel.prototype.reset):
+        (WebInspector.ResourcesPanel.prototype._innerShowView):
+        (WebInspector.FrameResourceTreeElement):
+        (WebInspector.FrameResourceTreeElement.prototype._errorsWarningsUpdated):
+        (WebInspector.FrameResourceTreeElement.prototype._contentChanged.else.finished):
+        (WebInspector.FrameResourceTreeElement.prototype._contentChanged):
+        (WebInspector.ResourceRevisionTreeElement):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype.get scrollTop):
+        (WebInspector.SourceFrame.prototype.set scrollTop):
+        * inspector/front-end/SourceView.js:
+        (WebInspector.SourceView.prototype.get scrollTop):
+        (WebInspector.SourceView.prototype.set scrollTop):
+        (WebInspector.SourceView.prototype._editLine):
+        (WebInspector.SourceView.prototype._editLineComplete):
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylePropertyTreeElement.prototype):
+
 2010-11-24  Andrey Kosyakov  <caseq@chromium.org>
 
         Reviewed by Pavel Feldman.
index b191aa7..006d696 100644 (file)
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
index f7acfe9..e8086a6 100644 (file)
@@ -113,7 +113,7 @@ module core {
         [notify] void didFinishLoading(out long identifier, out double finishTime);
         [notify] void didFailLoading(out long identifier, out double time, out String localizedDescription);
         [notify] void didLoadResourceFromMemoryCache(out double time, out Object resource);
-        [notify] void setOverrideContent(out long identifier, out String sourceString, out String type);
+        [notify] void setInitialContent(out long identifier, out String sourceString, out String type);
         [notify] void didCommitLoadForFrame(out Object frame, out Object loader);
         [notify] void frameDetachedFromParent(out unsigned long frameId);
 
index c47699f..243b7ac 100644 (file)
@@ -924,7 +924,7 @@ void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identi
         addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL);
 
     if (m_resourceAgent)
-        m_resourceAgent->setOverrideContent(identifier, sourceString, "XHR");
+        m_resourceAgent->setInitialContent(identifier, sourceString, "XHR");
 }
 
 void InspectorController::scriptImported(unsigned long identifier, const String& sourceString)
@@ -933,7 +933,7 @@ void InspectorController::scriptImported(unsigned long identifier, const String&
         return;
 
     if (m_resourceAgent)
-        m_resourceAgent->setOverrideContent(identifier, sourceString, "Script");
+        m_resourceAgent->setInitialContent(identifier, sourceString, "Script");
 }
 
 void InspectorController::ensureSettingsLoaded()
index 3d81e82..9dab24a 100644 (file)
@@ -344,9 +344,9 @@ void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader* load
     m_frontend->didLoadResourceFromMemoryCache(currentTime(), buildObjectForCachedResource(loader, *resource));
 }
 
-void InspectorResourceAgent::setOverrideContent(unsigned long identifier, const String& sourceString, const String& type)
+void InspectorResourceAgent::setInitialContent(unsigned long identifier, const String& sourceString, const String& type)
 {
-    m_frontend->setOverrideContent(identifier, sourceString, type);
+    m_frontend->setInitialContent(identifier, sourceString, type);
 }
 
 static PassRefPtr<InspectorObject> buildObjectForFrame(Frame* frame)
index e3153bf..1e77d58 100644 (file)
@@ -85,7 +85,7 @@ public:
     void didFinishLoading(unsigned long identifier, double finishTime);
     void didFailLoading(unsigned long identifier, const ResourceError&);
     void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
-    void setOverrideContent(unsigned long identifier, const String& sourceString, const String& type);
+    void setInitialContent(unsigned long identifier, const String& sourceString, const String& type);
     void didCommitLoad(DocumentLoader*);
     void frameDetachedFromParent(Frame*);
 
index 5530f57..4b6cfb2 100644 (file)
@@ -119,7 +119,7 @@ WebInspector.CSSStyleModel.prototype = {
             var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
             var rule = WebInspector.CSSRule.parsePayload(rulePayload);
             successCallback(rule, doesAffectSelectedNode);
-            this._styleSheetChanged(rule.id.styleSheetId);
+            this._styleSheetChanged(rule.id.styleSheetId, true);
         }
 
         function callback(nodeId, successCallback, failureCallback, newSelector, rulePayload)
@@ -140,7 +140,7 @@ WebInspector.CSSStyleModel.prototype = {
             var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
             var rule = WebInspector.CSSRule.parsePayload(rulePayload);
             successCallback(rule, doesAffectSelectedNode);
-            this._styleSheetChanged(rule.id.styleSheetId);
+            this._styleSheetChanged(rule.id.styleSheetId, true);
         }
 
         function callback(successCallback, failureCallback, selector, rulePayload)
@@ -155,9 +155,18 @@ WebInspector.CSSStyleModel.prototype = {
         InspectorBackend.addRule2(nodeId, selector, callback.bind(this, successCallback, failureCallback, selector));
     },
 
-    _styleSheetChanged: function(styleSheetId)
+    _styleSheetChanged: function(styleSheetId, majorChange)
     {
-        // FIXME: use InspectorBackend.getStyleSheetText2 here;
+        if (!majorChange || !styleSheetId)
+            return;
+
+        function callback(href, content)
+        {
+            var resource = WebInspector.resourceManager.resourceForURL(href);
+            if (resource)
+                resource.content = content;
+        }
+        InspectorBackend.getStyleSheetText2(styleSheetId, callback);
     }
 }
 
@@ -323,7 +332,7 @@ WebInspector.CSSStyleDeclaration.prototype = {
                 userCallback(null);
             else {
                 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
-                WebInspector.cssModel._styleSheetChanged(this.id.styleSheetId);
+                WebInspector.cssModel._styleSheetChanged(this.id.styleSheetId, true);
             }
         }
 
@@ -433,7 +442,7 @@ WebInspector.CSSProperty.prototype = {
     },
 
     // Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText.
-    setText: function(propertyText, userCallback)
+    setText: function(propertyText, majorChange, userCallback)
     {
         function callback(stylePayload)
         {
@@ -447,7 +456,7 @@ WebInspector.CSSProperty.prototype = {
             else {
                 var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
                 userCallback(style);
-                WebInspector.cssModel._styleSheetChanged(style.id.styleSheetId);
+                WebInspector.cssModel._styleSheetChanged(style.id.styleSheetId, majorChange);
             }
         }
 
@@ -480,7 +489,7 @@ WebInspector.CSSProperty.prototype = {
             else {
                 var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
                 userCallback(style);
-                WebInspector.cssModel._styleSheetChanged(this.ownerStyle.id.styleSheetId);
+                WebInspector.cssModel._styleSheetChanged(this.ownerStyle.id.styleSheetId, false);
             }
         }
 
@@ -532,7 +541,7 @@ WebInspector.CSSStyleSheet.prototype = {
                 userCallback(null);
             else {
                 userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
-                WebInspector.cssModel._styleSheetChanged(this.id);
+                WebInspector.cssModel._styleSheetChanged(this.id, true);
             }
         }
 
index 5ef1094..84de548 100644 (file)
@@ -796,6 +796,7 @@ WebInspector.NetworkPanel.prototype = {
 
         if (WebInspector.ResourceManager.resourceViewTypeMatchesResource(resource, resource._resourcesView))
             return;
+
         var newView = WebInspector.ResourceManager.createResourceView(resource);
 
         var oldView = resource._resourcesView;
index 79997db..d0346a2 100644 (file)
@@ -625,6 +625,19 @@ WebInspector.Resource.prototype = {
 
     set content(content)
     {
+        var data = { oldContent: this._content, oldContentTimestamp: this._contentTimestamp };
+        this._content = content;
+        this._contentTimestamp = new Date();
+        this.dispatchEventToListeners("content-changed", data);
+    },
+
+    get contentTimestamp()
+    {
+        return this._contentTimestamp;
+    },
+
+    setInitialContent: function(content)
+    {
         this._content = content;
     },
 
index 4baf8f8..fa23764 100644 (file)
@@ -39,7 +39,7 @@ WebInspector.ResourceManager = function()
         "didFinishLoading",
         "didFailLoading",
         "didLoadResourceFromMemoryCache",
-        "setOverrideContent",
+        "setInitialContent",
         "didCommitLoadForFrame",
         "frameDetachedFromParent",
         "didCreateWebSocket",
@@ -246,14 +246,14 @@ WebInspector.ResourceManager.prototype = {
         this._updateResourceWithResponse(resource, cachedResource.response);
     },
 
-    setOverrideContent: function(identifier, sourceString, type)
+    setInitialContent: function(identifier, sourceString, type)
     {
         var resource = WebInspector.panels.network.resources[identifier];
         if (!resource)
             return;
 
         resource.type = WebInspector.Resource.Type[type];
-        resource.content = sourceString;
+        resource.setInitialContent(sourceString);
         WebInspector.panels.resources.refreshResource(resource);
         WebInspector.panels.network.refreshResource(resource);
     },
index 6911207..aa01ef8 100644 (file)
@@ -56,10 +56,6 @@ WebInspector.ResourcesPanel = function(database)
     this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", "application-cache-storage-tree-item");
     this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
 
-    this.locallyModifiedListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Locally Modified"), "LocallyModified", "frame-storage-tree-item");
-    this.sidebarTree.appendChild(this.locallyModifiedListTreeElement);
-    this.locallyModifiedListTreeElement.hidden = true;
-
     if (Preferences.fileSystemEnabled) {
         this.fileSystemListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("File System"), "FileSystem", "file-system-storage-tree-item");
         this.sidebarTree.appendChild(this.fileSystemListTreeElement);
@@ -78,7 +74,6 @@ WebInspector.ResourcesPanel = function(database)
     this._cookieViews = {};
     this._origins = {};
     this._domains = {};
-    this._locallyModifiedResources = {};
 
     this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false);
     this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
@@ -149,7 +144,6 @@ WebInspector.ResourcesPanel.prototype = {
         this._domStorage = [];
 
         this._cookieViews = {};
-        this._locallyModifiedResources = {};
         this._fileSystemView = null;
         
         this._applicationCacheView = null;
@@ -160,7 +154,6 @@ WebInspector.ResourcesPanel.prototype = {
         this.sessionStorageListTreeElement.removeChildren();
         this.cookieListTreeElement.removeChildren();
         this.applicationCacheListTreeElement.removeChildren();
-        this.locallyModifiedListTreeElement.removeChildren();
         if (Preferences.fileSystemEnabled)
             this.fileSystemListTreeElement.removeChildren();
         this.storageViews.removeChildren();
@@ -311,20 +304,6 @@ WebInspector.ResourcesPanel.prototype = {
             this.sessionStorageListTreeElement.appendChild(domStorageTreeElement);
     },
 
-    addLocallyModifiedRevision: function(url, resourceType, content)
-    {
-        this.locallyModifiedListTreeElement.hidden = false;
-
-        var newRevision = new WebInspector.LocallyModifiedRevisionTreeElement(this, url, resourceType, content);
-        var lastRevision = this._locallyModifiedResources[url];
-        this._locallyModifiedResources[url] = newRevision;
-
-        if (lastRevision)
-            lastRevision.becomeLogEntry(newRevision);
-        else
-            this.locallyModifiedListTreeElement.appendChild(newRevision);
-    },
-
     selectDatabase: function(databaseId)
     {
         var database;
@@ -472,7 +451,7 @@ WebInspector.ResourcesPanel.prototype = {
     _innerShowView: function(view)
     {
         if (this.visibleView)
-            this.visibleView.detach();
+            this.visibleView.hide();
 
         view.show(this.storageViews);
         this.visibleView = view;
@@ -960,6 +939,7 @@ WebInspector.FrameResourceTreeElement = function(storagePanel, resource)
     WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
     this._resource = resource;
     this._resource.addEventListener("errors-warnings-updated", this._errorsWarningsUpdated, this);
+    this._resource.addEventListener("content-changed", this._contentChanged, this);
     this.tooltip = resource.url;
 }
 
@@ -1070,6 +1050,44 @@ WebInspector.FrameResourceTreeElement.prototype = {
 
         if (this._resource.errors)
             this._bubbleElement.addStyleClass("error");
+    },
+
+    _contentChanged: function(event)
+    {
+        var revisionResource = new WebInspector.Resource(null, this._resource.url);
+        revisionResource.type = this._resource.type;
+        revisionResource.loader = this._resource.loader;
+        if (this._resource.finished)
+            revisionResource.finished = true;
+        else {
+            function finished()
+            {
+                revisionResource.finished = true;
+            }
+            this._resource.addEventListener("finished", finished);
+        }
+        if (event.data.oldContent)
+            revisionResource.setInitialContent(event.data.oldContent);
+        this.insertChild(new WebInspector.ResourceRevisionTreeElement(this._storagePanel, revisionResource, event.data.oldContentTimestamp), 0);
+
+        var oldView = this._resource._resourcesView;
+        if (oldView) {
+            var scrollTop = oldView.scrollTop;
+            var newView = WebInspector.ResourceManager.createResourceView(this._resource);
+            var oldViewParentNode = oldView.visible ? oldView.element.parentNode : null;
+
+            this._resource._resourcesView.detach();
+            delete this._resource._resourcesView;
+            this._resource._resourcesView = newView;
+
+            if (oldViewParentNode)
+                newView.show(oldViewParentNode);
+
+            if (oldView === this._storagePanel.visibleView)
+                this._storagePanel.visibleView = newView;
+            if (scrollTop)
+                newView.scrollTop = scrollTop;
+        }
     }
 }
 
@@ -1197,44 +1215,16 @@ WebInspector.ApplicationCacheTreeElement.prototype = {
 }
 WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
 
-WebInspector.LocallyModifiedRevisionTreeElement = function(storagePanel, url, resourceType, content)
+WebInspector.ResourceRevisionTreeElement = function(storagePanel, resource, timestamp)
 {
-    var resource = new WebInspector.Resource(null, url);
-    resource.type = resourceType;
-    resource.content = content;
-
-    var timestamp = new Date();
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
-    this.tooltip = resource.url;
-    this.timestamp = timestamp;
+    var title = timestamp ? timestamp.toLocaleTimeString() : "(original)";
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, "resource-sidebar-tree-item resources-category-" + resource.category.name);
+    if (timestamp)
+        this.tooltip = timestamp.toLocaleString();
     this._resource = resource;
 }
 
-WebInspector.LocallyModifiedRevisionTreeElement.prototype = {
-    becomeLogEntry: function(newRevision)
-    {
-        var oldChildren = this.children.slice();
-        var oldExpanded = this.expanded;
-        var oldIndex = this.parent.children.indexOf(this);
-
-        this.removeChildren();
-        this.titleText = this.timestamp.toLocaleTimeString();
-        this.toLocaleString();
-        this.hasChildren = false;
-
-        this.parent.insertChild(newRevision, oldIndex);
-        this.parent.removeChild(this);
-
-        const oneMinute = 1000 * 60;
-        if (newRevision.timestamp - this.timestamp > oneMinute)
-            newRevision.appendChild(this);
-
-        for (var i = 0; i < oldChildren.length; ++i)
-            newRevision.appendChild(oldChildren[i]);
-        if (oldExpanded)
-            newRevision.expand();
-    },
-
+WebInspector.ResourceRevisionTreeElement.prototype = {
     onattach: function()
     {
         WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
@@ -1255,7 +1245,8 @@ WebInspector.LocallyModifiedRevisionTreeElement.prototype = {
         return true;
     }
 }
-WebInspector.LocallyModifiedRevisionTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.ResourceRevisionTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
 
 WebInspector.FileSystemTreeElement = function(storagePanel, origin)
 {
index 4b391ac..66a0005 100644 (file)
@@ -161,6 +161,17 @@ WebInspector.SourceFrame.prototype = {
         return this._textModel;
     },
 
+    get scrollTop()
+    {
+        return this._textViewer ? this._textViewer.element.scrollTop : 0;
+    },
+
+    set scrollTop(scrollTop)
+    {
+        if (this._textViewer)
+            this._textViewer.element.scrollTop = scrollTop;
+    },
+
     highlightLine: function(line)
     {
         if (this._textViewer)
index 9ff46e0..b624ee3 100644 (file)
@@ -70,6 +70,16 @@ WebInspector.SourceView.prototype = {
             this.sourceFrame.resize();
     },
 
+    get scrollTop()
+    {
+        return this.sourceFrame.scrollTop;
+    },
+
+    set scrollTop(scrollTop)
+    {
+        this.sourceFrame.scrollTop = scrollTop;
+    },
+
     setupSourceFrameIfNeeded: function()
     {
         if (!this._frameNeedsSetup)
@@ -137,12 +147,13 @@ WebInspector.SourceView.prototype = {
         }
 
         var linesCountToShift = newContent.split("\n").length - 1;
-        WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), lines.join("\n"), line, linesCountToShift, this._editLineComplete.bind(this), cancelEditingCallback);
+        var newContent = lines.join("\n");
+        WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), newContent, line, linesCountToShift, this._editLineComplete.bind(this, newContent), cancelEditingCallback);
     },
 
-    _editLineComplete: function(newBody)
+    _editLineComplete: function(newContent)
     {
-        this.sourceFrame.updateContent(newBody);
+        this.resource.content = newContent;
     },
 
     _sourceIDForLine: function(line)
index 0aec669..df8b730 100644 (file)
@@ -1771,7 +1771,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
         // FIXME: this does not handle trailing comments.
         if (styleText.length && !/;\s*$/.test(styleText))
             styleText += ";";
-        this.property.setText(styleText, callback.bind(this));
+        this.property.setText(styleText, updateInterface, callback.bind(this));
     }
 }