2011-01-30 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Jan 2011 14:43:18 +0000 (14:43 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Jan 2011 14:43:18 +0000 (14:43 +0000)
        Reviewed by Timothy Hatcher.

        Web Inspector: speed up network panel rendering.
        https://bugs.webkit.org/show_bug.cgi?id=53397

        * inspector/front-end/DataGrid.js:
        (WebInspector.DataGrid.prototype.get scrollContainer):
        * inspector/front-end/NetworkPanel.js:
        (WebInspector.NetworkPanel.prototype.elementsToRestoreScrollPositionsFor):
        (WebInspector.NetworkPanel.prototype._positionSummaryBar):
        (WebInspector.NetworkPanel.prototype._createTable):
        (WebInspector.NetworkPanel.prototype._exportResource):
        (WebInspector.NetworkPanel.prototype._onScroll):
        * inspector/front-end/networkPanel.css:
        (.network-sidebar .data-grid.small tr.offscreen):
        (.network-sidebar .data-grid tr.offscreen):
        (.network-sidebar .data-grid tr.offscreen td):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77127 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/DataGrid.js
Source/WebCore/inspector/front-end/NetworkPanel.js
Source/WebCore/inspector/front-end/networkPanel.css

index 2037922..9c4877e 100644 (file)
@@ -1,3 +1,23 @@
+2011-01-30  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: speed up network panel rendering.
+        https://bugs.webkit.org/show_bug.cgi?id=53397
+
+        * inspector/front-end/DataGrid.js:
+        (WebInspector.DataGrid.prototype.get scrollContainer):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkPanel.prototype.elementsToRestoreScrollPositionsFor):
+        (WebInspector.NetworkPanel.prototype._positionSummaryBar):
+        (WebInspector.NetworkPanel.prototype._createTable):
+        (WebInspector.NetworkPanel.prototype._exportResource):
+        (WebInspector.NetworkPanel.prototype._onScroll):
+        * inspector/front-end/networkPanel.css:
+        (.network-sidebar .data-grid.small tr.offscreen):
+        (.network-sidebar .data-grid tr.offscreen):
+        (.network-sidebar .data-grid tr.offscreen td):
+
 2011-01-31  Peter Varga  <pvarga@webkit.org>
 
         Reviewed by Andreas Kling.
index 5831d1e..45f0b55 100644 (file)
@@ -493,6 +493,11 @@ WebInspector.DataGrid.prototype = {
         this._columnWidthsInitialized = false;
     },
 
+    get scrollContainer()
+    {
+        return this._scrollContainer;        
+    },
+
     isScrolledToLastRow: function()
     {
         return this._scrollContainer.isScrolledToBottom();
index 8bf4cbe..dd507bf 100644 (file)
@@ -103,7 +103,7 @@ WebInspector.NetworkPanel.prototype = {
 
     elementsToRestoreScrollPositionsFor: function()
     {
-        return [this.containerElement];
+        return [this.containerElement, this._dataGrid.scrollContainer];
     },
 
     resize: function()
@@ -158,6 +158,7 @@ WebInspector.NetworkPanel.prototype = {
             this._dataGrid.element.style.bottom = 0;
             this._sortItems();
         }
+        this._updateOffscreenRows();
     },
 
     _resetSummaryBar: function()
@@ -214,6 +215,7 @@ WebInspector.NetworkPanel.prototype = {
         this.containerElement.appendChild(this._dataGrid.element);
         this._dataGrid.addEventListener("sorting changed", this._sortItems, this);
         this._dataGrid.addEventListener("width changed", this._updateDividersIfNeeded, this);
+        this._dataGrid.scrollContainer.addEventListener("scroll", this._updateOffscreenRows.bind(this));
 
         this._patchTimelineHeader();
     },
@@ -1025,6 +1027,36 @@ WebInspector.NetworkPanel.prototype = {
     {
         var har = (new WebInspector.HAREntry(resource)).build();
         offerFileForDownload(JSON.stringify(har));
+    },
+
+    _updateOffscreenRows: function(e)
+    {
+        var dataTableBody = this._dataGrid.dataTableBody;
+        var rows = dataTableBody.children;
+        var recordsCount = rows.length;
+        if (recordsCount < 2)
+            return;  // Filler row only.
+
+        var visibleTop = this._dataGrid.scrollContainer.scrollTop;
+        var visibleBottom = visibleTop + this._dataGrid.scrollContainer.offsetHeight;
+
+        var rowHeight = rows[0].offsetHeight;
+
+        // Filler is at recordsCount - 1.
+        for (var i = 0; i < recordsCount - 1; ++i) {
+            var row = rows[i];
+            // Don't touch summaty - quit instead.
+            if (row === this._summaryBarRowNode)
+                break;
+            var rowIsVisible = i * rowHeight < visibleBottom && (i + 1) * rowHeight > visibleTop;
+            if (rowIsVisible !== row.rowIsVisible) {
+                if (rowIsVisible)
+                    row.removeStyleClass("offscreen");
+                else
+                    row.addStyleClass("offscreen");
+                row.rowIsVisible = rowIsVisible;
+            }
+        }
     }
 }
 
index 95ed1bf..c750323 100644 (file)
     font-weight: bold;
 }
 
+.network-sidebar .data-grid.small tr.offscreen {
+    height: 21px;
+}
+
+.network-sidebar .data-grid tr.offscreen {
+    height: 41px;
+}
+
+.network-sidebar .data-grid tr.offscreen td {
+    display: none;
+}
+
 .network-sidebar .data-grid tr.filler {
     background-color: white;
 }