Changeset 244615 in webkit


Ignore:
Timestamp:
Apr 24, 2019 2:30:51 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Network: importing a HAR with an active detail view shows no content
https://bugs.webkit.org/show_bug.cgi?id=197223

Reviewed by Timothy Hatcher.

When hiding the detail view, we force a layout of the Network table, which causes the
cached row count to be set to 0, which prevents the reloadDataAddedToEndOnly from
rendering anything since the WI.Table thinks it has no rows.

Given that all of the users of WI.Table are backed by an array, we don't need to cache the
number of rows since .length is an extremely cheap operation. In turn, this guarantees
that we are always rendering with an accurate value.

  • UserInterface/Views/Table.js:

(WI.Table):
(WI.Table.prototype.get numberOfRows):
(WI.Table.prototype.reloadData):
(WI.Table.prototype._removeRows):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r244577 r244615  
     12019-04-24  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Network: importing a HAR with an active detail view shows no content
     4        https://bugs.webkit.org/show_bug.cgi?id=197223
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        When hiding the detail view, we force a `layout` of the Network table, which causes the
     9        cached row count to be set to `0`, which prevents the `reloadDataAddedToEndOnly` from
     10        rendering anything since the `WI.Table` thinks it has no rows.
     11
     12        Given that all of the users of `WI.Table` are backed by an array, we don't need to cache the
     13        number of rows since `.length` is an extremely cheap operation. In turn, this guarantees
     14        that we are always rendering with an accurate value.
     15
     16        * UserInterface/Views/Table.js:
     17        (WI.Table):
     18        (WI.Table.prototype.get numberOfRows):
     19        (WI.Table.prototype.reloadData):
     20        (WI.Table.prototype._removeRows):
     21
    1222019-04-23  Devin Rousso  <drousso@apple.com>
    223
  • trunk/Source/WebInspectorUI/UserInterface/Views/Table.js

    r242174 r244615  
    7777
    7878        this._cachedRows = new Map;
    79         this._cachedNumberOfRows = NaN;
    8079
    8180        this._columnSpecs = new Map;
     
    114113        this._visibleRowIndexEnd = NaN;
    115114
     115        console.assert(this._dataSource.tableNumberOfRows, "Table data source must implement tableNumberOfRows.");
    116116        console.assert(this._dataSource.tableIndexForRepresentedObject, "Table data source must implement tableIndexForRepresentedObject.");
    117117        console.assert(this._dataSource.tableRepresentedObjectForIndex, "Table data source must implement tableRepresentedObjectForIndex.");
     
    146146    get numberOfRows()
    147147    {
    148         if (isNaN(this._cachedNumberOfRows))
    149             this._cachedNumberOfRows = this._dataSource.tableNumberOfRows(this);
    150 
    151         return this._cachedNumberOfRows;
     148        return this._dataSource.tableNumberOfRows(this);
    152149    }
    153150
     
    254251        this._selectionController.reset();
    255252
    256         this._cachedNumberOfRows = NaN;
    257253        this._previousRevealedRowCount = NaN;
    258254        this.needsLayout();
     
    14361432            return;
    14371433
    1438         for (let index = lastIndex + 1; index < this._cachedNumberOfRows; ++index)
     1434        for (let index = lastIndex + 1; index < this.numberOfRows; ++index)
    14391435            adjustRowAtIndex(index);
    14401436
    1441         this._cachedNumberOfRows -= removed;
    1442         console.assert(this._cachedNumberOfRows >= 0);
    14431437
    14441438        this._selectionController.didRemoveItems(representedObjects);
    14451439
    1446         if (this._delegate.tableDidRemoveRows) {
     1440        if (this._delegate.tableDidRemoveRows)
    14471441            this._delegate.tableDidRemoveRows(this, rowIndexes);
    1448             console.assert(this._cachedNumberOfRows === this._dataSource.tableNumberOfRows(this), "Table data source should update after removing rows.");
    1449         }
    14501442    }
    14511443
Note: See TracChangeset for help on using the changeset viewer.