Title: [122460] trunk/Source/WebCore
Revision
122460
Author
[email protected]
Date
2012-07-12 08:22:52 -0700 (Thu, 12 Jul 2012)

Log Message

Web Inspector: Revision history view should be updated when uiSourceCodes are removed or replaced.
https://bugs.webkit.org/show_bug.cgi?id=91095

Reviewed by Pavel Feldman.

RevisionHistoryView is now reset in WorkspaceReset event handler.
UISourceCodes are now removed from RevisionHistoryView when uiSourceCode is removed or replace.

* inspector/front-end/RevisionHistoryView.js:
(WebInspector.RevisionHistoryView):
(WebInspector.RevisionHistoryView.prototype._clearHistory):
(WebInspector.RevisionHistoryView.prototype._uiSourceCodeRemoved):
(WebInspector.RevisionHistoryView.prototype._uiSourceCodeReplaced):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._reset):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122459 => 122460)


--- trunk/Source/WebCore/ChangeLog	2012-07-12 15:01:08 UTC (rev 122459)
+++ trunk/Source/WebCore/ChangeLog	2012-07-12 15:22:52 UTC (rev 122460)
@@ -1,3 +1,21 @@
+2012-07-12  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Revision history view should be updated when uiSourceCodes are removed or replaced.
+        https://bugs.webkit.org/show_bug.cgi?id=91095
+
+        Reviewed by Pavel Feldman.
+
+        RevisionHistoryView is now reset in WorkspaceReset event handler.
+        UISourceCodes are now removed from RevisionHistoryView when uiSourceCode is removed or replace.
+
+        * inspector/front-end/RevisionHistoryView.js:
+        (WebInspector.RevisionHistoryView):
+        (WebInspector.RevisionHistoryView.prototype._clearHistory):
+        (WebInspector.RevisionHistoryView.prototype._uiSourceCodeRemoved):
+        (WebInspector.RevisionHistoryView.prototype._uiSourceCodeReplaced):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._reset):
+
 2012-07-12  Dongwoo Im  <[email protected]>
 
         InspectorFileSystemAgent.cpp have to include File.h explicitly

Modified: trunk/Source/WebCore/inspector/front-end/RevisionHistoryView.js (122459 => 122460)


--- trunk/Source/WebCore/inspector/front-end/RevisionHistoryView.js	2012-07-12 15:01:08 UTC (rev 122459)
+++ trunk/Source/WebCore/inspector/front-end/RevisionHistoryView.js	2012-07-12 15:22:52 UTC (rev 122460)
@@ -55,6 +55,9 @@
 
     WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this));
     WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted, this._revisionAdded, this);
+    WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
+    WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
+    WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.WorkspaceReset, this._reset.bind(this, false), this);
 
     this._statusElement = document.createElement("span");
     this._statusElement.textContent = WebInspector.UIString("Local modifications");
@@ -73,12 +76,6 @@
     view._revealUISourceCode(uiSourceCode);
 }
 
-WebInspector.RevisionHistoryView.reset = function()
-{
-    if (WebInspector.RevisionHistoryView._view)
-        WebInspector.RevisionHistoryView._view._reset();
-}
-
 WebInspector.RevisionHistoryView.prototype = {
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
@@ -126,15 +123,7 @@
      */
     _clearHistory: function(uiSourceCode)
     {
-        uiSourceCode.revertAndClearHistory(historyCleared.bind(this));
-
-        function historyCleared()
-        {
-            var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode);
-            this._treeOutline.removeChild(uiSourceCodeItem);
-            this._uiSourceCodeItems.remove(uiSourceCode);
-        }
-
+        uiSourceCode.revertAndClearHistory(this._removeUISourceCode.bind(this));
     },
 
     _revisionAdded: function(event)
@@ -165,6 +154,33 @@
         }
     },
 
+    _uiSourceCodeRemoved: function(event)
+    {
+        var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data;
+        this._removeUISourceCode(uiSourceCode);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _uiSourceCodeReplaced: function(event)
+    {
+        var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode;
+        var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode;
+        this._removeUISourceCode(oldUISourceCode);
+        this._revealUISourceCode(uiSourceCode);
+    },
+
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     */
+    _removeUISourceCode: function(uiSourceCode)
+    {
+        var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode);
+        this._treeOutline.removeChild(uiSourceCodeItem);
+        this._uiSourceCodeItems.remove(uiSourceCode);
+    },
+
     _reset: function()
     {
         this._treeOutline.removeChildren();

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (122459 => 122460)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-07-12 15:01:08 UTC (rev 122459)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-07-12 15:22:52 UTC (rev 122460)
@@ -366,7 +366,6 @@
         this.sidebarPanes.watchExpressions.reset();
         if (!preserveItems && this.sidebarPanes.workers)
             this.sidebarPanes.workers.reset();
-        WebInspector.RevisionHistoryView.reset();
 
         var uiSourceCodes = this._workspace.uiSourceCodes();
         for (var i = 0; i < uiSourceCodes.length; ++i)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to