Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js b/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js |
| index 200c37a2bf07434eacc3a478873adcd3bb768e23..36ca90c0215092eb68ae46891049c72f1a6b871e 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js |
| @@ -23,7 +23,6 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid { |
| this._scrollContainer.addEventListener('mousewheel', this._onWheel.bind(this), true); |
| /** @type {!Array.<!DataGrid.ViewportDataGridNode>} */ |
| this._visibleNodes = []; |
| - /** @type {boolean} */ |
| this._inline = false; |
| // Wheel target shouldn't be removed from DOM to preserve native kinetic scrolling. |
| @@ -34,11 +33,9 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid { |
| /** @type {?Node} */ |
| this._hiddenWheelTarget = null; |
| - /** @type {boolean} */ |
| this._stickToBottom = false; |
| - /** @type {boolean} */ |
| + this._updateIsFromUser = false; |
| this._atBottom = true; |
| - /** @type {number} */ |
| this._lastScrollTop = 0; |
| this._firstVisibleIsStriped = false; |
| @@ -84,7 +81,7 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid { |
| _onScroll(event) { |
| this._atBottom = this._scrollContainer.isScrolledToBottom(); |
| if (this._lastScrollTop !== this._scrollContainer.scrollTop) |
| - this.scheduleUpdate(); |
| + this.scheduleUpdate(true); |
| } |
| /** |
| @@ -94,7 +91,11 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid { |
| this.scheduleUpdate(); |
| } |
| - scheduleUpdate() { |
| + /** |
| + * @param {boolean=} isFromUser |
| + */ |
| + scheduleUpdate(isFromUser) { |
| + this._updateIsFromUser = this._updateIsFromUser || isFromUser; |
| if (this._updateAnimationFrameId) |
| return; |
| this._updateAnimationFrameId = this.element.window().requestAnimationFrame(this._update.bind(this)); |
| @@ -173,8 +174,9 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid { |
| var scrollTop = this._scrollContainer.scrollTop; |
| var currentScrollTop = scrollTop; |
| var maxScrollTop = Math.max(0, this._contentHeight() - clientHeight); |
| - if (this._stickToBottom && this._atBottom) |
| + if (!this._updateIsFromUser && this._stickToBottom && this._atBottom) |
| scrollTop = maxScrollTop; |
| + this._updateIsFromUser = false; |
|
pfeldman
2017/01/27 20:21:47
It still has a race when previous _update is clear
allada
2017/01/27 21:33:30
Acknowledged.
|
| scrollTop = Math.min(maxScrollTop, scrollTop); |
| this._atBottom = scrollTop === maxScrollTop; |