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

pfeldman at chromium.org pfeldman at chromium.org
Wed Dec 22 13:47:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 93e23273c7e19e2340d69effce46b9bf16ff2c00
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 27 15:59:51 2010 +0000

    2010-09-27  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: Merge AbstractTimelinePanel into ResourcesPanel.
            https://bugs.webkit.org/show_bug.cgi?id=46612
    
            I am refactoring resources panel and would like to merge abstract
            one back in since it is not use anywhere else.
    
            * WebCore.gypi:
            * WebCore.vcproj/WebCore.vcproj:
            * inspector/front-end/AbstractTimelinePanel.js: Removed.
            * inspector/front-end/ResourceCategory.js:
            (WebInspector.ResourceCategory):
            (WebInspector.ResourceCategory.prototype.toString):
            * inspector/front-end/ResourcesPanel.js:
            (WebInspector.ResourcesPanel):
            (WebInspector.ResourcesPanel.prototype.get items):
            (WebInspector.ResourcesPanel.prototype.createInterface):
            (WebInspector.ResourcesPanel.prototype.createFilterPanel.createFilterElement):
            (WebInspector.ResourcesPanel.prototype.createFilterPanel):
            (WebInspector.ResourcesPanel.prototype.showCategory):
            (WebInspector.ResourcesPanel.prototype.hideCategory):
            (WebInspector.ResourcesPanel.prototype.filter):
            (WebInspector.ResourcesPanel.prototype._updateFilter):
            (WebInspector.ResourcesPanel.prototype._updateDividersLabelBarPosition):
            (WebInspector.ResourcesPanel.prototype.get needsRefresh):
            (WebInspector.ResourcesPanel.prototype.set needsRefresh):
            (WebInspector.ResourcesPanel.prototype.refreshIfNeeded):
            (WebInspector.ResourcesPanel.prototype.resize):
            (WebInspector.ResourcesPanel.prototype.invalidateAllItems):
            (WebInspector.ResourcesPanel.prototype.get calculator):
            (WebInspector.ResourcesPanel.prototype.set calculator):
            (WebInspector.ResourcesPanel.prototype.addItem):
            (WebInspector.ResourcesPanel.prototype.removeItem):
            (WebInspector.ResourcesPanel.prototype.refreshItem):
            (WebInspector.ResourcesPanel.prototype.revealAndSelectItem):
            (WebInspector.ResourcesPanel.prototype.sortItems):
            (WebInspector.ResourcesPanel.prototype.adjustScrollPosition):
            (WebInspector.ResourcesPanel.prototype.addEventDivider):
            (WebInspector.ResourcesPanel.prototype.hideEventDividers):
            (WebInspector.ResourcesPanel.prototype.showEventDividers):
            (WebInspector.ResourcesPanel.prototype.show):
            (WebInspector.ResourcesPanel.prototype.refresh):
            (WebInspector.ResourcesPanel.prototype.reset):
            (WebInspector.ResourcesPanel.prototype.updateGraphDividersIfNeeded):
            (WebInspector.ResourcesPanel.prototype.updateMainViewWidth):
            (WebInspector.ResourceBaseCalculator):
            (WebInspector.ResourceBaseCalculator.prototype.computeSummaryValues):
            (WebInspector.ResourceBaseCalculator.prototype.computeBarGraphPercentages):
            (WebInspector.ResourceBaseCalculator.prototype.computeBarGraphLabels):
            (WebInspector.ResourceBaseCalculator.prototype.get boundarySpan):
            (WebInspector.ResourceBaseCalculator.prototype.updateBoundaries):
            (WebInspector.ResourceBaseCalculator.prototype.reset):
            (WebInspector.ResourceBaseCalculator.prototype._value):
            (WebInspector.ResourceBaseCalculator.prototype.formatValue):
            (WebInspector.ResourceTimeCalculator):
            (WebInspector.ResourceTransferSizeCalculator):
            * inspector/front-end/WebKit.qrc:
            * inspector/front-end/inspector.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68394 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8d14d92..051e06b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,65 @@
