Title: [145886] trunk/Source/WebCore
Revision
145886
Author
eus...@chromium.org
Date
2013-03-15 01:28:39 -0700 (Fri, 15 Mar 2013)

Log Message

Web Inspector: [Network] Sort columns context menu items alphabetically.
https://bugs.webkit.org/show_bug.cgi?id=112321

Reviewed by Pavel Feldman.

Problem: columns are presented in "natural" order,
so it is hard to find specific item.

* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView.prototype._getConfigurableColumnIDs):
Generate list of column IDs sorted alphabetically.
(WebInspector.NetworkLogView.prototype._contextMenu):
Use alphabetically sorted list of column IDs.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (145885 => 145886)


--- trunk/Source/WebCore/ChangeLog	2013-03-15 08:24:19 UTC (rev 145885)
+++ trunk/Source/WebCore/ChangeLog	2013-03-15 08:28:39 UTC (rev 145886)
@@ -1,3 +1,19 @@
+2013-03-13  Eugene Klyuchnikov  <eus...@chromium.org>
+
+        Web Inspector: [Network] Sort columns context menu items alphabetically.
+        https://bugs.webkit.org/show_bug.cgi?id=112321
+
+        Reviewed by Pavel Feldman.
+
+        Problem: columns are presented in "natural" order,
+        so it is hard to find specific item.
+
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkLogView.prototype._getConfigurableColumnIDs):
+        Generate list of column IDs sorted alphabetically.
+        (WebInspector.NetworkLogView.prototype._contextMenu):
+        Use alphabetically sorted list of column IDs.
+
 2013-03-15  Takashi Sakamoto  <ta...@google.com>
 
         Crash at RenderStyle::inheritFrom reported by fuzzer

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (145885 => 145886)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2013-03-15 08:24:19 UTC (rev 145885)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2013-03-15 08:28:39 UTC (rev 145886)
@@ -161,7 +161,7 @@
         columns.push({
             id: "name", 
             titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Name"), WebInspector.UIString("Path")),
-            name: WebInspector.UIString("Name"),
+            title: WebInspector.UIString("Name"),
             sortable: true,
             weight: 20,
             disclosure: true
@@ -177,7 +177,7 @@
         columns.push({
             id: "status",
             titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Status"), WebInspector.UIString("Text")),
-            name: WebInspector.UIString("Status"),
+            title: WebInspector.UIString("Status"),
             sortable: true,
             weight: 6
         });
@@ -222,7 +222,7 @@
         columns.push({
             id: "size",
             titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Size"), WebInspector.UIString("Content")),
-            name: WebInspector.UIString("Size"),
+            title: WebInspector.UIString("Size"),
             sortable: true,
             weight: 6,
             aligned: "right"
@@ -231,7 +231,7 @@
         columns.push({
             id: "time",
             titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Time"), WebInspector.UIString("Latency")),
-            name: WebInspector.UIString("Time"),
+            title: WebInspector.UIString("Time"),
             sortable: true,
             weight: 6,
             aligned: "right"
@@ -239,8 +239,8 @@
 
         columns.push({
             id: "timeline",
-            title: "",
-            name: WebInspector.UIString("Timeline"),
+            titleDOMFragment: document.createDocumentFragment(),
+            title: WebInspector.UIString("Timeline"),
             sortable: false,
             weight: 40,
             sort: "ascending"
@@ -1014,15 +1014,36 @@
         this._updateColumns();
     },
 
+    /**
+     * @return {!Array.<string>}
+     */
+    _getConfigurableColumnIDs: function()
+    {
+        if (this._configurableColumnIDs)
+            return this._configurableColumnIDs;
+
+        var columns = this._dataGrid.columns;
+        function compare(id1, id2)
+        {
+            return columns[id1].title.compareTo(columns[id2].title);
+        }
+
+        var columnIDs = Object.keys(this._coulmnsVisibilitySetting.get());
+        this._configurableColumnIDs = columnIDs.sort(compare);
+        return this._configurableColumnIDs;
+    },
+
     _contextMenu: function(event)
     {
         var contextMenu = new WebInspector.ContextMenu(event);
 
         if (this._detailedMode && event.target.isSelfOrDescendant(this._dataGrid.headerTableBody)) {
             var columnsVisibility = this._coulmnsVisibilitySetting.get();
-            for (var columnIdentifier in columnsVisibility) {
+            var columnIDs = this._getConfigurableColumnIDs();
+            for (var i = 0; i < columnIDs.length; ++i) {
+                var columnIdentifier = columnIDs[i];
                 var column = this._dataGrid.columns[columnIdentifier];
-                contextMenu.appendCheckboxItem(column.name || column.title, this._toggleColumnVisibility.bind(this, columnIdentifier), !!columnsVisibility[columnIdentifier]);
+                contextMenu.appendCheckboxItem(column.title, this._toggleColumnVisibility.bind(this, columnIdentifier), !!columnsVisibility[columnIdentifier]);
             }
             contextMenu.show();
             return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to