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

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

Issue 462083002: DevTools: do not scroll console to bottom on resize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: @vsevik comments Created 6 years, 4 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
Index: Source/devtools/front_end/ui/ViewportControl.js
diff --git a/Source/devtools/front_end/ui/ViewportControl.js b/Source/devtools/front_end/ui/ViewportControl.js
index 938e056583870d839a3e161e47307942acbf19f7..789ee1a04c7d5a24f1cfb084d3342cfc0479d680 100644
--- a/Source/devtools/front_end/ui/ViewportControl.js
+++ b/Source/devtools/front_end/ui/ViewportControl.js
@@ -55,6 +55,7 @@ WebInspector.ViewportControl = function(provider)
this._anchorSelection = null;
this._headSelection = null;
this._stickToBottom = false;
+ this._scrolledToBottom = true;
}
/**
@@ -133,6 +134,14 @@ WebInspector.StaticViewportElement.prototype = {
WebInspector.ViewportControl.prototype = {
/**
+ * @return {boolean}
+ */
+ scrolledToBottom: function()
+ {
+ return this._scrolledToBottom;
+ },
+
+ /**
* @param {boolean} value
*/
setStickToBottom: function(value)
@@ -373,7 +382,7 @@ WebInspector.ViewportControl.prototype = {
var visibleFrom = this.element.scrollTop;
var visibleHeight = this._visibleHeight();
- var shouldStickToBottom = this._stickToBottom && this.element.isScrolledToBottom();
+ this._scrolledToBottom = this.element.isScrolledToBottom();
var isInvalidating = !this._cumulativeHeights;
if (this._cumulativeHeights && itemCount !== this._cumulativeHeights.length)
@@ -387,6 +396,8 @@ WebInspector.ViewportControl.prototype = {
this._rebuildCumulativeHeightsIfNeeded();
var oldFirstVisibleIndex = this._firstVisibleIndex;
var oldLastVisibleIndex = this._lastVisibleIndex;
+
+ var shouldStickToBottom = this._stickToBottom && this._scrolledToBottom;
if (shouldStickToBottom) {
this._lastVisibleIndex = itemCount - 1;
this._firstVisibleIndex = Math.max(itemCount - Math.ceil(visibleHeight / this._provider.minimumRowHeight()), 0);

Powered by Google App Engine
This is Rietveld 408576698