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

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

Issue 2206723002: [MD settings] shrink overscroll when scrolling up (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review changes 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
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 6aa8c1113f14754117d1c1a2bfb7fba3bd9b450b..bf07a8f1bea880f4d05f8704ae8ebe1ad067a511 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -78,6 +78,20 @@ Polymer({
settings.navigateTo(this.advancedToggleExpanded_ ?
settings.Route.ADVANCED : settings.Route.BASIC);
}.bind(this));
+
+ var mainContainer = this.parentNode.$.mainContainer;
Dan Beam 2016/08/03 20:50:32 can we just use this.parentNode.scroller?
dschuyler 2016/08/03 21:46:41 Done.
+ var overscroll = this.$.overscroll;
+ mainContainer.addEventListener('scroll', function() {
Dan Beam 2016/08/03 20:50:32 can we only listen to scroll when there is padding
dschuyler 2016/08/03 21:46:41 Done.
+ // TODO(dschuyler): This works okay, but not perfectly with page-up/down
+ // and home/end. It may have to do with the order in which the resize
+ // occurs (relative to the scroll action).
Dan Beam 2016/08/03 20:50:32 ^ you can remove this now, I think
dschuyler 2016/08/03 21:46:41 Done.
+ var visibleBottom = mainContainer.scrollTop + mainContainer.clientHeight;
+ var overscrollBottom = overscroll.offsetTop + overscroll.scrollHeight;
+ // How much of the overscroll is visible (may be negative).
+ var visibleOverscroll = overscroll.scrollHeight -
+ (overscrollBottom - visibleBottom);
+ overscroll.style.paddingBottom = Math.max(0, visibleOverscroll) + 'px';
+ }.bind(this));
},
/**

Powered by Google App Engine
This is Rietveld 408576698