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

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: changed var name 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 | « chrome/browser/resources/settings/settings_main/settings_main.html ('k') | 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 6aa8c1113f14754117d1c1a2bfb7fba3bd9b450b..2fda937476231a7e4cbce3c3271bfb874e697a1c 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -71,6 +71,12 @@ Polymer({
},
},
+ /**
+ * The smallest value for the height of the overscroll padding.
+ * @const {number}
+ */
+ MINIMUM_OVERSCROLL: 64,
Dan Beam 2016/08/02 21:57:36 can you make this private?
dschuyler 2016/08/02 22:32:44 Done. And then ended up removing it.
+
/** @override */
attached: function() {
document.addEventListener('toggle-advanced-page', function(e) {
@@ -78,6 +84,18 @@ Polymer({
settings.navigateTo(this.advancedToggleExpanded_ ?
settings.Route.ADVANCED : settings.Route.BASIC);
}.bind(this));
+
+ var mainContainer = this.domHost.$$('paper-header-panel').$.mainContainer;
+ mainContainer.addEventListener('scroll', function() {
+ let visibleBottom = mainContainer.scrollTop + mainContainer.clientHeight;
+ let overscrollBottom = this.$.overscroll.offsetTop +
Dan Beam 2016/08/02 21:57:36 nit: var overscroll = this.$.overscroll; (and re-u
dschuyler 2016/08/02 22:32:44 Done.
+ this.$.overscroll.scrollHeight;
+ // How much of the overscroll is visible (may be negative).
+ let visibleOverscroll = this.$.overscroll.scrollHeight -
+ (overscrollBottom - visibleBottom);
Dan Beam 2016/08/02 21:57:36 indent off
dschuyler 2016/08/02 22:32:44 Done.
+ if (visibleOverscroll > this.MINIMUM_OVERSCROLL)
+ this.$.overscroll.style.paddingBottom = visibleOverscroll + 'px';
+ }.bind(this));
},
/**
@@ -128,7 +146,8 @@ Polymer({
// Ensure any dom-if reflects the current properties.
Polymer.dom.flush();
- this.$.overscroll.style.paddingBottom = this.overscrollHeight_() + 'px';
+ this.$.overscroll.style.paddingBottom = Math.max(this.MINIMUM_OVERSCROLL,
+ this.overscrollHeight_()) + 'px';
}.bind(this));
},
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698