Web Inspector: scrolled Snapshot list is reset to top and drawn blank after switching...
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2016 21:26:33 +0000 (21:26 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2016 21:26:33 +0000 (21:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158218
rdar://problem/26545000

Reviewed by Brian Burg.

* UserInterface/Views/ClusterContentView.js:
(WebInspector.ClusterContentView.prototype.get scrollableElements): Added.
A default implementation for all cluster views.

* UserInterface/Views/DOMStorageContentView.js:
(WebInspector.DOMStorageContentView.prototype.get scrollableElements): Deleted.
This was duplicated in the class, removed one.

* UserInterface/Views/HeapAllocationsTimelineView.js:
(WebInspector.HeapAllocationsTimelineView): Initialize _snapshotListScrollTop.
(WebInspector.HeapAllocationsTimelineView.prototype.get scrollableElements): Added. Return elements
based on what is showing.

(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotList): Restore the scroll position
of the DataGrid after it is added to the view.

(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotTimelineRecord): Save the scroll position
of the DataGrid before it is removed from the view.

* UserInterface/Views/ScriptClusterTimelineView.js:
(WebInspector.ScriptClusterTimelineView.prototype.get scrollableElements): Deleted. Handled by the base class now.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js
Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js

index 1807d36..c42837a 100644 (file)
@@ -1,3 +1,33 @@
+2016-07-07  Timothy Hatcher  <timothy@apple.com>
+
+        Web Inspector: scrolled Snapshot list is reset to top and drawn blank after switching back from Snapshot Comparison view
+        https://bugs.webkit.org/show_bug.cgi?id=158218
+        rdar://problem/26545000
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Views/ClusterContentView.js:
+        (WebInspector.ClusterContentView.prototype.get scrollableElements): Added.
+        A default implementation for all cluster views.
+
+        * UserInterface/Views/DOMStorageContentView.js:
+        (WebInspector.DOMStorageContentView.prototype.get scrollableElements): Deleted.
+        This was duplicated in the class, removed one.
+
+        * UserInterface/Views/HeapAllocationsTimelineView.js:
+        (WebInspector.HeapAllocationsTimelineView): Initialize _snapshotListScrollTop.
+        (WebInspector.HeapAllocationsTimelineView.prototype.get scrollableElements): Added. Return elements
+        based on what is showing.
+
+        (WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotList): Restore the scroll position
+        of the DataGrid after it is added to the view.
+
+        (WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotTimelineRecord): Save the scroll position
+        of the DataGrid before it is removed from the view.
+
+        * UserInterface/Views/ScriptClusterTimelineView.js:
+        (WebInspector.ScriptClusterTimelineView.prototype.get scrollableElements): Deleted. Handled by the base class now.
+
 2016-07-06  Timothy Hatcher  <timothy@apple.com>
 
         Web Inspector: REGRESSION: Hitting ⌘T in Web Inspector no longer opens in new tab in Safari
index 34b8bfb..de640b4 100644 (file)
@@ -97,6 +97,13 @@ WebInspector.ClusterContentView = class ClusterContentView extends WebInspector.
         this._contentViewContainer.goForward();
     }
 
+    get scrollableElements()
+    {
+        if (!this._contentViewContainer.currentContentView)
+            return [];
+        return this._contentViewContainer.currentContentView.scrollableElements;
+    }
+
     get selectionPathComponents()
     {
         if (!this._contentViewContainer.currentContentView)
index 884846e..7ec2ecc 100644 (file)
@@ -117,13 +117,6 @@ WebInspector.DOMStorageContentView = class DOMStorageContentView extends WebInsp
         this._sortDataGrid();
     }
 
-    get scrollableElements()
-    {
-        if (!this._dataGrid)
-            return [];
-        return [this._dataGrid.scrollContainer];
-    }
-
     // Private
 
     _truncateValue(value)
index 7c49d54..b5f51e6 100644 (file)
@@ -77,6 +77,7 @@ WebInspector.HeapAllocationsTimelineView = class HeapAllocationsTimelineView ext
         this._baselineHeapSnapshotTimelineRecord = null;
         this._heapSnapshotDiff = null;
 
+        this._snapshotListScrollTop = 0;
         this._showingSnapshotList = true;
 
         this._snapshotListPathComponent = new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot List"), "snapshot-list-icon", "snapshot-list", false, false);
@@ -105,6 +106,15 @@ WebInspector.HeapAllocationsTimelineView = class HeapAllocationsTimelineView ext
 
     // Public
 
+    get scrollableElements()
+    {
+        if (this._showingSnapshotList)
+            return [this._dataGrid.scrollContainer];
+        if (this._contentViewContainer.currentContentView)
+            return this._contentViewContainer.currentContentView.scrollableElements;
+        return [];
+    }
+
     showHeapSnapshotList()
     {
         if (this._showingSnapshotList)
@@ -118,6 +128,8 @@ WebInspector.HeapAllocationsTimelineView = class HeapAllocationsTimelineView ext
         this.removeSubview(this._contentViewContainer);
         this.addSubview(this._dataGrid);
 
+        this._dataGrid.scrollContainer.scrollTop = this._snapshotListScrollTop;
+
         this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
         this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
     }
@@ -125,6 +137,7 @@ WebInspector.HeapAllocationsTimelineView = class HeapAllocationsTimelineView ext
     showHeapSnapshotTimelineRecord(heapSnapshotTimelineRecord)
     {
         if (this._showingSnapshotList) {
+            this._snapshotListScrollTop = this._dataGrid.scrollContainer.scrollTop;
             this.removeSubview(this._dataGrid);
             this.addSubview(this._contentViewContainer);
             this._contentViewContainer.shown();
index d684499..ad23aaa 100644 (file)
@@ -71,7 +71,6 @@ WebInspector.ScriptClusterTimelineView = class ScriptClusterTimelineView extends
     set endTime(x) { this._contentViewContainer.currentContentView.endTime = x; }
     get currentTime() { return this._contentViewContainer.currentContentView.currentTime; }
     set currentTime(x) { this._contentViewContainer.currentContentView.currentTime = x; }
-    get scrollableElements() { return this._contentViewContainer.currentContentView.scrollableElements; }
     selectRecord(record) { this._contentViewContainer.currentContentView.selectRecord(record); }
     updateFilter(filters) { return this._contentViewContainer.currentContentView.updateFilter(filters); }
     filterDidChange() { return this._contentViewContainer.currentContentView.filterDidChange(); }