Title: [113433] trunk/Source/WebCore
Revision
113433
Author
[email protected]
Date
2012-04-06 07:27:29 -0700 (Fri, 06 Apr 2012)

Log Message

Web Inspector: show "dirty" flag for CSS files edited in the resources panel.
https://bugs.webkit.org/show_bug.cgi?id=83363

Reviewed by Yury Semikhatsky.

Added TextEdited notification into the editable source frame, listening to it
in the resources panel.

* inspector/front-end/ResourceView.js:
(WebInspector.EditableResourceSourceFrame.prototype._contentChanged):
(WebInspector.EditableResourceSourceFrame.prototype.isDirty):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.FrameResourceTreeElement.prototype._appendRevision):
(WebInspector.FrameResourceTreeElement.prototype.sourceView):
(WebInspector.FrameResourceTreeElement.prototype._sourceViewTextEdited):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113432 => 113433)


--- trunk/Source/WebCore/ChangeLog	2012-04-06 14:24:54 UTC (rev 113432)
+++ trunk/Source/WebCore/ChangeLog	2012-04-06 14:27:29 UTC (rev 113433)
@@ -1,3 +1,21 @@
+2012-04-06  Pavel Feldman  <[email protected]>
+
+        Web Inspector: show "dirty" flag for CSS files edited in the resources panel.
+        https://bugs.webkit.org/show_bug.cgi?id=83363
+
+        Reviewed by Yury Semikhatsky.
+
+        Added TextEdited notification into the editable source frame, listening to it
+        in the resources panel.
+
+        * inspector/front-end/ResourceView.js:
+        (WebInspector.EditableResourceSourceFrame.prototype._contentChanged):
+        (WebInspector.EditableResourceSourceFrame.prototype.isDirty):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.FrameResourceTreeElement.prototype._appendRevision):
+        (WebInspector.FrameResourceTreeElement.prototype.sourceView):
+        (WebInspector.FrameResourceTreeElement.prototype._sourceViewTextEdited):
+
 2012-04-06  Levi Weintraub  <[email protected]>
 
         Update LayoutUnit usage in RenderView

Modified: trunk/Source/WebCore/inspector/front-end/ResourceView.js (113432 => 113433)


--- trunk/Source/WebCore/inspector/front-end/ResourceView.js	2012-04-06 14:24:54 UTC (rev 113432)
+++ trunk/Source/WebCore/inspector/front-end/ResourceView.js	2012-04-06 14:27:29 UTC (rev 113433)
@@ -133,6 +133,10 @@
     WebInspector.ResourceSourceFrame.call(this, resource);
 }
 
+WebInspector.EditableResourceSourceFrame.Events = {
+    TextEdited: "TextEdited"
+}
+
 WebInspector.EditableResourceSourceFrame.prototype = {
     canEditSource: function()
     {
@@ -159,6 +163,7 @@
         {
             var majorChange = false;
             this.resource.setContent(this._textModel.text, majorChange, function() {});
+            this.dispatchEventToListeners(WebInspector.EditableResourceSourceFrame.Events.TextEdited, this);
         }
         const updateTimeout = 200;
         this._incrementalUpdateTimer = setTimeout(commitIncrementalEdit.bind(this), updateTimeout);
@@ -175,6 +180,11 @@
     {
         if (!this._settingContent)
             WebInspector.ResourceSourceFrame.prototype._contentChanged.call(this, event);
+    },
+
+    isDirty: function()
+    {
+        return this._resource.content !== this.textModel.text;
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (113432 => 113433)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-04-06 14:24:54 UTC (rev 113432)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-04-06 14:27:29 UTC (rev 113433)
@@ -1387,6 +1387,7 @@
 
     _appendRevision: function(revision)
     {
+        this.subtitleText = "";
         this.insertChild(new WebInspector.ResourceRevisionTreeElement(this._storagePanel, revision), 0);
         if (this._sourceView === this._storagePanel.visibleView)
             this._storagePanel._showResourceView(this._resource);
@@ -1395,35 +1396,20 @@
     sourceView: function()
     {
         if (!this._sourceView) {
-            this._sourceView = this._createSourceView();
+            this._sourceView = new WebInspector.EditableResourceSourceFrame(this._resource);
             if (this._resource.messages) {
                 for (var i = 0; i < this._resource.messages.length; i++)
                     this._sourceView.addMessage(this._resource.messages[i]);
             }
+            this._sourceView.addEventListener(WebInspector.EditableResourceSourceFrame.Events.TextEdited, this._sourceViewTextEdited, this);
         }
         return this._sourceView;
     },
 
-    _createSourceView: function()
+    _sourceViewTextEdited: function(event)
     {
-        return new WebInspector.EditableResourceSourceFrame(this._resource);
-    },
-
-    _recreateSourceView: function()
-    {
-        var oldView = this._sourceView;
-        var newView = this._createSourceView();
-
-        var oldViewParentNode = oldView.isShowing() ? oldView.element.parentNode : null;
-        newView.inheritScrollPositions(oldView);
-
-        this._sourceView.detach();
-        this._sourceView = newView;
-
-        if (oldViewParentNode)
-            newView.show(oldViewParentNode);
-
-        return newView;
+        var sourceFrame = event.data;
+        this.subtitleText = sourceFrame.isDirty() ? "*" : "";
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to