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

Unified Diff: chrome/browser/resources/settings/settings_main/settings_main.js

Issue 2228783005: MD Settings: Never underscroll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@RefactorMainPageBehavior2
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/settings_main/settings_main.js
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
index 676429b994c7533a5426cb7ced6b98673c6cadf0..748f8bc28d371b575b50e10044c958a730afeef6 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -85,13 +85,17 @@ Polymer({
this.parentNode.scroller.removeEventListener('scroll', this.boundScroll_);
this.boundScroll_ = null;
} else if (this.overscroll_ && !this.boundScroll_) {
- this.boundScroll_ = this.scrollEventListener_.bind(this);
+ this.boundScroll_ = this.setOverscroll_.bind(this, 0);
this.parentNode.scroller.addEventListener('scroll', this.boundScroll_);
}
},
- /** @private */
- scrollEventListener_: function() {
+ /**
+ * Sets the overscroll padding. Never forces a scroll, i.e., always leaves
+ * any currently visible overflow as-is.
+ * @param {number=} minHeight The minimum overscroll height needed.
Dan Beam 2016/08/09 23:26:40 opt_minHeight
michaelpg 2016/08/09 23:46:09 Done.
+ */
+ setOverscroll_: function(opt_minHeight) {
var scroller = this.parentNode.scroller;
var overscroll = this.$.overscroll;
var visibleBottom = scroller.scrollTop + scroller.clientHeight;
@@ -99,7 +103,9 @@ Polymer({
// How much of the overscroll is visible (may be negative).
var visibleOverscroll = overscroll.scrollHeight -
(overscrollBottom - visibleBottom);
- this.overscroll_ = Math.max(0, visibleOverscroll);
+ if (typeof opt_minHeight == 'undefined')
+ opt_minHeight = 0;
+ this.overscroll_ = Math.max(opt_minHeight, visibleOverscroll);
Dan Beam 2016/08/09 23:26:40 nit: opt_minHeight || 0
michaelpg 2016/08/09 23:46:09 Done.
},
/**
@@ -148,7 +154,7 @@ Polymer({
// Ensure any dom-if reflects the current properties.
Polymer.dom.flush();
- this.overscroll_ = this.overscrollHeight_();
+ this.setOverscroll_(this.overscrollHeight_());
}.bind(this));
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698