2011-02-04 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 14:22:05 +0000 (14:22 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 14:22:05 +0000 (14:22 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: Network panel filtering is broken.
        https://bugs.webkit.org/show_bug.cgi?id=53764

        * inspector/front-end/NetworkPanel.js:
        (WebInspector.NetworkPanel.prototype._sortItems):
        (WebInspector.NetworkPanel.prototype._sortByTimeline):
        (WebInspector.NetworkPanel.prototype._filter):
        (WebInspector.NetworkPanel.prototype._updateOffscreenRows):
        (WebInspector.NetworkDataGridNode.prototype.isFilteredOut):
        (WebInspector.NetworkDataGridNode.prototype.get selectable):
        (WebInspector.NetworkTotalGridNode.prototype.isFilteredOut):
        (WebInspector.NetworkTotalGridNode.prototype.get selectable):

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/NetworkPanel.js

index eb0e42f8eed9ea145756f1e5d9511878cf18afcd..761619786180078aca5de0a251c560d7a3d1c5be 100644 (file)
@@ -1,3 +1,20 @@
+2011-02-04  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: Network panel filtering is broken.
+        https://bugs.webkit.org/show_bug.cgi?id=53764
+
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkPanel.prototype._sortItems):
+        (WebInspector.NetworkPanel.prototype._sortByTimeline):
+        (WebInspector.NetworkPanel.prototype._filter):
+        (WebInspector.NetworkPanel.prototype._updateOffscreenRows):
+        (WebInspector.NetworkDataGridNode.prototype.isFilteredOut):
+        (WebInspector.NetworkDataGridNode.prototype.get selectable):
+        (WebInspector.NetworkTotalGridNode.prototype.isFilteredOut):
+        (WebInspector.NetworkTotalGridNode.prototype.get selectable):
+
 2011-02-04  Andrey Kosyakov  <caseq@chromium.org>
 
         Reviewed by Pavel Feldman.
index 485856ebe89c106a088905b9db389ed7b6848244..b4ae91066517a826f5f014aeaee873b054abc00f 100644 (file)
@@ -314,6 +314,7 @@ WebInspector.NetworkPanel.prototype = {
 
         this._dataGrid.sortNodes(sortingFunction, this._dataGrid.sortOrder === "descending");
         this._timelineSortSelector.selectedIndex = 0;
+        this._updateOffscreenRows();
     },
 
     _sortByTimeline: function()
@@ -332,6 +333,7 @@ WebInspector.NetworkPanel.prototype = {
         else
             this._timelineGrid.showEventDividers();
         this._dataGrid.markColumnAsSortedBy("timeline", "ascending");
+        this._updateOffscreenRows();
     },
 
     _createFilterStatusBarItems: function()
@@ -490,6 +492,7 @@ WebInspector.NetworkPanel.prototype = {
             target.addStyleClass("selected");
             this._showCategory(target.category);
         }
+        this._updateOffscreenRows();
     },
 
     _scheduleRefresh: function()
@@ -1040,15 +1043,26 @@ WebInspector.NetworkPanel.prototype = {
         var visibleTop = this._dataGrid.scrollContainer.scrollTop;
         var visibleBottom = visibleTop + this._dataGrid.scrollContainer.offsetHeight;
 
-        var rowHeight = rows[0].offsetHeight;
+        var rowHeight = 0;
 
         // Filler is at recordsCount - 1.
+        var unfilteredRowIndex = 0;
         for (var i = 0; i < recordsCount - 1; ++i) {
             var row = rows[i];
             // Don't touch summaty - quit instead.
-            if (row === this._summaryBarRowNode)
+            if (this._summaryBarRowNode && row === this._summaryBarRowNode.element)
                 break;
-            var rowIsVisible = i * rowHeight < visibleBottom && (i + 1) * rowHeight > visibleTop;
+
+            var dataGridNode = this._dataGrid.dataGridNodeFromNode(row);
+            if (dataGridNode.isFilteredOut()) {
+                row.removeStyleClass("offscreen");
+                continue;
+            }
+
+            if (!rowHeight)
+                rowHeight = row.offsetHeight;
+
+            var rowIsVisible = unfilteredRowIndex * rowHeight < visibleBottom && (unfilteredRowIndex + 1) * rowHeight > visibleTop;
             if (rowIsVisible !== row.rowIsVisible) {
                 if (rowIsVisible)
                     row.removeStyleClass("offscreen");
@@ -1056,6 +1070,7 @@ WebInspector.NetworkPanel.prototype = {
                     row.addStyleClass("offscreen");
                 row.rowIsVisible = rowIsVisible;
             }
+            unfilteredRowIndex++;
         }
     }
 }
@@ -1364,6 +1379,13 @@ WebInspector.NetworkDataGridNode.prototype = {
         this._nameCell.addEventListener("click", this.select.bind(this), false);
     },
 
+    isFilteredOut: function()
+    {
+        if (!this._panel._hiddenCategories.all)
+            return false;
+        return this._resource.category.name in this._panel._hiddenCategories;
+    },
+
     select: function()
     {
         this._panel._showResource(this._resource);
@@ -1374,11 +1396,7 @@ WebInspector.NetworkDataGridNode.prototype = {
     {
         if (!this._panel._viewingResourceMode)
             return false;
-        if (!this._panel._hiddenCategories.all)
-            return true;
-        if (this._panel._hiddenCategories[this._resource.category.name])
-            return false;
-        return true;
+        return !this.isFilteredOut();
     },
 
     _createDivInTD: function(columnIdentifier)
@@ -1695,6 +1713,16 @@ WebInspector.NetworkTotalGridNode = function(element)
 }
 
 WebInspector.NetworkTotalGridNode.prototype = {
+    isFilteredOut: function()
+    {
+        return false;
+    },
+
+    get selectable()
+    {
+        return false;
+    },
+
     createCells: function()
     {
         var td = document.createElement("td");