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

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

Issue 2090753002: [MD settings] end of page padding in content area (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit test fix Created 4 years, 5 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 f80a8512c0c54b21bc89b73ddfbf8271534494f2..6c23227166a82a64a2eea86829b6e61da47fcdce 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -130,6 +130,55 @@ Polymer({
if (this.showPages_.advanced)
this.advancedToggleExpanded_ = true;
}
+
+ // Wait for the dom-if changes prior to calculating the overflow padding.
+ this.async(function() {
+ this.$.overscroll.style.paddingBottom = this.overscrollHeight_() + 'px';
+ });
+ },
+
+ /**
+ * Return the height that the over scroll padding should be set to.
+ * This is 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
+ */
+ overscrollHeight_: function() {
+ if (!this.currentRoute || this.currentRoute.subpage.length != 0 ||
+ this.showPages_.about) {
+ return 0;
+ }
+
+ /**
+ * @param {!Element} element
+ * @return {number}
+ */
+ var calcHeight = function(element) {
+ var style = getComputedStyle(element);
+ var height = this.parentNode.scrollHeight - element.offsetHeight +
+ parseFloat(style.marginTop) + parseFloat(style.marginBottom);
+ assert(height >= 0);
+ return height;
+ }.bind(this);
+
+ if (this.showPages_.advanced) {
+ var lastSection = this.$$('settings-advanced-page').$$(
+ 'settings-section:last-of-type');
+ // |lastSection| may be null in unit tests.
+ if (!lastSection)
+ return 0;
+ return calcHeight(lastSection);
+ }
+
+ assert(this.showPages_.basic);
+ var lastSection = this.$$('settings-basic-page').$$(
+ 'settings-section:last-of-type');
+ // |lastSection| may be null in unit tests.
+ if (!lastSection)
+ return 0;
+ return calcHeight(lastSection) - this.$$('#toggleContainer').offsetHeight;
},
/** @private */
« 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