+2010-09-27  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Merge AbstractTimelinePanel into ResourcesPanel.
+        https://bugs.webkit.org/show_bug.cgi?id=46612
+
+        I am refactoring resources panel and would like to merge abstract
+        one back in since it is not use anywhere else.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/front-end/AbstractTimelinePanel.js: Removed.
+        * inspector/front-end/ResourceCategory.js:
+        (WebInspector.ResourceCategory):
+        (WebInspector.ResourceCategory.prototype.toString):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel):
+        (WebInspector.ResourcesPanel.prototype.get items):
+        (WebInspector.ResourcesPanel.prototype.createInterface):
+        (WebInspector.ResourcesPanel.prototype.createFilterPanel.createFilterElement):
+        (WebInspector.ResourcesPanel.prototype.createFilterPanel):
+        (WebInspector.ResourcesPanel.prototype.showCategory):
+        (WebInspector.ResourcesPanel.prototype.hideCategory):
+        (WebInspector.ResourcesPanel.prototype.filter):
+        (WebInspector.ResourcesPanel.prototype._updateFilter):
+        (WebInspector.ResourcesPanel.prototype._updateDividersLabelBarPosition):
+        (WebInspector.ResourcesPanel.prototype.get needsRefresh):
+        (WebInspector.ResourcesPanel.prototype.set needsRefresh):
+        (WebInspector.ResourcesPanel.prototype.refreshIfNeeded):
+        (WebInspector.ResourcesPanel.prototype.resize):
+        (WebInspector.ResourcesPanel.prototype.invalidateAllItems):
+        (WebInspector.ResourcesPanel.prototype.get calculator):
+        (WebInspector.ResourcesPanel.prototype.set calculator):
+        (WebInspector.ResourcesPanel.prototype.addItem):
+        (WebInspector.ResourcesPanel.prototype.removeItem):
+        (WebInspector.ResourcesPanel.prototype.refreshItem):
+        (WebInspector.ResourcesPanel.prototype.revealAndSelectItem):
+        (WebInspector.ResourcesPanel.prototype.sortItems):
+        (WebInspector.ResourcesPanel.prototype.adjustScrollPosition):
+        (WebInspector.ResourcesPanel.prototype.addEventDivider):
+        (WebInspector.ResourcesPanel.prototype.hideEventDividers):
+        (WebInspector.ResourcesPanel.prototype.showEventDividers):
+        (WebInspector.ResourcesPanel.prototype.show):
+        (WebInspector.ResourcesPanel.prototype.refresh):
+        (WebInspector.ResourcesPanel.prototype.reset):
+        (WebInspector.ResourcesPanel.prototype.updateGraphDividersIfNeeded):
+        (WebInspector.ResourcesPanel.prototype.updateMainViewWidth):
+        (WebInspector.ResourceBaseCalculator):
+        (WebInspector.ResourceBaseCalculator.prototype.computeSummaryValues):
+        (WebInspector.ResourceBaseCalculator.prototype.computeBarGraphPercentages):
+        (WebInspector.ResourceBaseCalculator.prototype.computeBarGraphLabels):
+        (WebInspector.ResourceBaseCalculator.prototype.get boundarySpan):
+        (WebInspector.ResourceBaseCalculator.prototype.updateBoundaries):
+        (WebInspector.ResourceBaseCalculator.prototype.reset):
+        (WebInspector.ResourceBaseCalculator.prototype._value):
+        (WebInspector.ResourceBaseCalculator.prototype.formatValue):
+        (WebInspector.ResourceTimeCalculator):
+        (WebInspector.ResourceTransferSizeCalculator):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+
 2010-09-27  Ragner Magalhaes  <ragner.magalhaes at openbossa.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 7cf50aa..732972c 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -4224,7 +4224,6 @@
         'webinspector_files': [
 
             'inspector/front-end/inspector.html',
-            'inspector/front-end/AbstractTimelinePanel.js',
             'inspector/front-end/ApplicationCacheItemsView.js',
             'inspector/front-end/AuditCategories.js',
             'inspector/front-end/AuditFormatters.js',
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 55c8d72..7c65c12 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -52540,10 +52540,6 @@
 				Name="front-end"
 				>
 				<File
-					RelativePath="..\inspector\front-end\AbstractTimelinePanel.js"
-					>
-				</File>
-				<File
 					RelativePath="..\inspector\front-end\ApplicationCacheItemsView.js"
 					>
 				</File>
diff --git a/WebCore/inspector/front-end/AbstractTimelinePanel.js b/WebCore/inspector/front-end/AbstractTimelinePanel.js
deleted file mode 100644
index 187ef86..0000000
--- a/WebCore/inspector/front-end/AbstractTimelinePanel.js
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Anthony Ricaud <rik at webkit.org>
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.AbstractTimelinePanel = function(name)
-{
-    WebInspector.Panel.call(this, name);
-    this._items = [];
-    this._staleItems = [];
-}
-
-WebInspector.AbstractTimelinePanel.prototype = {
-    get categories()
-    {
-        // Should be implemented by the concrete subclasses.
-        return {};
-    },
-
-    populateSidebar: function()
-    {
-        // Should be implemented by the concrete subclasses.
-    },
-
-    createItemTreeElement: function(item)
-    {
-        // Should be implemented by the concrete subclasses.
-    },
-
-    createItemGraph: function(item)
-    {
-        // Should be implemented by the concrete subclasses.
-    },
-
-    get items()
-    {
-        return this._items;
-    },
-
-    createInterface: function()
-    {
-        this.containerElement = document.createElement("div");
-        this.containerElement.id = "resources-container";
-        this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false);
-        this.element.appendChild(this.containerElement);
-
-        this.createSidebar(this.containerElement, this.element);
-        this.sidebarElement.id = "resources-sidebar";
-        this.populateSidebar();
-
-        this._containerContentElement = document.createElement("div");
-        this._containerContentElement.id = "resources-container-content";
-        this.containerElement.appendChild(this._containerContentElement);
-
-        this.summaryBar = new WebInspector.SummaryBar(this.categories);
-        this.summaryBar.element.id = "resources-summary";
-        this._containerContentElement.appendChild(this.summaryBar.element);
-
-        this._timelineGrid = new WebInspector.TimelineGrid();
-        this._containerContentElement.appendChild(this._timelineGrid.element);
-        this.itemsGraphsElement = this._timelineGrid.itemsGraphsElement;
-    },
-
-    createFilterPanel: function()
-    {
-        this.filterBarElement = document.createElement("div");
-        this.filterBarElement.id = "resources-filter";
-        this.filterBarElement.className = "scope-bar";
-        this.element.appendChild(this.filterBarElement);
-
-        function createFilterElement(category)
-        {
-            if (category === "all")
-                var label = WebInspector.UIString("All");
-            else if (this.categories[category])
-                var label = this.categories[category].title;
-
-            var categoryElement = document.createElement("li");
-            categoryElement.category = category;
-            categoryElement.addStyleClass(category);
-            categoryElement.appendChild(document.createTextNode(label));
-            categoryElement.addEventListener("click", this._updateFilter.bind(this), false);
-            this.filterBarElement.appendChild(categoryElement);
-
-            return categoryElement;
-        }
-
-        this.filterAllElement = createFilterElement.call(this, "all");
-
-        // Add a divider
-        var dividerElement = document.createElement("div");
-        dividerElement.addStyleClass("divider");
-        this.filterBarElement.appendChild(dividerElement);
-
-        for (var category in this.categories)
-            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()
-        {
-            for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) {
-                var child = this.filterBarElement.childNodes[i];
-                if (!child.category)
-                    continue;
-
-                child.removeStyleClass("selected");
-                this.hideCategory(child.category);
-            }
-        }
-
-        if (target === this.filterAllElement) {
-            if (target.hasStyleClass("selected")) {
-                // We can't unselect All, so we break early here
-                return;
-            }
-
-            // If All wasn't selected, and now is, unselect everything else.
-            unselectAll.call(this);
-        } else {
-            // 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");
-            }
-        }
-
-        if (!selectMultiple) {
-            // If multiple selection is off, we want to unselect everything else
-            // and just select ourselves.
-            unselectAll.call(this);
-
-            target.addStyleClass("selected");
-            this.showCategory(target.category);
-            return;
-        }
-
-        if (target.hasStyleClass("selected")) {
-            // If selectMultiple is turned on, and we were selected, we just
-            // want to unselect ourselves.
-            target.removeStyleClass("selected");
-            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);
-        }
-    },
-
-    _updateFilter: function(e)
-    {
-        var isMac = WebInspector.isMac();
-        var selectMultiple = false;
-        if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
-            selectMultiple = true;
-        if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
-            selectMultiple = true;
-
-        this.filter(e.target, selectMultiple);
-
-        // When we are updating our filtering, scroll to the top so we don't end up
-        // in blank graph under all the resources.
-        this.containerElement.scrollTop = 0;
-
-        var searchField = document.getElementById("search");
-        WebInspector.doPerformSearch(searchField.value, WebInspector.shortSearchWasForcedByKeyEvent, false, true);
-    },
-
-    updateGraphDividersIfNeeded: function(force)
-    {
-        if (!this.visible) {
-            this.needsRefresh = true;
-            return false;
-        }
-        return this._timelineGrid.updateDividers(force, this.calculator);
-    },
-
-    _updateDividersLabelBarPosition: function()
-    {
-        const scrollTop = this.containerElement.scrollTop;
-        const offsetHeight = this.summaryBar.element.offsetHeight;
-        const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop);
-        this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop);
-    },
-
-    get needsRefresh()
-    {
-        return this._needsRefresh;
-    },
-
-    set needsRefresh(x)
-    {
-        if (this._needsRefresh === x)
-            return;
-
-        this._needsRefresh = x;
-
-        if (x) {
-            if (this.visible && !("_refreshTimeout" in this))
-                this._refreshTimeout = setTimeout(this.refresh.bind(this), 500);
-        } else {
-            if ("_refreshTimeout" in this) {
-                clearTimeout(this._refreshTimeout);
-                delete this._refreshTimeout;
-            }
-        }
-    },
-
-    refreshIfNeeded: function()
-    {
-        if (this.needsRefresh)
-            this.refresh();
-    },
-
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
-
-        this._updateDividersLabelBarPosition();
-        this.refreshIfNeeded();
-    },
-
-    resize: function()
-    {
-        WebInspector.Panel.prototype.resize.call(this);
-
-        this.updateGraphDividersIfNeeded();
-    },
-
-    updateMainViewWidth: function(width)
-    {
-        this._containerContentElement.style.left = width + "px";
-        this.resize();
-    },
-
-    invalidateAllItems: function()
-    {
-        this._staleItems = this._items.slice();
-    },
-
-    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._itemsTreeElement) {
-                // Create the timeline tree element and graph.
-                item._itemsTreeElement = this.createItemTreeElement(item);
-                item._itemsTreeElement._itemGraph = this.createItemGraph(item);
-
-                this.itemsTreeElement.appendChild(item._itemsTreeElement);
-                this.itemsGraphsElement.appendChild(item._itemsTreeElement._itemGraph.graphElement);
-            }
-
-            if (item._itemsTreeElement.refresh)
-                item._itemsTreeElement.refresh();
-
-            if (this.calculator.updateBoundaries(item))
-                boundariesChanged = true;
-        }
-
-        if (boundariesChanged) {
-            // The boundaries changed, so all item graphs are stale.
-            this._staleItems = this._items.slice();
-            staleItemsLength = this._staleItems.length;
-        }
-
-
-        const isBarOpaqueAtLeft = this.sidebarTree.selectedTreeElement && this.sidebarTree.selectedTreeElement.isBarOpaqueAtLeft;
-        for (var i = 0; i < staleItemsLength; ++i)
-            this._staleItems[i]._itemsTreeElement._itemGraph.refresh(this.calculator, isBarOpaqueAtLeft);
-
-        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.slice();
-        this.refresh();
-    },
-
-    addItem: function(item)
-    {
-        this._items.push(item);
-        this.refreshItem(item);
-    },
-
-    removeItem: function(item)
-    {
-        this._items.remove(item, true);
-
-        if (item._itemsTreeElement) {
-            this.itemsTreeElement.removeChild(item._itemsTreeElement);
-            this.itemsGraphsElement.removeChild(item._itemsTreeElement._itemGraph.graphElement);
-        }
-
-        delete item._itemsTreeElement;
-        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);
-    },
-
-    addEventDivider: function(divider)
-    {
-        this._timelineGrid.addEventDivider(divider);
-    },
-
-    hideEventDividers: function()
-    {
-        this._timelineGrid.hideEventDividers();
-    },
-
-    showEventDividers: function()
-    {
-        this._timelineGrid.showEventDividers();
-    }
-}
-
-WebInspector.AbstractTimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
-WebInspector.AbstractTimelineCalculator = function()
-{
-}
-
-WebInspector.AbstractTimelineCalculator.prototype = {
-    computeSummaryValues: function(items)
-    {
-        var total = 0;
-        var categoryValues = {};
-
-        var itemsLength = items.length;
-        for (var i = 0; i < itemsLength; ++i) {
-            var item = items[i];
-            var value = this._value(item);
-            if (typeof value === "undefined")
-                continue;
-            if (!(item.category.name in categoryValues))
-                categoryValues[item.category.name] = 0;
-            categoryValues[item.category.name] += value;
-            total += value;
-        }
-
-        return {categoryValues: categoryValues, total: total};
-    },
-
-    computeBarGraphPercentages: function(item)
-    {
-        return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100};
-    },
-
-    computeBarGraphLabels: function(item)
-    {
-        const label = this.formatValue(this._value(item));
-        return {left: label, right: label, tooltip: label};
-    },
-
-    get boundarySpan()
-    {
-        return this.maximumBoundary - this.minimumBoundary;
-    },
-
-    updateBoundaries: function(item)
-    {
-        this.minimumBoundary = 0;
-
-        var value = this._value(item);
-        if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) {
-            this.maximumBoundary = value;
-            return true;
-        }
-        return false;
-    },
-
-    reset: function()
-    {
-        delete this.minimumBoundary;
-        delete this.maximumBoundary;
-    },
-
-    _value: function(item)
-    {
-        return 0;
-    },
-
-    formatValue: function(value)
-    {
-        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 6e94265..84f2cf9 100644
--- a/WebCore/inspector/front-end/ResourceCategory.js
+++ b/WebCore/inspector/front-end/ResourceCategory.js
@@ -28,12 +28,19 @@
 
 WebInspector.ResourceCategory = function(name, title, color)
 {
-    WebInspector.AbstractTimelineCategory.call(this, name, title, color);
+    this.name = name;
+    this.title = title;
+    this.color = color;
     this.resources = [];
 }
 
 WebInspector.ResourceCategory.prototype = {
 
+    toString: function()
+    {
+        return this.title;
+    },
+
     addResource: function(resource)
     {
         var a = resource;
@@ -61,5 +68,3 @@ 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 f329b1a..aa021ff 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -29,7 +29,10 @@
 
 WebInspector.ResourcesPanel = function()
 {
-    WebInspector.AbstractTimelinePanel.call(this, "resources");
+    WebInspector.Panel.call(this, "resources");
+
+    this._items = [];
+    this._staleItems = [];
 
     this._createPanelEnabler();
 
@@ -82,6 +85,299 @@ WebInspector.ResourcesPanel.prototype = {
         return (this.itemsGraphsElement.hasStyleClass("filter-all") || this.itemsGraphsElement.hasStyleClass("filter-" + categoryName.toLowerCase()));
     },
 
+    get items()
+    {
+        return this._items;
+    },
+
+    createInterface: function()
+    {
+        this.containerElement = document.createElement("div");
+        this.containerElement.id = "resources-container";
+        this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false);
+        this.element.appendChild(this.containerElement);
+
+        this.createSidebar(this.containerElement, this.element);
+        this.sidebarElement.id = "resources-sidebar";
+        this.populateSidebar();
+
+        this._containerContentElement = document.createElement("div");
+        this._containerContentElement.id = "resources-container-content";
+        this.containerElement.appendChild(this._containerContentElement);
+
+        this.summaryBar = new WebInspector.SummaryBar(this.categories);
+        this.summaryBar.element.id = "resources-summary";
+        this._containerContentElement.appendChild(this.summaryBar.element);
+
+        this._timelineGrid = new WebInspector.TimelineGrid();
+        this._containerContentElement.appendChild(this._timelineGrid.element);
+        this.itemsGraphsElement = this._timelineGrid.itemsGraphsElement;
+    },
+
+    createFilterPanel: function()
+    {
+        this.filterBarElement = document.createElement("div");
+        this.filterBarElement.id = "resources-filter";
+        this.filterBarElement.className = "scope-bar";
+        this.element.appendChild(this.filterBarElement);
+
+        function createFilterElement(category)
+        {
+            if (category === "all")
+                var label = WebInspector.UIString("All");
+            else if (this.categories[category])
+                var label = this.categories[category].title;
+
+            var categoryElement = document.createElement("li");
+            categoryElement.category = category;
+            categoryElement.addStyleClass(category);
+            categoryElement.appendChild(document.createTextNode(label));
+            categoryElement.addEventListener("click", this._updateFilter.bind(this), false);
+            this.filterBarElement.appendChild(categoryElement);
+
+            return categoryElement;
+        }
+
+        this.filterAllElement = createFilterElement.call(this, "all");
+
+        // Add a divider
+        var dividerElement = document.createElement("div");
+        dividerElement.addStyleClass("divider");
+        this.filterBarElement.appendChild(dividerElement);
+
+        for (var category in this.categories)
+            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()
+        {
+            for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) {
+                var child = this.filterBarElement.childNodes[i];
+                if (!child.category)
+                    continue;
+
+                child.removeStyleClass("selected");
+                this.hideCategory(child.category);
+            }
+        }
+
+        if (target === this.filterAllElement) {
+            if (target.hasStyleClass("selected")) {
+                // We can't unselect All, so we break early here
+                return;
+            }
+
+            // If All wasn't selected, and now is, unselect everything else.
+            unselectAll.call(this);
+        } else {
+            // 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");
+            }
+        }
+
+        if (!selectMultiple) {
+            // If multiple selection is off, we want to unselect everything else
+            // and just select ourselves.
+            unselectAll.call(this);
+
+            target.addStyleClass("selected");
+            this.showCategory(target.category);
+            return;
+        }
+
+        if (target.hasStyleClass("selected")) {
+            // If selectMultiple is turned on, and we were selected, we just
+            // want to unselect ourselves.
+            target.removeStyleClass("selected");
+            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);
+        }
+    },
+
+    _updateFilter: function(e)
+    {
+        var isMac = WebInspector.isMac();
+        var selectMultiple = false;
+        if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
+            selectMultiple = true;
+        if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
+            selectMultiple = true;
+
+        this.filter(e.target, selectMultiple);
+
+        // When we are updating our filtering, scroll to the top so we don't end up
+        // in blank graph under all the resources.
+        this.containerElement.scrollTop = 0;
+
+        var searchField = document.getElementById("search");
+        WebInspector.doPerformSearch(searchField.value, WebInspector.shortSearchWasForcedByKeyEvent, false, true);
+    },
+
+    _updateDividersLabelBarPosition: function()
+    {
+        const scrollTop = this.containerElement.scrollTop;
+        const offsetHeight = this.summaryBar.element.offsetHeight;
+        const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop);
+        this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop);
+    },
+
+    get needsRefresh()
+    {
+        return this._needsRefresh;
+    },
+
+    set needsRefresh(x)
+    {
+        if (this._needsRefresh === x)
+            return;
+
+        this._needsRefresh = x;
+
+        if (x) {
+            if (this.visible && !("_refreshTimeout" in this))
+                this._refreshTimeout = setTimeout(this.refresh.bind(this), 500);
+        } else {
+            if ("_refreshTimeout" in this) {
+                clearTimeout(this._refreshTimeout);
+                delete this._refreshTimeout;
+            }
+        }
+    },
+
+    refreshIfNeeded: function()
+    {
+        if (this.needsRefresh)
+            this.refresh();
+    },
+
+    resize: function()
+    {
+        WebInspector.Panel.prototype.resize.call(this);
+
+        this.updateGraphDividersIfNeeded();
+    },
+
+    invalidateAllItems: function()
+    {
+        this._staleItems = this._items.slice();
+    },
+
+    get calculator()
+    {
+        return this._calculator;
+    },
+
+    set calculator(x)
+    {
+        if (!x || this._calculator === x)
+            return;
+
+        this._calculator = x;
+        this._calculator.reset();
+
+        this._staleItems = this._items.slice();
+        this.refresh();
+    },
+
+    addItem: function(item)
+    {
+        this._items.push(item);
+        this.refreshItem(item);
+    },
+
+    removeItem: function(item)
+    {
+        this._items.remove(item, true);
+
+        if (item._itemsTreeElement) {
+            this.itemsTreeElement.removeChild(item._itemsTreeElement);
+            this.itemsGraphsElement.removeChild(item._itemsTreeElement._itemGraph.graphElement);
+        }
+
+        delete item._itemsTreeElement;
+        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);
+    },
+
+    addEventDivider: function(divider)
+    {
+        this._timelineGrid.addEventDivider(divider);
+    },
+
+    hideEventDividers: function()
+    {
+        this._timelineGrid.hideEventDividers();
+    },
+
+    showEventDividers: function()
+    {
+        this._timelineGrid.showEventDividers();
+    },
+
     populateSidebar: function()
     {
         this.timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time"));
@@ -223,7 +519,10 @@ WebInspector.ResourcesPanel.prototype = {
 
     show: function()
     {
-        WebInspector.AbstractTimelinePanel.prototype.show.call(this);
+        WebInspector.Panel.prototype.show.call(this);
+
+        this._updateDividersLabelBarPosition();
+        this.refreshIfNeeded();
 
         var visibleView = this.visibleView;
         if (this.visibleResource) {
@@ -329,7 +628,44 @@ WebInspector.ResourcesPanel.prototype = {
 
     refresh: function()
     {
-        WebInspector.AbstractTimelinePanel.prototype.refresh.call(this);
+        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._itemsTreeElement) {
+                // Create the timeline tree element and graph.
+                item._itemsTreeElement = this.createItemTreeElement(item);
+                item._itemsTreeElement._itemGraph = this.createItemGraph(item);
+
+                this.itemsTreeElement.appendChild(item._itemsTreeElement);
+                this.itemsGraphsElement.appendChild(item._itemsTreeElement._itemGraph.graphElement);
+            }
+
+            if (item._itemsTreeElement.refresh)
+                item._itemsTreeElement.refresh();
+
+            if (this.calculator.updateBoundaries(item))
+                boundariesChanged = true;
+        }
+
+        if (boundariesChanged) {
+            // The boundaries changed, so all item graphs are stale.
+            this._staleItems = this._items.slice();
+            staleItemsLength = this._staleItems.length;
+        }
+
+
+        const isBarOpaqueAtLeft = this.sidebarTree.selectedTreeElement && this.sidebarTree.selectedTreeElement.isBarOpaqueAtLeft;
+        for (var i = 0; i < staleItemsLength; ++i)
+            this._staleItems[i]._itemsTreeElement._itemGraph.refresh(this.calculator, isBarOpaqueAtLeft);
+
+        this._staleItems = [];
+
+        this.updateGraphDividersIfNeeded();
 
         this._sortResourcesIfNeeded();
         this._updateSummaryGraph();
@@ -373,7 +709,28 @@ WebInspector.ResourcesPanel.prototype = {
             }
         }
 
-        WebInspector.AbstractTimelinePanel.prototype.reset.call(this);
+        // Begin reset timeline
+        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);
+        // End reset timeline.
         
         this.mainResourceLoadTime = -1;
         this.mainResourceDOMContentTime = -1;
@@ -585,7 +942,12 @@ WebInspector.ResourcesPanel.prototype = {
 
     updateGraphDividersIfNeeded: function(force)
     {
-        var proceed = WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded.call(this, force);
+        var proceed = true;
+        if (!this.visible) {
+            this.needsRefresh = true;
+            proceed = false;
+        } else
+            proceed = this._timelineGrid.updateDividers(force, this.calculator);
         
         if (!proceed)
             return;
@@ -739,8 +1101,7 @@ WebInspector.ResourcesPanel.prototype = {
     updateMainViewWidth: function(width)
     {
         this.viewsContainerElement.style.left = width + "px";
-
-        WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth.call(this, width);
+        this._containerContentElement.style.left = width + "px";
         this.resize();
     },
 
@@ -918,16 +1279,86 @@ WebInspector.ResourcesPanel.prototype = {
     }
 }
 
-WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.AbstractTimelinePanel.prototype;
+WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
 
 WebInspector.getResourceContent = function(identifier, callback)
 {
     InspectorBackend.getResourceContent(identifier, callback);
 }
 
+WebInspector.ResourceBaseCalculator = function()
+{
+}
+
+WebInspector.ResourceBaseCalculator.prototype = {
+    computeSummaryValues: function(items)
+    {
+        var total = 0;
+        var categoryValues = {};
+
+        var itemsLength = items.length;
+        for (var i = 0; i < itemsLength; ++i) {
+            var item = items[i];
+            var value = this._value(item);
+            if (typeof value === "undefined")
+                continue;
+            if (!(item.category.name in categoryValues))
+                categoryValues[item.category.name] = 0;
+            categoryValues[item.category.name] += value;
+            total += value;
+        }
+
+        return {categoryValues: categoryValues, total: total};
+    },
+
+    computeBarGraphPercentages: function(item)
+    {
+        return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100};
+    },
+
+    computeBarGraphLabels: function(item)
+    {
+        const label = this.formatValue(this._value(item));
+        return {left: label, right: label, tooltip: label};
+    },
+
+    get boundarySpan()
+    {
+        return this.maximumBoundary - this.minimumBoundary;
+    },
+
+    updateBoundaries: function(item)
+    {
+        this.minimumBoundary = 0;
+
+        var value = this._value(item);
+        if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) {
+            this.maximumBoundary = value;
+            return true;
+        }
+        return false;
+    },
+
+    reset: function()
+    {
+        delete this.minimumBoundary;
+        delete this.maximumBoundary;
+    },
+
+    _value: function(item)
+    {
+        return 0;
+    },
+
+    formatValue: function(value)
+    {
+        return value.toString();
+    }
+}
+
 WebInspector.ResourceTimeCalculator = function(startAtZero)
 {
-    WebInspector.AbstractTimelineCalculator.call(this);
+    WebInspector.ResourceBaseCalculator.call(this);
     this.startAtZero = startAtZero;
 }
 
@@ -1092,7 +1523,7 @@ WebInspector.ResourceTimeCalculator.prototype = {
     }
 }
 
-WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype;
+WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.ResourceBaseCalculator.prototype;
 
 WebInspector.ResourceTransferTimeCalculator = function()
 {
@@ -1139,7 +1570,7 @@ WebInspector.ResourceTransferDurationCalculator.prototype.__proto__ = WebInspect
 
 WebInspector.ResourceTransferSizeCalculator = function()
 {
-    WebInspector.AbstractTimelineCalculator.call(this);
+    WebInspector.ResourceBaseCalculator.call(this);
 }
 
 WebInspector.ResourceTransferSizeCalculator.prototype = {
@@ -1186,7 +1617,7 @@ WebInspector.ResourceTransferSizeCalculator.prototype = {
     }
 }
 
-WebInspector.ResourceTransferSizeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype;
+WebInspector.ResourceTransferSizeCalculator.prototype.__proto__ = WebInspector.ResourceBaseCalculator.prototype;
 
 WebInspector.ResourceSidebarTreeElement = function(resource)
 {
diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc
index c222f0e..8593c2a 100644
--- a/WebCore/inspector/front-end/WebKit.qrc
+++ b/WebCore/inspector/front-end/WebKit.qrc
@@ -1,7 +1,6 @@
 <!DOCTYPE RCC><RCC version="1.0">
 <qresource prefix="/webkit/inspector">
     <file>inspector.html</file>
-    <file>AbstractTimelinePanel.js</file>
     <file>ApplicationCacheItemsView.js</file>
     <file>AuditCategories.js</file>
     <file>AuditFormatters.js</file>
diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html
index 0536ee6..3baf502 100644
--- a/WebCore/inspector/front-end/inspector.html
+++ b/WebCore/inspector/front-end/inspector.html
@@ -58,7 +58,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="ConsoleView.js"></script>
     <script type="text/javascript" src="Panel.js"></script>
     <script type="text/javascript" src="TimelineGrid.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>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list