[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Wed Apr 7 23:13:27 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 4dd28dabf15bf2df154cbcf887313d80e41d2af6
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 28 21:17:21 2009 +0000

    2009-10-28  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: Pull items collections from resources panel and
            timeline panel into AbstractTimelinePanel.
    
            https://bugs.webkit.org/show_bug.cgi?id=30875
    
            * inspector/front-end/AbstractTimelinePanel.js:
            (WebInspector.AbstractTimelinePanel):
            (WebInspector.AbstractTimelinePanel.prototype.populateSidebar):
            (WebInspector.AbstractTimelinePanel.prototype.createItemTreeElement):
            (WebInspector.AbstractTimelinePanel.prototype.createItemGraph):
            (WebInspector.AbstractTimelinePanel.prototype._showCategory):
            (WebInspector.AbstractTimelinePanel.prototype._hideCategory):
            (WebInspector.AbstractTimelinePanel.prototype.filter):
            (WebInspector.AbstractTimelinePanel.prototype._createGraph):
            (WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth):
            (WebInspector.AbstractTimelinePanel.prototype.refresh):
            (WebInspector.AbstractTimelinePanel.prototype.reset):
            (WebInspector.AbstractTimelinePanel.prototype.get calculator):
            (WebInspector.AbstractTimelinePanel.prototype.set calculator):
            (WebInspector.AbstractTimelinePanel.prototype.addItem):
            (WebInspector.AbstractTimelinePanel.prototype.removeItem):
            (WebInspector.AbstractTimelinePanel.prototype.refreshItem):
            (WebInspector.AbstractTimelinePanel.prototype.revealAndSelectItem):
            (WebInspector.AbstractTimelinePanel.prototype.sortItems):
            (WebInspector.AbstractTimelinePanel.prototype.adjustScrollPosition):
            (WebInspector.AbstractTimelineCategory):
            (WebInspector.AbstractTimelineCategory.prototype.toString):
            * inspector/front-end/ResourceCategory.js:
            (WebInspector.ResourceCategory):
            * inspector/front-end/ResourcesPanel.js:
            (WebInspector.ResourcesPanel):
            (WebInspector.ResourcesPanel.prototype.createItemTreeElement):
            (WebInspector.ResourcesPanel.prototype.createItemGraph):
            (WebInspector.ResourcesPanel.prototype.isCategoryVisible):
            (WebInspector.ResourcesPanel.prototype.populateSidebar):
            (WebInspector.ResourcesPanel.prototype.get searchableViews):
            (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction.sortFuction):
            (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction):
            (WebInspector.ResourcesPanel.prototype.searchMatchFound):
            (WebInspector.ResourcesPanel.prototype.searchCanceled):
            (WebInspector.ResourcesPanel.prototype.performSearch):
            (WebInspector.ResourcesPanel.prototype.refresh):
            (WebInspector.ResourcesPanel.prototype.reset):
            (WebInspector.ResourcesPanel.prototype.removeResource):
            (WebInspector.ResourcesPanel.prototype.addMessageToResource):
            (WebInspector.ResourcesPanel.prototype.clearMessages):
            (WebInspector.ResourcesPanel.prototype.refreshResource):
            (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded):
            (WebInspector.ResourcesPanel.prototype.showResource):
            (WebInspector.ResourcesPanel.prototype._sortResourcesIfNeeded):
            (WebInspector.ResourcesPanel.prototype._toggleLargerResources):
            (WebInspector.ResourcesPanel.prototype._toggleResourceTracking):
            (WebInspector.ResourcesPanel.prototype.get _resources):
            (WebInspector.ResourceTimeCalculator.prototype._upperBound):
            * inspector/front-end/TimelinePanel.js:
            (WebInspector.TimelinePanel):
            (WebInspector.TimelinePanel.prototype.get categories):
            (WebInspector.TimelinePanel.prototype.populateSidebar):
            (WebInspector.TimelinePanel.prototype.addRecordToTimeline):
            (WebInspector.TimelinePanel.prototype.createItemTreeElement):
            (WebInspector.TimelinePanel.prototype.createItemGraph):
            (WebInspector.TimelinePanel.prototype._formatRecord):
            (WebInspector.TimelineCategory):
            * inspector/front-end/inspector.css:
            * inspector/front-end/inspector.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50236 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ddd5ee2..be0d47e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,73 @@
+2009-10-28  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Pull items collections from resources panel and
+        timeline panel into AbstractTimelinePanel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30875
+
+        * inspector/front-end/AbstractTimelinePanel.js:
+        (WebInspector.AbstractTimelinePanel):
+        (WebInspector.AbstractTimelinePanel.prototype.populateSidebar):
+        (WebInspector.AbstractTimelinePanel.prototype.createItemTreeElement):
+        (WebInspector.AbstractTimelinePanel.prototype.createItemGraph):
+        (WebInspector.AbstractTimelinePanel.prototype._showCategory):
+        (WebInspector.AbstractTimelinePanel.prototype._hideCategory):
+        (WebInspector.AbstractTimelinePanel.prototype.filter):
+        (WebInspector.AbstractTimelinePanel.prototype._createGraph):
+        (WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth):
+        (WebInspector.AbstractTimelinePanel.prototype.refresh):
+        (WebInspector.AbstractTimelinePanel.prototype.reset):
+        (WebInspector.AbstractTimelinePanel.prototype.get calculator):
+        (WebInspector.AbstractTimelinePanel.prototype.set calculator):
+        (WebInspector.AbstractTimelinePanel.prototype.addItem):
+        (WebInspector.AbstractTimelinePanel.prototype.removeItem):
+        (WebInspector.AbstractTimelinePanel.prototype.refreshItem):
+        (WebInspector.AbstractTimelinePanel.prototype.revealAndSelectItem):
+        (WebInspector.AbstractTimelinePanel.prototype.sortItems):
+        (WebInspector.AbstractTimelinePanel.prototype.adjustScrollPosition):
+        (WebInspector.AbstractTimelineCategory):
+        (WebInspector.AbstractTimelineCategory.prototype.toString):
+        * inspector/front-end/ResourceCategory.js:
+        (WebInspector.ResourceCategory):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel):
+        (WebInspector.ResourcesPanel.prototype.createItemTreeElement):
+        (WebInspector.ResourcesPanel.prototype.createItemGraph):
+        (WebInspector.ResourcesPanel.prototype.isCategoryVisible):
+        (WebInspector.ResourcesPanel.prototype.populateSidebar):
+        (WebInspector.ResourcesPanel.prototype.get searchableViews):
+        (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction.sortFuction):
+        (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction):
+        (WebInspector.ResourcesPanel.prototype.searchMatchFound):
+        (WebInspector.ResourcesPanel.prototype.searchCanceled):
+        (WebInspector.ResourcesPanel.prototype.performSearch):
+        (WebInspector.ResourcesPanel.prototype.refresh):
+        (WebInspector.ResourcesPanel.prototype.reset):
+        (WebInspector.ResourcesPanel.prototype.removeResource):
+        (WebInspector.ResourcesPanel.prototype.addMessageToResource):
+        (WebInspector.ResourcesPanel.prototype.clearMessages):
+        (WebInspector.ResourcesPanel.prototype.refreshResource):
+        (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded):
+        (WebInspector.ResourcesPanel.prototype.showResource):
+        (WebInspector.ResourcesPanel.prototype._sortResourcesIfNeeded):
+        (WebInspector.ResourcesPanel.prototype._toggleLargerResources):
+        (WebInspector.ResourcesPanel.prototype._toggleResourceTracking):
+        (WebInspector.ResourcesPanel.prototype.get _resources):
+        (WebInspector.ResourceTimeCalculator.prototype._upperBound):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel):
+        (WebInspector.TimelinePanel.prototype.get categories):
+        (WebInspector.TimelinePanel.prototype.populateSidebar):
+        (WebInspector.TimelinePanel.prototype.addRecordToTimeline):
+        (WebInspector.TimelinePanel.prototype.createItemTreeElement):
+        (WebInspector.TimelinePanel.prototype.createItemGraph):
+        (WebInspector.TimelinePanel.prototype._formatRecord):
+        (WebInspector.TimelineCategory):
+        * inspector/front-end/inspector.css:
+        * inspector/front-end/inspector.html:
+
 2009-10-28  Kelly Norton  <knorton at google.com>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/inspector/front-end/AbstractTimelinePanel.js b/WebCore/inspector/front-end/AbstractTimelinePanel.js
