[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

apavlov at chromium.org apavlov at chromium.org
Wed Dec 22 11:27:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit eb7aae0d020c92674146d8e279218e95eaaec1d0
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 26 09:37:38 2010 +0000

    2010-07-26  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Joseph Pecoraro.
    
            Inspector should remember resources sorting set by the user
            https://bugs.webkit.org/show_bug.cgi?id=19208
    
            Sorting options both for time and size graphs are memorized in a single property,
            which makes them possible to retrieve in a single message (e.g. useful for remote debugging).
    
            * inspector/front-end/ResourcesPanel.js:
            (WebInspector.ResourcesPanel.prototype.populateSidebar):
            (WebInspector.ResourcesPanel.prototype._settingsLoaded):
            (WebInspector.ResourcesPanel.prototype._loadSortOptions):
            (WebInspector.ResourcesPanel.prototype._loadSortOptionForGraph):
            (WebInspector.ResourcesPanel.prototype._graphSelected):
            (WebInspector.ResourcesPanel.prototype._changeSortingFunction):
            (WebInspector.ResourcesPanel.prototype._selectedOptionNameForGraph):
            (WebInspector.ResourcesPanel.prototype._doChangeSortingFunction):
            * inspector/front-end/Settings.js:
            (WebInspector.populateApplicationSettings):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64037 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 719c682..8cd5f56 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-07-26  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Joseph Pecoraro.
+
+        Inspector should remember resources sorting set by the user
+        https://bugs.webkit.org/show_bug.cgi?id=19208
+
+        Sorting options both for time and size graphs are memorized in a single property,
+        which makes them possible to retrieve in a single message (e.g. useful for remote debugging).
+
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel.prototype.populateSidebar):
+        (WebInspector.ResourcesPanel.prototype._settingsLoaded):
+        (WebInspector.ResourcesPanel.prototype._loadSortOptions):
+        (WebInspector.ResourcesPanel.prototype._loadSortOptionForGraph):
+        (WebInspector.ResourcesPanel.prototype._graphSelected):
+        (WebInspector.ResourcesPanel.prototype._changeSortingFunction):
+        (WebInspector.ResourcesPanel.prototype._selectedOptionNameForGraph):
+        (WebInspector.ResourcesPanel.prototype._doChangeSortingFunction):
+        * inspector/front-end/Settings.js:
+        (WebInspector.populateApplicationSettings):
+
 2010-07-25  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index b02a277..2ad62a9 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -82,30 +82,30 @@ WebInspector.ResourcesPanel.prototype = {
 
     populateSidebar: function()
     {
-        var timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time"));
-        timeGraphItem.onselect = this._graphSelected.bind(this);
+        this.timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time"));
+        this.timeGraphItem.onselect = this._graphSelected.bind(this);
 
         var transferTimeCalculator = new WebInspector.ResourceTransferTimeCalculator();
         var transferDurationCalculator = new WebInspector.ResourceTransferDurationCalculator();
 
-        timeGraphItem.sortingOptions = [
-            { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator },
-            { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator },
-            { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator },
-            { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator },
-            { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator },
+        this.timeGraphItem.sortingOptions = [
+            { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator, optionName: "startTime" },
+            { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator, optionName: "responseTime" },
+            { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator, optionName: "endTime" },
+            { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator, optionName: "duration" },
+            { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator, optionName: "latency" },
         ];
 
-        timeGraphItem.isBarOpaqueAtLeft = false;
-        timeGraphItem.selectedSortingOptionIndex = 1;
+        this.timeGraphItem.isBarOpaqueAtLeft = false;
+        this.timeGraphItem.selectedSortingOptionIndex = 1;
 
         this.sizeGraphItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Size"));
         this.sizeGraphItem.onselect = this._graphSelected.bind(this);
 
         var transferSizeCalculator = new WebInspector.ResourceTransferSizeCalculator();
         this.sizeGraphItem.sortingOptions = [
-            { name: WebInspector.UIString("Sort by Transfer Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize, calculator: transferSizeCalculator },
-            { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator },
+            { name: WebInspector.UIString("Sort by Transfer Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize, calculator: transferSizeCalculator, optionName: "transferSize" },
+            { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator, optionName: "size" },
         ];
 
         this.sizeGraphItem.isBarOpaqueAtLeft = true;
@@ -114,7 +114,7 @@ WebInspector.ResourcesPanel.prototype = {
         this.graphsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("GRAPHS"), {}, true);
         this.sidebarTree.appendChild(this.graphsTreeElement);
 
-        this.graphsTreeElement.appendChild(timeGraphItem);
+        this.graphsTreeElement.appendChild(this.timeGraphItem);
         this.graphsTreeElement.appendChild(this.sizeGraphItem);
         this.graphsTreeElement.expand();
 
@@ -160,6 +160,32 @@ WebInspector.ResourcesPanel.prototype = {
         this.largerResourcesButton.toggled = WebInspector.applicationSettings.resourcesLargeRows;
         if (!WebInspector.applicationSettings.resourcesLargeRows)
             this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows);
+        this._loadSortOptions();
+    },
+
+    _loadSortOptions: function()
+    {
+        var newOptions = WebInspector.applicationSettings.resourcesSortOptions;
+        if (!newOptions)
+            return;
+
+        this._loadSortOptionForGraph(this.timeGraphItem, newOptions.timeOption || "responseTime");
+        this._loadSortOptionForGraph(this.sizeGraphItem, newOptions.sizeOption || "transferSize");
+    },
+
+    _loadSortOptionForGraph: function(graphItem, newOptionName)
+    {
+        var sortingOptions = graphItem.sortingOptions;
+        for (var i = 0; i < sortingOptions.length; ++i) {
+            if (sortingOptions[i].optionName === newOptionName) {
+                graphItem.selectedSortingOptionIndex = i;
+                // Propagate the option change down to the currently selected option.
+                if (this._lastSelectedGraphTreeElement === graphItem) {
+                    this._lastSelectedGraphTreeElement = null;
+                    this._graphSelected(graphItem);
+                }
+            }
+        }
     },
 
     get mainResourceLoadTime()
@@ -618,11 +644,12 @@ WebInspector.ResourcesPanel.prototype = {
             option.label = sortingOption.name;
             option.sortingFunction = sortingOption.sortingFunction;
             option.calculator = sortingOption.calculator;
+            option.optionName = sortingOption.optionName;
             this.sortingSelectElement.appendChild(option);
         }
 
         this.sortingSelectElement.selectedIndex = treeElement.selectedSortingOptionIndex;
-        this._changeSortingFunction();
+        this._doChangeSortingFunction();
 
         this.closeVisibleResource();
         this.containerElement.scrollTop = 0;
@@ -658,7 +685,21 @@ WebInspector.ResourcesPanel.prototype = {
 
     _changeSortingFunction: function()
     {
-        var selectedOption = this.sortingSelectElement[this.sortingSelectElement.selectedIndex];
+        this._doChangeSortingFunction();
+        WebInspector.applicationSettings.resourcesSortOptions = {timeOption: this._selectedOptionNameForGraph(this.timeGraphItem), sizeOption: this._selectedOptionNameForGraph(this.sizeGraphItem)};
+    },
+
+    _selectedOptionNameForGraph: function(graphItem)
+    {
+        return graphItem.sortingOptions[graphItem.selectedSortingOptionIndex].optionName;
+    },
+
+    _doChangeSortingFunction: function()
+    {
+        var selectedIndex = this.sortingSelectElement.selectedIndex;
+        if (this._lastSelectedGraphTreeElement)
+            this._lastSelectedGraphTreeElement.selectedSortingOptionIndex = selectedIndex;
+        var selectedOption = this.sortingSelectElement[selectedIndex];
         this.sortingFunction = selectedOption.sortingFunction;
         this.calculator = this.summaryBar.calculator = selectedOption.calculator;
     },
diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js
index 450e694..22db491 100644
--- a/WebCore/inspector/front-end/Settings.js
+++ b/WebCore/inspector/front-end/Settings.js
@@ -58,6 +58,7 @@ WebInspector.populateApplicationSettings = function(settingsString)
     WebInspector.applicationSettings.installSetting("showUserAgentStyles", "show-user-agent-styles", true);
     WebInspector.applicationSettings.installSetting("resourceViewTab", "resource-view-tab", "content");
     WebInspector.applicationSettings.installSetting("consoleHistory", "console-history", []);
+    WebInspector.applicationSettings.installSetting("resourcesSortOptions", "resources-sort-options", {timeOption: "responseTime", sizeOption: "transferSize"});
 
     WebInspector.applicationSettings.dispatchEventToListeners("loaded");
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list