Chromium Code Reviews| 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)); |
| }, |