index 85d1f05..75e4062 100644
--- a/WebCore/inspector/front-end/AbstractTimelinePanel.js
+++ b/WebCore/inspector/front-end/AbstractTimelinePanel.js
@@ -31,6 +31,8 @@
 WebInspector.AbstractTimelinePanel = function()
 {
     WebInspector.Panel.call(this);
+    this._items = [];
+    this._staleItems = [];
 }
 
 WebInspector.AbstractTimelinePanel.prototype = {
@@ -40,22 +42,17 @@ WebInspector.AbstractTimelinePanel.prototype = {
         return {};
     },
 
-    showCategory: function(category)
+    populateSidebar: function()
     {
         // Should be implemented by the concrete subclasses.
     },
 
-    hideCategory: function(category)
+    createItemTreeElement: function(item)
     {
         // Should be implemented by the concrete subclasses.
     },
 
-    populateSidebar: function()
-    {
-        // Should be implemented by the concrete subclasses.
-    },
-
-    refresh: function()
+    createItemGraph: function(item)
     {
         // Should be implemented by the concrete subclasses.
     },
@@ -111,6 +108,20 @@ WebInspector.AbstractTimelinePanel.prototype = {
             createFilterElement.call(this, category);
     },
 
+    _showCategory: function(category)
+    {
+        var filterClass = "filter-" + category.toLowerCase();
+        this.itemsGraphsElement.addStyleClass(filterClass);
+        this.itemsTreeElement.childrenListElement.addStyleClass(filterClass);
+    },
+
+    _hideCategory: function(category)
+    {
+        var filterClass = "filter-" + category.toLowerCase();
+        this.itemsGraphsElement.removeStyleClass(filterClass);
+        this.itemsTreeElement.childrenListElement.removeStyleClass(filterClass);
+    },
+
     filter: function(target, selectMultiple)
     {
         function unselectAll()
@@ -121,7 +132,7 @@ WebInspector.AbstractTimelinePanel.prototype = {
                     continue;
 
                 child.removeStyleClass("selected");
-                this.hideCategory(child.category);
+                this._hideCategory(child.category);
             }
         }
 
@@ -137,7 +148,7 @@ WebInspector.AbstractTimelinePanel.prototype = {
             // Something other than All is being selected, so we want to unselect All.
             if (this.filterAllElement.hasStyleClass("selected")) {
                 this.filterAllElement.removeStyleClass("selected");
-                this.hideCategory("all");
+                this._hideCategory("all");
             }
         }
 
@@ -147,7 +158,7 @@ WebInspector.AbstractTimelinePanel.prototype = {
             unselectAll.call(this);
 
             target.addStyleClass("selected");
-            this.showCategory(target.category);
+            this._showCategory(target.category);
             return;
         }
 
@@ -155,12 +166,12 @@ WebInspector.AbstractTimelinePanel.prototype = {
             // If selectMultiple is turned on, and we were selected, we just
             // want to unselect ourselves.
             target.removeStyleClass("selected");
-            this.hideCategory(target.category);
+            this._hideCategory(target.category);
         } else {
             // If selectMultiple is turned on, and we weren't selected, we just
             // want to select ourselves.
             target.addStyleClass("selected");
-            this.showCategory(target.category);
+            this._showCategory(target.category);
         }
     },
 
