Web Inspector: Make Timelines view also remember sort order
https://bugs.webkit.org/show_bug.cgi?id=152811
Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-01-11
Reviewed by Timothy Hatcher.
Changeset r194574 introduced the ability for WebInspector.Setting objects to
be passed to DataGrid instances to save the sort column for that grid. These
changes also add the ability for the sort order to be save as well.
* UserInterface/Views/ApplicationCacheFrameContentView.js:
(WebInspector.ApplicationCacheFrameContentView.prototype._createDataGrid):
* UserInterface/Views/CookieStorageContentView.js:
(WebInspector.CookieStorageContentView.prototype._rebuildTable):
* UserInterface/Views/DOMStorageContentView.js:
(WebInspector.DOMStorageContentView):
* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid):
(WebInspector.DataGrid.prototype.set sortOrder):
If a WebInspector.Setting object has been given, save the new sort order.
(WebInspector.DataGrid.prototype.set sortOrderSetting):
Saves the given WebInspector.Setting object for modification whenever the user
changes the sort order.
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
(WebInspector.LayerTreeDetailsSidebarPanel.prototype._buildDataGridSection):
* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView):
* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView):
* UserInterface/Views/RenderingFrameTimelineView.js:
(WebInspector.RenderingFrameTimelineView):
* UserInterface/Views/ScriptTimelineView.js:
(WebInspector.ScriptTimelineView):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@194878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog
index e8ce5f6..ecebb92 100644
--- a/Source/WebInspectorUI/ChangeLog
+++ b/Source/WebInspectorUI/ChangeLog
@@ -1,3 +1,50 @@
+2016-01-11 Devin Rousso <dcrousso+webkit@gmail.com>
+
+ Web Inspector: Make Timelines view also remember sort order
+ https://bugs.webkit.org/show_bug.cgi?id=152811
+
+ Reviewed by Timothy Hatcher.
+
+ Changeset r194574 introduced the ability for WebInspector.Setting objects to
+ be passed to DataGrid instances to save the sort column for that grid. These
+ changes also add the ability for the sort order to be save as well.
+
+ * UserInterface/Views/ApplicationCacheFrameContentView.js:
+ (WebInspector.ApplicationCacheFrameContentView.prototype._createDataGrid):
+
+ * UserInterface/Views/CookieStorageContentView.js:
+ (WebInspector.CookieStorageContentView.prototype._rebuildTable):
+
+ * UserInterface/Views/DOMStorageContentView.js:
+ (WebInspector.DOMStorageContentView):
+
+ * UserInterface/Views/DataGrid.js:
+ (WebInspector.DataGrid):
+ (WebInspector.DataGrid.prototype.set sortOrder):
+ If a WebInspector.Setting object has been given, save the new sort order.
+
+ (WebInspector.DataGrid.prototype.set sortOrderSetting):
+ Saves the given WebInspector.Setting object for modification whenever the user
+ changes the sort order.
+
+ * UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
+ (WebInspector.LayerTreeDetailsSidebarPanel.prototype._buildDataGridSection):
+
+ * UserInterface/Views/LayoutTimelineView.js:
+ (WebInspector.LayoutTimelineView):
+
+ * UserInterface/Views/NetworkGridContentView.js:
+ (WebInspector.NetworkGridContentView):
+
+ * UserInterface/Views/NetworkTimelineView.js:
+ (WebInspector.NetworkTimelineView):
+
+ * UserInterface/Views/RenderingFrameTimelineView.js:
+ (WebInspector.RenderingFrameTimelineView):
+
+ * UserInterface/Views/ScriptTimelineView.js:
+ (WebInspector.ScriptTimelineView):
+
2016-01-11 Johan K. Jensen <jj@johanjensen.dk>
Web Inspector: Copying JS object output from console shouldn't include trailing '= $n'
diff --git a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
index 9c8c18b..e560014 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
@@ -163,7 +163,7 @@
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("application-cache-frame-content-view-sort", "url");
- this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("application-cache-frame-content-view-sort-order", WebInspector.DataGrid.SortOrder.Ascending);
this.addSubview(this._dataGrid);
this._dataGrid.updateLayout();
diff --git a/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js b/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js
index 115f9c76a..1037734 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js
@@ -143,6 +143,7 @@
}
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("cookie-storage-content-view-sort", "name");
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("cookie-storage-content-view-sort-order", WebInspector.DataGrid.SortOrder.Indeterminate);
}
_filterCookies(cookies)
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js b/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
index 2a250d3..d809420 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
@@ -42,7 +42,7 @@
columns.value = {title: WebInspector.UIString("Value"), sortable: true};
this._dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
- this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("dom-storage-content-view-sort-order", WebInspector.DataGrid.SortOrder.Ascending);
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("dom-storage-content-view-sort", "key");
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
diff --git a/Source/WebInspectorUI/UserInterface/Views/DataGrid.js b/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
index 5f674a4..180dfd9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
@@ -35,6 +35,7 @@
this._sortColumnIdentifier = null;
this._sortColumnIdentifierSetting = null;
this._sortOrder = WebInspector.DataGrid.SortOrder.Indeterminate;
+ this._sortOrderSetting = null;
this.children = [];
this.selectedNode = null;
@@ -185,6 +186,9 @@
this._sortOrder = order;
+ if (this._sortOrderSetting)
+ this._sortOrderSetting.value = this._sortOrder;
+
if (!this._sortColumnIdentifier)
return;
@@ -196,6 +200,15 @@
this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);
}
+ set sortOrderSetting(setting)
+ {
+ console.assert(setting instanceof WebInspector.Setting);
+
+ this._sortOrderSetting = setting;
+ if (this._sortOrderSetting.value)
+ this.sortOrder = this._sortOrderSetting.value;
+ }
+
get sortColumnIdentifier()
{
return this._sortColumnIdentifier;
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
index 3a9e0fc..1be711d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
@@ -142,7 +142,7 @@
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._selectedDataGridNodeChanged, this);
this.sortColumnIdentifierSetting = new WebInspector.Setting("layer-tree-details-sidebar-panel-sort", "memory");
- this.sortOrder = WebInspector.DataGrid.SortOrder.Descending;
+ this.sortOrderSetting = new WebInspector.Setting("layer-tree-details-sidebar-panel-sort-order", WebInspector.DataGrid.SortOrder.Descending);
var element = this._dataGrid.element;
element.classList.add("inline");
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
index d385597..bde64b7 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
@@ -73,7 +73,7 @@
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("layout-timeline-view-sort", "startTime");
- this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("layout-timeline-view-sort-order", WebInspector.DataGrid.SortOrder.Ascending);
this._hoveredTreeElement = null;
this._hoveredDataGridNode = null;
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js b/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js
index 9672e68..06e02fe 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js
@@ -83,7 +83,7 @@
this._dataGrid = new WebInspector.TimelineDataGrid(this._contentTreeOutline, columns);
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("network-grid-content-view-sort", "requestSent");
- this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("network-grid-content-view-sort-order", WebInspector.DataGrid.SortOrder.Ascending);
this.element.classList.add("network-grid");
this.addSubview(this._dataGrid);
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
index b375a5b..27908aa 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
@@ -90,7 +90,7 @@
this._dataGrid.addEventListener(WebInspector.TimelineDataGrid.Event.FiltersDidChange, this._dataGridFiltersDidChange, this);
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("network-timeline-view-sort", "requestSent");
- this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("network-timeline-view-sort-order", WebInspector.DataGrid.SortOrder.Ascending);
this.element.classList.add("network");
this.addSubview(this._dataGrid);
diff --git a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
index f1170f1..b0c7b19 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
@@ -76,7 +76,7 @@
this._dataGrid = new WebInspector.TimelineDataGrid(this.navigationSidebarTreeOutline, columns, this);
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("rendering-frame-timeline-view-sort", "startTime");
- this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("rendering-frame-timeline-view-sort-order", WebInspector.DataGrid.SortOrder.Ascending);
this.element.classList.add("rendering-frame");
this.addSubview(this._dataGrid);
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js
index d38bd1f..61a1271 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js
@@ -65,7 +65,7 @@
this._dataGrid.addEventListener(WebInspector.TimelineDataGrid.Event.FiltersDidChange, this._dataGridFiltersDidChange, this);
this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
this._dataGrid.sortColumnIdentifierSetting = new WebInspector.Setting("script-timeline-view-sort", "startTime");
- this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+ this._dataGrid.sortOrderSetting = new WebInspector.Setting("script-timeline-view-sort-order", WebInspector.DataGrid.SortOrder.Ascending);
this.element.classList.add("script");
this.addSubview(this._dataGrid);