Commit 28efb0a7 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77127 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9f4a8ccc
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.
......@@ -493,6 +493,11 @@ WebInspector.DataGrid.prototype = {
this._columnWidthsInitialized = false;
},
get scrollContainer()
{
return this._scrollContainer;
},
isScrolledToLastRow: function()
{
return this._scrollContainer.isScrolledToBottom();
......
......@@ -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;
}
}
}
}
......
......@@ -65,6 +65,18 @@
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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment