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

Side by Side 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: change to async 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-main' displays the selected settings page. 7 * 'settings-main' displays the selected settings page.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-main', 10 is: 'settings-main',
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage; 112 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage;
113 113
114 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic'; 114 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic';
115 115
116 this.showAdvancedPage_ = 116 this.showAdvancedPage_ =
117 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || 117 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
118 newRoute.page == 'advanced'; 118 newRoute.page == 'advanced';
119 119
120 this.style.height = isSubpage ? '100%' : ''; 120 this.style.height = isSubpage ? '100%' : '';
121
122 /* Wait for the dom-if changes prior to calculating the overflow padding. */
Dan Beam 2016/07/06 15:25:36 // Use a 1-line comment for implementation comment
dschuyler 2016/07/06 21:45:05 Done.
123 this.async(function() {
124 this.$.overscroll.style.paddingBottom =
125 (this.parentNode.scrollHeight - this.lastSettingsElementHeight_()) +
126 'px';
127 });
128 },
129
130 /**
131 * Return the height of the last item in the settings content area. Used to
132 * determine how much padding to apply to the end of the content so that the
133 * last element may align with the top of the content area.
134 * @return {number}
135 * @private
136 */
137 lastSettingsElementHeight_: function() {
138 if (!this.currentRoute || this.currentRoute.subpage.length != 0 ||
139 this.showAboutPage_) {
Dan Beam 2016/07/06 15:25:36 what is this logic trying to derive?
dschuyler 2016/07/06 21:45:05 I renamed and reworked this a bit to make it clear
140 return 0;
141 }
142
143 /**
144 * @param {Element} element
145 * @return {number}
146 */
147 function calcHeight(element) {
148 var style = getComputedStyle(element);
149 return element.offsetHeight + parseFloat(style.marginTop) +
150 parseFloat(style.marginBottom);
151 }
152
153 if (this.showAdvancedPage_) {
154 var sections = this.$$('settings-advanced-page').$$(
155 '[data-page=advanced]').querySelectorAll('settings-section');
156 return calcHeight(sections[sections.length - 1]);
157 }
158
159 var toggleContainer = this.$$('#toggleContainer');
160 if (toggleContainer)
161 return calcHeight(toggleContainer);
162
163 return 0;
121 }, 164 },
122 165
123 /** @private */ 166 /** @private */
124 toggleAdvancedPage_: function() { 167 toggleAdvancedPage_: function() {
125 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 168 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
126 }, 169 },
127 }); 170 });
OLDNEW
« 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