@@ -190,9 +201,9 @@ WebInspector.AbstractTimelinePanel.prototype = {
         this.summaryBar.element.id = "resources-summary";
         this._containerContentElement.appendChild(this.summaryBar.element);
 
-        this.resourcesGraphsElement = document.createElement("div");
-        this.resourcesGraphsElement.id = "resources-graphs";
-        this._containerContentElement.appendChild(this.resourcesGraphsElement);
+        this.itemsGraphsElement = document.createElement("div");
+        this.itemsGraphsElement.id = "resources-graphs";
+        this._containerContentElement.appendChild(this.itemsGraphsElement);
 
         this.dividersElement = document.createElement("div");
         this.dividersElement.id = "resources-dividers";
@@ -305,6 +316,148 @@ WebInspector.AbstractTimelinePanel.prototype = {
     {
         this._containerContentElement.style.left = width + "px";
         this.updateGraphDividersIfNeeded();
+    },
+
+    refresh: function()
+    {
+        this.needsRefresh = false;
+
+        var staleItemsLength = this._staleItems.length;
+        var boundariesChanged = false;
+
+        for (var i = 0; i < staleItemsLength; ++i) {
+            var item = this._staleItems[i];
+            if (!item._itemTreeElement) {
+                // Create the timeline tree element and graph.
+                item._itemTreeElement = this.createItemTreeElement(item);
+                item._itemTreeElement._itemGraph = this.createItemGraph(item);
+
+                this.itemsTreeElement.appendChild(item._itemTreeElement);
+                this.itemsGraphsElement.appendChild(item._itemTreeElement._itemGraph.graphElement);
+            }
+
+            if (item._itemTreeElement.refresh)
+                item._itemTreeElement.refresh();
+
+            if (this.calculator.updateBoundaries(item))
+                boundariesChanged = true;
+        }
+
+        if (boundariesChanged) {
+            // The boundaries changed, so all item graphs are stale.
+            this._staleItems = this._items;
+            staleItemsLength = this._staleItems.length;
+        }
+
+        for (var i = 0; i < staleItemsLength; ++i)
+            this._staleItems[i]._itemTreeElement._itemGraph.refresh(this.calculator);
+
+        this._staleItems = [];
+
+        this.updateGraphDividersIfNeeded();
+    },
+
+    reset: function()
+    {
+        this.containerElement.scrollTop = 0;
+
+        if (this._calculator)
+            this._calculator.reset();
+
+        if (this._items) {
+            var itemsLength = this._items.length;
+            for (var i = 0; i < itemsLength; ++i) {
+                var item = this._items[i];
+                delete item._itemsTreeElement;
+            }
+        }
+
+        this._items = [];
+        this._staleItems = [];
+
+        this.itemsTreeElement.removeChildren();
+        this.itemsGraphsElement.removeChildren();
+
+        this.updateGraphDividersIfNeeded(true);
+    },
+
+    get calculator()
+    {
+        return this._calculator;
+    },
+
+    set calculator(x)
+    {
+        if (!x || this._calculator === x)
+            return;
+
+        this._calculator = x;
+        this._calculator.reset();
+
+        this._staleItems = this._items;
+        this.refresh();
+    },
+
+    addItem: function(item)
+    {
+        this._items.push(item);
+        this.refreshItem(item);
+    },
+
+    removeItem: function(item)
+    {
+        this._items.remove(item, true);
+
+        if (item._itemTreeElement) {
+            this.itemsTreeElement.removeChild(resource._itemTreeElement);
+            this.itemsGraphsElement.removeChild(resource._itemTreeElement._itemGraph.graphElement);
+        }
+
+        delete item._itemTreeElement;
+        this.adjustScrollPosition();
+    },
+
+    refreshItem: function(item)
+    {
+        this._staleItems.push(item);
+        this.needsRefresh = true;
+    },
+
+    revealAndSelectItem: function(item)
+    {
+        if (item._itemsTreeElement) {
+            item._itemsTreeElement.reveal();
+            item._itemsTreeElement.select(true);
+        }
+    },
+
+    sortItems: function(sortingFunction)
+    {
+        var sortedElements = [].concat(this.itemsTreeElement.children);
+        sortedElements.sort(sortingFunction);
+
+        var sortedElementsLength = sortedElements.length;
+        for (var i = 0; i < sortedElementsLength; ++i) {
+            var treeElement = sortedElements[i];
+            if (treeElement === this.itemsTreeElement.children[i])
+                continue;
+
+            var wasSelected = treeElement.selected;
+            this.itemsTreeElement.removeChild(treeElement);
+            this.itemsTreeElement.insertChild(treeElement, i);
+            if (wasSelected)
+                treeElement.select(true);
+
+            var graphElement = treeElement._itemGraph.graphElement;
+            this.itemsGraphsElement.insertBefore(graphElement, this.itemsGraphsElement.children[i]);
+        }
+    },
+
+    adjustScrollPosition: function()
+    {
+        // Prevent the container from being scrolled off the end.
+        if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight)
+            this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight);
     }
 }
 
