Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(964)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ViewportControl.js

Issue 1688053004: DevTools: [Console] fix viewport stick-to-bottom behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/ViewportControl.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ViewportControl.js b/third_party/WebKit/Source/devtools/front_end/ui/ViewportControl.js
index ddb8a45fa8832a4ac66bf23f832ebf1435d421b1..fb920efd36231c0f209a8d3e89b031b26ea8aba1 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/ViewportControl.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ViewportControl.js
@@ -378,8 +378,7 @@ WebInspector.ViewportControl.prototype = {
if (!this._visibleHeight())
return; // Do nothing for invisible controls.
- var itemCount = this._provider.itemCount();
- if (!itemCount) {
+ if (!this._provider.itemCount()) {
for (var i = 0; i < this._renderedItems.length; ++i)
this._renderedItems[i].willHide();
this._renderedItems = [];
@@ -399,18 +398,18 @@ WebInspector.ViewportControl.prototype = {
this._scrolledToBottom = this.element.isScrolledToBottom();
var isInvalidating = !this._cumulativeHeights;
- if (this._cumulativeHeights && itemCount !== this._cumulativeHeights.length)
- delete this._cumulativeHeights;
for (var i = 0; i < this._renderedItems.length; ++i) {
// Tolerate 1-pixel error due to double-to-integer rounding errors.
if (this._cumulativeHeights && Math.abs(this._cachedItemHeight(this._firstVisibleIndex + i) - this._renderedItems[i].element().offsetHeight) > 1)
delete this._cumulativeHeights;
}
this._rebuildCumulativeHeightsIfNeeded();
+ var itemCount = this._cumulativeHeights.length;
var oldFirstVisibleIndex = this._firstVisibleIndex;
var oldLastVisibleIndex = this._lastVisibleIndex;
- var shouldStickToBottom = this._stickToBottom && this._scrolledToBottom;
+ var shouldStickToBottom = isInvalidating && this._stickToBottom && this._scrolledToBottom;
+
if (shouldStickToBottom) {
this._lastVisibleIndex = itemCount - 1;
this._firstVisibleIndex = Math.max(itemCount - Math.ceil(visibleHeight / this._provider.minimumRowHeight()), 0);
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698