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 f9afe10053f9bbe4649a97a3c3b9115cdebe440d..e8fef49682ba892340a2a252db42e1e2d214087d 100644 |
| --- a/chrome/browser/resources/settings/settings_main/settings_main.js |
| +++ b/chrome/browser/resources/settings/settings_main/settings_main.js |
| @@ -118,6 +118,48 @@ Polymer({ |
| newRoute.page == 'advanced'; |
| this.style.height = isSubpage ? '100%' : ''; |
| + |
| + /* Flush the dom-if changes prior to calculating the overflow padding. */ |
| + Polymer.dom.flush(); |
|
Dan Beam
2016/07/02 00:17:31
can't we just do:
this.async(function() {
this.
dschuyler
2016/07/02 00:23:55
Done.
|
| + this.$.overscroll.style.paddingBottom = |
| + (this.parentNode.scrollHeight - this.lastSettingsElementHeight_()) + |
| + 'px'; |
| + }, |
| + |
| + /** |
| + * Return the height of the last item in the settings content area. Used to |
| + * determine how much padding to apply to the end of the content so that the |
| + * last element may align with the top of the content area. |
| + * @return {number} |
| + * @private |
| + */ |
| + lastSettingsElementHeight_: function() { |
| + if (!this.currentRoute || this.currentRoute.subpage.length != 0 || |
| + this.showAboutPage_) { |
| + return 0; |
| + } |
| + |
| + /** |
| + * @param {Element} element |
| + * @return {number} |
| + */ |
| + function calcHeight(element) { |
| + var style = getComputedStyle(element); |
| + return element.offsetHeight + parseFloat(style.marginTop) + |
| + parseFloat(style.marginBottom); |
| + } |
| + |
| + if (this.showAdvancedPage_) { |
| + var sections = this.$$('settings-advanced-page').$$( |
| + '[data-page=advanced]').querySelectorAll('settings-section'); |
| + return calcHeight(sections[sections.length - 1]); |
| + } |
| + |
| + var toggleContainer = this.$$('#toggleContainer'); |
| + if (toggleContainer) |
| + return calcHeight(toggleContainer); |
| + |
| + return 0; |
| }, |
| /** @private */ |