@@ -379,3 +532,17 @@ WebInspector.AbstractTimelineCalculator.prototype = {
         return value.toString();
     }
 }
+
+WebInspector.AbstractTimelineCategory = function(name, title, color)
+{
+    this.name = name;
+    this.title = title;
+    this.color = color;
+}
+
+WebInspector.AbstractTimelineCategory.prototype = {
+    toString: function()
+    {
+        return this.title;
+    }
+}
diff --git a/WebCore/inspector/front-end/ResourceCategory.js b/WebCore/inspector/front-end/ResourceCategory.js
index 7b46764..6e94265 100644
--- a/WebCore/inspector/front-end/ResourceCategory.js
+++ b/WebCore/inspector/front-end/ResourceCategory.js
@@ -28,17 +28,11 @@
 
 WebInspector.ResourceCategory = function(name, title, color)
 {
-    this.name = name;
-    this.title = title;
-    this.color = color;
+    WebInspector.AbstractTimelineCategory.call(this, name, title, color);
     this.resources = [];
 }
 
 WebInspector.ResourceCategory.prototype = {
-    toString: function()
-    {
-        return this.title;
-    },
 
     addResource: function(resource)
     {
@@ -67,3 +61,5 @@ WebInspector.ResourceCategory.prototype = {
         this.resources = [];
     }
 }
+
+WebInspector.ResourceCategory.prototype.__proto__ = WebInspector.AbstractTimelineCategory.prototype;
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 71bc9ad..940570f 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -30,6 +30,7 @@
 WebInspector.ResourcesPanel = function()
 {
     WebInspector.AbstractTimelinePanel.call(this);
+
     this.element.addStyleClass("resources");
 
     this._createPanelEnabler();
@@ -65,23 +66,19 @@ WebInspector.ResourcesPanel.prototype = {
         return WebInspector.resourceCategories;
     },
 
-    showCategory: function(category)
+    createItemTreeElement: function(item)
     {
-        var filterClass = "filter-" + category.toLowerCase();
-        this.resourcesGraphsElement.addStyleClass(filterClass);
-        this.resourcesTreeElement.childrenListElement.addStyleClass(filterClass);
+        return new WebInspector.ResourceSidebarTreeElement(item);
     },
-    
-    hideCategory: function(category)
+
+    createItemGraph: function(item)
     {
-        var filterClass = "filter-" + category.toLowerCase();
-        this.resourcesGraphsElement.removeStyleClass(filterClass);
-        this.resourcesTreeElement.childrenListElement.removeStyleClass(filterClass);
+        return new WebInspector.ResourceGraph(item);
     },
 
     isCategoryVisible: function(categoryName)
     {
-        return (this.resourcesGraphsElement.hasStyleClass("filter-all") || this.resourcesGraphsElement.hasStyleClass("filter-" + categoryName.toLowerCase()));
+        return (this.itemsGraphsElement.hasStyleClass("filter-all") || this.itemsGraphsElement.hasStyleClass("filter-" + categoryName.toLowerCase()));
     },
 
     populateSidebar: function()
@@ -119,10 +116,10 @@ WebInspector.ResourcesPanel.prototype = {
         this.graphsTreeElement.appendChild(sizeGraphItem);
         this.graphsTreeElement.expand();
 
-        this.resourcesTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESOURCES"), {}, true);
-        this.sidebarTree.appendChild(this.resourcesTreeElement);
+        this.itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESOURCES"), {}, true);
+        this.sidebarTree.appendChild(this.itemsTreeElement);
 
-        this.resourcesTreeElement.expand();
+        this.itemsTreeElement.expand();
     },
 
     _createPanelEnabler: function()
@@ -229,7 +226,7 @@ WebInspector.ResourcesPanel.prototype = {
         var resourcesLength = this._resources.length;
         for (var i = 0; i < resourcesLength; ++i) {
             var resource = this._resources[i];
-            if (!resource._resourcesTreeElement)
+            if (!resource._itemsTreeElement)
                 continue;
             var resourceView = this.resourceViewForResource(resource);
             if (!resourceView.performSearch || resourceView === visibleView)
@@ -246,7 +243,7 @@ WebInspector.ResourcesPanel.prototype = {
 
         function sortFuction(a, b)
         {
-            return resourceTreeElementSortFunction(a.resource._resourcesTreeElement, b.resource._resourcesTreeElement);
+            return resourceTreeElementSortFunction(a.resource._itemsTreeElement, b.resource._itemsTreeElement);
         }
 
         return sortFuction;
@@ -254,7 +251,7 @@ WebInspector.ResourcesPanel.prototype = {
 
     searchMatchFound: function(view, matches)
     {
-        view.resource._resourcesTreeElement.searchMatches = matches;
+        view.resource._itemsTreeElement.searchMatches = matches;
     },
 
     searchCanceled: function(startingNewSearch)
@@ -266,8 +263,8 @@ WebInspector.ResourcesPanel.prototype = {
 
         for (var i = 0; i < this._resources.length; ++i) {
             var resource = this._resources[i];
-            if (resource._resourcesTreeElement)
-                resource._resourcesTreeElement.updateErrorsAndWarnings();
+            if (resource._itemsTreeElement)
+                resource._itemsTreeElement.updateErrorsAndWarnings();
         }
     },
 
@@ -275,8 +272,8 @@ WebInspector.ResourcesPanel.prototype = {
     {
         for (var i = 0; i < this._resources.length; ++i) {
             var resource = this._resources[i];
-            if (resource._resourcesTreeElement)
-                resource._resourcesTreeElement.resetBubble();
+            if (resource._itemsTreeElement)
+                resource._itemsTreeElement.resetBubble();
         }
 
         WebInspector.Panel.prototype.performSearch.call(this, query);
@@ -289,23 +286,6 @@ WebInspector.ResourcesPanel.prototype = {
         return null;
     },
 
-    get calculator()
-    {
-        return this._calculator;
-    },
-
-    set calculator(x)
-    {
-        if (!x || this._calculator === x)
-            return;
-
-        this._calculator = x;
-        this._calculator.reset();
-
-        this._staleResources = this._resources;
-        this.refresh();
-    },
-
     get sortingFunction()
     {
         return this._sortingFunction;
@@ -319,40 +299,8 @@ WebInspector.ResourcesPanel.prototype = {
 
     refresh: function()
     {
-        this.needsRefresh = false;
+        WebInspector.AbstractTimelinePanel.prototype.refresh.call(this);
 
-        var staleResourcesLength = this._staleResources.length;
-        var boundariesChanged = false;
-
-        for (var i = 0; i < staleResourcesLength; ++i) {
-            var resource = this._staleResources[i];
-            if (!resource._resourcesTreeElement) {
-                // Create the resource tree element and graph.
-                resource._resourcesTreeElement = new WebInspector.ResourceSidebarTreeElement(resource);
-                resource._resourcesTreeElement._resourceGraph = new WebInspector.ResourceGraph(resource);
-
-                this.resourcesTreeElement.appendChild(resource._resourcesTreeElement);
-                this.resourcesGraphsElement.appendChild(resource._resourcesTreeElement._resourceGraph.graphElement);
-            }
-
-            resource._resourcesTreeElement.refresh();
-
-            if (this.calculator.updateBoundaries(resource))
-                boundariesChanged = true;
-        }
-
-        if (boundariesChanged) {
-            // The boundaries changed, so all resource graphs are stale.
-            this._staleResources = this._resources;
-            staleResourcesLength = this._staleResources.length;
-        }
-
-        for (var i = 0; i < staleResourcesLength; ++i)
-            this._staleResources[i]._resourcesTreeElement._resourceGraph.refresh(this.calculator);
-
-        this._staleResources = [];
-
-        this.updateGraphDividersIfNeeded();
         this._sortResourcesIfNeeded();
         this._updateSummaryGraph();
     },
@@ -376,14 +324,9 @@ WebInspector.ResourcesPanel.prototype = {
     {
         this.closeVisibleResource();
 
-        this.containerElement.scrollTop = 0;
-
         delete this.currentQuery;
         this.searchCanceled();
 
-        if (this._calculator)
-            this._calculator.reset();
-
         if (this._resources) {
             var resourcesLength = this._resources.length;
             for (var i = 0; i < resourcesLength; ++i) {
@@ -392,23 +335,18 @@ WebInspector.ResourcesPanel.prototype = {
                 resource.warnings = 0;
                 resource.errors = 0;
 
-                delete resource._resourcesTreeElement;
                 delete resource._resourcesView;
             }
         }
 
-        this._resources = [];
-        this._staleResources = [];
+        WebInspector.AbstractTimelinePanel.prototype.reset.call(this);
         
         this.mainResourceLoadTime = -1;
         this.mainResourceDOMContentTime = -1;
-
-        this.resourcesTreeElement.removeChildren();
+ 
         this.viewsContainerElement.removeChildren();
-        this.resourcesGraphsElement.removeChildren();
-        this.summaryBar.reset();
 
-        this.updateGraphDividersIfNeeded(true);
+        this.summaryBar.reset();
 
         if (InspectorController.resourceTrackingEnabled()) {
             this.enableToggleButton.title = WebInspector.UIString("Resource tracking enabled. Click to disable.");
@@ -436,20 +374,12 @@ WebInspector.ResourcesPanel.prototype = {
         if (this.visibleView === resource._resourcesView)
             this.closeVisibleResource();
 
-        this._resources.remove(resource, true);
-
-        if (resource._resourcesTreeElement) {
-            this.resourcesTreeElement.removeChild(resource._resourcesTreeElement);
-            this.resourcesGraphsElement.removeChild(resource._resourcesTreeElement._resourceGraph.graphElement);
-        }
+        this.removeItem(resource);
 
         resource.warnings = 0;
         resource.errors = 0;
 
-        delete resource._resourcesTreeElement;
         delete resource._resourcesView;
-
-        this._adjustScrollPosition();
     },
 
     addMessageToResource: function(resource, msg)
@@ -466,8 +396,8 @@ WebInspector.ResourcesPanel.prototype = {
             break;
         }
 
-        if (!this.currentQuery && resource._resourcesTreeElement)
-            resource._resourcesTreeElement.updateErrorsAndWarnings();
+        if (!this.currentQuery && resource._itemsTreeElement)
+            resource._itemsTreeElement.updateErrorsAndWarnings();
 
         var view = this.resourceViewForResource(resource);
         if (view.addMessage)
@@ -482,8 +412,8 @@ WebInspector.ResourcesPanel.prototype = {
             resource.warnings = 0;
             resource.errors = 0;
 
-            if (!this.currentQuery && resource._resourcesTreeElement)
-                resource._resourcesTreeElement.updateErrorsAndWarnings();
+            if (!this.currentQuery && resource._itemsTreeElement)
+                resource._itemsTreeElement.updateErrorsAndWarnings();
 
             var view = resource._resourcesView;
             if (!view || !view.clearMessages)
@@ -494,8 +424,7 @@ WebInspector.ResourcesPanel.prototype = {
 
     refreshResource: function(resource)
     {
-        this._staleResources.push(resource);
-        this.needsRefresh = true;
+        this.refreshItem(resource);
     },
 
     recreateViewForResourceIfNeeded: function(resource)
@@ -510,8 +439,8 @@ WebInspector.ResourcesPanel.prototype = {
         resource.warnings = 0;
         resource.errors = 0;
 
-        if (!this.currentQuery && resource._resourcesTreeElement)
-            resource._resourcesTreeElement.updateErrorsAndWarnings();
+        if (!this.currentQuery && resource._itemsTreeElement)
+            resource._itemsTreeElement.updateErrorsAndWarnings();
 
         var oldView = resource._resourcesView;
 
@@ -547,10 +476,7 @@ WebInspector.ResourcesPanel.prototype = {
                 view.highlightLine(line);
         }
 
-        if (resource._resourcesTreeElement) {
-            resource._resourcesTreeElement.reveal();
-            resource._resourcesTreeElement.select(true);
-        }
+        this.revealAndSelectItem(resource);
 
         this.visibleResource = resource;
 
@@ -607,24 +533,7 @@ WebInspector.ResourcesPanel.prototype = {
 
     _sortResourcesIfNeeded: function()
     {
-        var sortedElements = [].concat(this.resourcesTreeElement.children);
-        sortedElements.sort(this.sortingFunction);
-
-        var sortedElementsLength = sortedElements.length;
-        for (var i = 0; i < sortedElementsLength; ++i) {
-            var treeElement = sortedElements[i];
-            if (treeElement === this.resourcesTreeElement.children[i])
-                continue;
-
-            var wasSelected = treeElement.selected;
-            this.resourcesTreeElement.removeChild(treeElement);
-            this.resourcesTreeElement.insertChild(treeElement, i);
-            if (wasSelected)
-                treeElement.select(true);
-
-            var graphElement = treeElement._resourceGraph.graphElement;
-            this.resourcesGraphsElement.insertBefore(graphElement, this.resourcesGraphsElement.children[i]);
-        }
+        this.sortItems(this.sortingFunction);
     },
 
     updateGraphDividersIfNeeded: function(force)
@@ -701,32 +610,25 @@ WebInspector.ResourcesPanel.prototype = {
 
     _toggleLargerResources: function()
     {
-        if (!this.resourcesTreeElement._childrenListNode)
+        if (!this.itemsTreeElement._childrenListNode)
             return;
 
-        this.resourcesTreeElement.smallChildren = !this.resourcesTreeElement.smallChildren;
+        this.itemsTreeElement.smallChildren = !this.itemsTreeElement.smallChildren;
         Preferences.resourcesLargeRows = !Preferences.resourcesLargeRows;
         InspectorController.setSetting("resources-large-rows", Preferences.resourcesLargeRows);
 
-        if (this.resourcesTreeElement.smallChildren) {
-            this.resourcesGraphsElement.addStyleClass("small");
+        if (this.itemsTreeElement.smallChildren) {
+            this.itemsGraphsElement.addStyleClass("small");
             this.largerResourcesButton.title = WebInspector.UIString("Use large resource rows.");
             this.largerResourcesButton.toggled = false;
-            this._adjustScrollPosition();
+            this.adjustScrollPosition();
         } else {
-            this.resourcesGraphsElement.removeStyleClass("small");
+            this.itemsGraphsElement.removeStyleClass("small");
             this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows.");
             this.largerResourcesButton.toggled = true;
         }
     },
 
-    _adjustScrollPosition: function()
-    {
-        // Prevent the container from being scrolled off the end.
-        if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight)
-            this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight);
-    },
-
     _changeSortingFunction: function()
     {
         var selectedOption = this.sortingSelectElement[this.sortingSelectElement.selectedIndex];
@@ -788,6 +690,11 @@ WebInspector.ResourcesPanel.prototype = {
             this.sortingSelectElement.visible = true;
             InspectorController.enableResourceTracking(!!optionalAlways);
         }
+    },
+
+    get _resources()
+    {
+        return this._items;
     }
 }
 
@@ -953,7 +860,7 @@ WebInspector.ResourceTimeCalculator.prototype = {
     _upperBound: function(resource)
     {
         return 0;
-    },
+    }
 }
 
 WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype;
diff --git a/WebCore/inspector/front-end/TimelinePanel.js b/WebCore/inspector/front-end/TimelinePanel.js
index 42d6050..268f10f 100644
--- a/WebCore/inspector/front-end/TimelinePanel.js
+++ b/WebCore/inspector/front-end/TimelinePanel.js
@@ -31,19 +31,18 @@
 WebInspector.TimelinePanel = function()
 {
     WebInspector.AbstractTimelinePanel.call(this);
+
     this.element.addStyleClass("timeline");
 
     this.createInterface();
     this.summaryBar.element.id = "timeline-summary";
-    this.resourcesGraphsElement.id = "timeline-graphs";
+    this.itemsGraphsElement.id = "timeline-graphs";
 
     this._createStatusbarButtons();
 
     this.calculator = new WebInspector.TimelineCalculator();
 
     this.filter(this.filterAllElement, false);
-    this._records = [];
-    this._staleRecords = [];
 }
 
 WebInspector.TimelinePanel.prototype = {
@@ -63,10 +62,10 @@ WebInspector.TimelinePanel.prototype = {
     {
         if (!this._categories) {
             this._categories = {
-                loading: new WebInspector.ResourceCategory("loading", WebInspector.UIString("Loading"), "rgb(47,102,236)"),
-                scripting: new WebInspector.ResourceCategory("scripting", WebInspector.UIString("Scripting"), "rgb(157,231,119)"),
-                rendering: new WebInspector.ResourceCategory("rendering", WebInspector.UIString("Rendering"), "rgb(164,60,255)"),
-                other: new WebInspector.ResourceCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)")
+                loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), "rgb(47,102,236)"),
+                scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), "rgb(157,231,119)"),
+                rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), "rgb(164,60,255)"),
+                other: new WebInspector.TimelineCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)")
             };
         }
         return this._categories;
@@ -74,9 +73,9 @@ WebInspector.TimelinePanel.prototype = {
 
     populateSidebar: function()
     {
-        this.recordsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"), {}, true);
-        this.recordsTreeElement.expanded = true;
-        this.sidebarTree.appendChild(this.recordsTreeElement);
+        this.itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"), {}, true);
+        this.itemsTreeElement.expanded = true;
+        this.sidebarTree.appendChild(this.itemsTreeElement);
     },
 
     _createStatusbarButtons: function()
@@ -100,48 +99,20 @@ WebInspector.TimelinePanel.prototype = {
 
     addRecordToTimeline: function(record)
     {
-        var formattedRecord = this._formatRecord(record);
-        this._records.push(formattedRecord);
-        this._staleRecords.push(formattedRecord);
-        this.needsRefresh = true;
+        this.addItem(this._formatRecord(record));
 
         for (var i = 0; record.children && i < record.children.length; ++i)
             this.addRecordToTimeline(record.children[i]);
     },
 
-    refresh: function()
+    createItemTreeElement: function(item)
     {
-        this.needsRefresh = false;
-
-        var staleRecordsLength = this._staleRecords.length;
-        var boundariesChanged = false;
-
-        for (var i = 0; i < staleRecordsLength; ++i) {
-            var record = this._staleRecords[i];
-            if (!record._timelineTreeElement) {
-                // Create the resource tree element and graph.
-                record._timelineTreeElement = new WebInspector.TimelineRecordTreeElement(record);
-                record._timelineTreeElement._timelineGraph = new WebInspector.TimelineGraph(record);
-                this.recordsTreeElement.appendChild(record._timelineTreeElement);
-                this.resourcesGraphsElement.appendChild(record._timelineTreeElement._timelineGraph.graphElement);
-            }
-
-            if (this.calculator.updateBoundaries(record))
-                boundariesChanged = true;
-        }
-
-        if (boundariesChanged) {
-            // The boundaries changed, so all resource graphs are stale.
-            this._staleRecords = this._records;
-            staleRecordsLength = this._staleRecords.length;
-        }
-
-        for (var i = 0; i < staleRecordsLength; ++i)
-            this._staleRecords[i]._timelineTreeElement._timelineGraph.refresh(this.calculator);
-
-        this._staleRecords = [];
+        return new WebInspector.TimelineRecordTreeElement(item);
+    },
 
-        this.updateGraphDividersIfNeeded();
+    createItemGraph: function(item)
+    {
+        return new WebInspector.TimelineGraph(item);
     },
 
     _toggleTimelineButtonClicked: function()
@@ -152,47 +123,22 @@ WebInspector.TimelinePanel.prototype = {
             InspectorController.startTimelineProfiler();
     },
 
-    reset: function()
-    {
-        this.containerElement.scrollTop = 0;
-
-        this.calculator = new WebInspector.TimelineCalculator();
-
-        if (this._records) {
-            var recordsLength = this._records.length;
-            for (var i = 0; i < recordsLength; ++i) {
-                var record = this._records[i];
-
-                delete record._resourcesTreeElement;
-                delete record._resourcesView;
-            }
-        }
-
-        this._records = [];
-        this._staleRecords = [];
-
-        this.recordsTreeElement.removeChildren();
-        this.resourcesGraphsElement.removeChildren();
-
-        this.updateGraphDividersIfNeeded(true);
-    },
-
     _formatRecord: function(record)
     {
         if (!this._recordStyles) {
             this._recordStyles = {};
             var recordTypes = WebInspector.TimelineAgent.RecordType;
-            this._recordStyles[recordTypes.DOMDispatch] = { title: WebInspector.UIString("DOM Event"), category: this._categories.scripting };
-            this._recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: this._categories.rendering };
-            this._recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: this._categories.rendering };
-            this._recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: this._categories.rendering };
-            this._recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: this._categories.loading };
-            this._recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: this._categories.scripting };
-            this._recordStyles[recordTypes.TimerRemove] = { title: WebInspector.UIString("Remove Timer"), category: this._categories.scripting };
-            this._recordStyles[recordTypes.TimerFire] = { title: WebInspector.UIString("Timer Fired"), category: this._categories.scripting };
-            this._recordStyles[recordTypes.XHRReadyStateChange] = { title: WebInspector.UIString("XHR Ready State Change"), category: this._categories.loading };
-            this._recordStyles[recordTypes.XHRLoad] = { title: WebInspector.UIString("XHR Load"), category: this._categories.loading };
-            this._recordStyles["Other"] = { title: WebInspector.UIString("Other"), icon: 0, category: this._categories.other };
+            this._recordStyles[recordTypes.DOMDispatch] = { title: WebInspector.UIString("DOM Event"), category: this.categories.scripting };
+            this._recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: this.categories.rendering };
+            this._recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: this.categories.rendering };
+            this._recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: this.categories.rendering };
+            this._recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: this.categories.loading };
+            this._recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: this.categories.scripting };
+            this._recordStyles[recordTypes.TimerRemove] = { title: WebInspector.UIString("Remove Timer"), category: this.categories.scripting };
+            this._recordStyles[recordTypes.TimerFire] = { title: WebInspector.UIString("Timer Fired"), category: this.categories.scripting };
+            this._recordStyles[recordTypes.XHRReadyStateChange] = { title: WebInspector.UIString("XHR Ready State Change"), category: this.categories.scripting };
+            this._recordStyles[recordTypes.XHRLoad] = { title: WebInspector.UIString("XHR Load"), category: this.categories.scripting };
+            this._recordStyles["Other"] = { title: WebInspector.UIString("Other"), icon: 0, category: this.categories.other };
         }
 
         var style = this._recordStyles[record.type];
@@ -206,26 +152,23 @@ WebInspector.TimelinePanel.prototype = {
         formattedRecord.data = record.data;
         formattedRecord.endTime = (typeof record.endTime !== "undefined") ? record.endTime / 1000 : formattedRecord.startTime;
         return formattedRecord;
-    },
-
-    showCategory: function(category)
-    {
-        var filterClass = "filter-" + category;
-        this.resourcesGraphsElement.addStyleClass(filterClass);
-        this.recordsTreeElement.childrenListElement.addStyleClass(filterClass);
-    },
-    
-    hideCategory: function(category)
-    {
-        var filterClass = "filter-" + category;
-        this.resourcesGraphsElement.removeStyleClass(filterClass);
-        this.recordsTreeElement.childrenListElement.removeStyleClass(filterClass);
-    },
+    }
 }
 
 WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.AbstractTimelinePanel.prototype;
 
 
+WebInspector.TimelineCategory = function(name, title, color)
+{
+    WebInspector.AbstractTimelineCategory.call(this, name, title, color);
+}
+
+WebInspector.TimelineCategory.prototype = {
+}
+
+WebInspector.TimelineCategory.prototype.__proto__ = WebInspector.AbstractTimelineCategory.prototype;
+
+
 WebInspector.TimelineRecordTreeElement = function(record)
 {
     this._record = record;
@@ -250,7 +193,7 @@ WebInspector.TimelineRecordTreeElement.prototype = {
         typeElement.textContent = this._record.title;
         this.listItemElement.appendChild(typeElement);
 
-        if (this._record.data) {
+        if (this._record.data && this._record.data.type) {
             var separatorElement = document.createElement("span");
             separatorElement.className = "separator";
             separatorElement.textContent = " ";
@@ -363,7 +306,7 @@ WebInspector.TimelineGraph.prototype = {
             this._graphElement.addStyleClass("timeline-category-" + this.record.category.name);
         }
 
-        this._barElement.style.setProperty("left", percentages.middle + "%");
+        this._barElement.style.setProperty("left", percentages.start + "%");
         this._barElement.style.setProperty("right", (100 - percentages.end) + "%");
 
         var tooltip = (labels.tooltip || "");
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index dc8c5c3..78ab23d 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -3348,11 +3348,11 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches {
     top: 0;
     bottom: 0;
     margin: auto -5px;
-    border-width: 6px 7px;
-    height: 13px;
-    min-width: 14px;
-    opacity: 0.65;
-    -webkit-border-image: url(Images/timelineBarGray.png) 6 7 6 7;
+    border-width: 4px 4px 5px;
+    height: 9px;
+    min-width: 7px;
+    opacity: 0.8;
+    -webkit-border-image: url(Images/timelineBarGray.png) 4 4 5 4;
 }
 
 .timeline-graph-side:nth-of-type(2n) {
@@ -3360,15 +3360,15 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches {
 }
 
 .timeline-category-loading .timeline-graph-bar {
-    -webkit-border-image: url(Images/timelineBarBlue.png) 6 7 6 7;
+    -webkit-border-image: url(Images/timelineBarBlue.png) 4 4 5 4;
 }
 
 .timeline-category-scripting .timeline-graph-bar {
-    -webkit-border-image: url(Images/timelineBarOrange.png) 6 7 6 7;
+    -webkit-border-image: url(Images/timelineBarOrange.png) 4 4 5 4;
 }
 
 .timeline-category-rendering .timeline-graph-bar {
-    -webkit-border-image: url(Images/timelineBarPurple.png) 6 7 6 7;
+    -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4;
 }
 
 .timeline-category-loading .timeline-tree-icon {
diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html
index 73968cc..04ab07a 100644
--- a/WebCore/inspector/front-end/inspector.html
+++ b/WebCore/inspector/front-end/inspector.html
@@ -45,6 +45,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="Drawer.js"></script>
     <script type="text/javascript" src="ChangesView.js"></script>
     <script type="text/javascript" src="ConsoleView.js"></script>
+    <script type="text/javascript" src="Panel.js"></script>
+    <script type="text/javascript" src="AbstractTimelinePanel.js"></script>
     <script type="text/javascript" src="Resource.js"></script>
     <script type="text/javascript" src="ResourceCategory.js"></script>
     <script type="text/javascript" src="Database.js"></script>
@@ -70,12 +72,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="EventListenersSidebarPane.js"></script>
     <script type="text/javascript" src="Color.js"></script>
     <script type="text/javascript" src="StylesSidebarPane.js"></script>
-    <script type="text/javascript" src="Panel.js"></script>
     <script type="text/javascript" src="PanelEnablerView.js"></script>
     <script type="text/javascript" src="StatusBarButton.js"></script>
     <script type="text/javascript" src="SummaryBar.js"></script>
     <script type="text/javascript" src="ElementsPanel.js"></script>
-    <script type="text/javascript" src="AbstractTimelinePanel.js"></script>
     <script type="text/javascript" src="ResourcesPanel.js"></script>
     <script type="text/javascript" src="ScriptsPanel.js"></script>
     <script type="text/javascript" src="StoragePanel.js"></script>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list