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

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: review changes 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage; 117 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage;
118 118
119 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic'; 119 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic';
120 120
121 this.showAdvancedPage_ = 121 this.showAdvancedPage_ =
122 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || 122 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
123 newRoute.page == 'advanced'; 123 newRoute.page == 'advanced';
124 124
125 this.style.height = isSubpage ? '100%' : ''; 125 this.style.height = isSubpage ? '100%' : '';
126
127 // Wait for the dom-if changes prior to calculating the overflow padding.
128 this.async(function() {
129 this.$.overscroll.style.paddingBottom = this.overscrollHeight_() + 'px';
michaelpg 2016/07/07 20:09:38 should this be floored at 0?
dschuyler 2016/07/20 20:44:20 I added an assert in calcHeight instead.
130 });
131 },
132
133 /**
134 * Return the height that the over scroll padding should be set to.
135 * This is used to determine how much padding to apply to the end of the
136 * content so that the last element may align with the top of the content
137 * area.
138 * @return {number}
139 * @private
140 */
141 overscrollHeight_: function() {
142 if (!this.currentRoute || this.currentRoute.subpage.length != 0 ||
143 this.showAboutPage_) {
144 return 0;
145 }
146
147 /**
148 * @param {!Element} element
149 * @return {number}
150 */
151 function calcHeight(scrollHeight, element) {
152 var style = getComputedStyle(element);
153 return scrollHeight - element.offsetHeight +
154 parseFloat(style.marginTop) + parseFloat(style.marginBottom);
155 }
156
157 var scrollHeight = this.parentNode.scrollHeight;
158
159 if (this.showAdvancedPage_) {
160 var sections = this.$$('settings-advanced-page').$$(
161 '[data-page=advanced]').querySelectorAll('settings-section');
162 var lastSection = sections[sections.length - 1];
michaelpg 2016/07/07 20:09:38 seems overly complicated: this.$$('settings-advan
dschuyler 2016/07/20 20:44:20 Done.
163 // |lastSection| may be null in unit tests.
164 if (lastSection)
165 return calcHeight(scrollHeight, lastSection);
166 }
167
168 var toggleContainer = this.$$('#toggleContainer');
169 if (toggleContainer)
170 return calcHeight(scrollHeight, toggleContainer);
171
172 return 0;
126 }, 173 },
127 174
128 /** @private */ 175 /** @private */
129 toggleAdvancedPage_: function() { 176 toggleAdvancedPage_: function() {
130 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 177 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
131 }, 178 },
132 }); 179 });
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