Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 }, | 71 }, |
| 72 }, | 72 }, |
| 73 | 73 |
| 74 /** @override */ | 74 /** @override */ |
| 75 attached: function() { | 75 attached: function() { |
| 76 document.addEventListener('toggle-advanced-page', function(e) { | 76 document.addEventListener('toggle-advanced-page', function(e) { |
| 77 this.advancedToggleExpanded_ = e.detail; | 77 this.advancedToggleExpanded_ = e.detail; |
| 78 settings.navigateTo(this.advancedToggleExpanded_ ? | 78 settings.navigateTo(this.advancedToggleExpanded_ ? |
| 79 settings.Route.ADVANCED : settings.Route.BASIC); | 79 settings.Route.ADVANCED : settings.Route.BASIC); |
| 80 }.bind(this)); | 80 }.bind(this)); |
| 81 | |
| 82 var mainContainer = this.parentNode.$.mainContainer; | |
|
Dan Beam
2016/08/03 20:50:32
can we just use this.parentNode.scroller?
dschuyler
2016/08/03 21:46:41
Done.
| |
| 83 var overscroll = this.$.overscroll; | |
| 84 mainContainer.addEventListener('scroll', function() { | |
|
Dan Beam
2016/08/03 20:50:32
can we only listen to scroll when there is padding
dschuyler
2016/08/03 21:46:41
Done.
| |
| 85 // TODO(dschuyler): This works okay, but not perfectly with page-up/down | |
| 86 // and home/end. It may have to do with the order in which the resize | |
| 87 // occurs (relative to the scroll action). | |
|
Dan Beam
2016/08/03 20:50:32
^ you can remove this now, I think
dschuyler
2016/08/03 21:46:41
Done.
| |
| 88 var visibleBottom = mainContainer.scrollTop + mainContainer.clientHeight; | |
| 89 var overscrollBottom = overscroll.offsetTop + overscroll.scrollHeight; | |
| 90 // How much of the overscroll is visible (may be negative). | |
| 91 var visibleOverscroll = overscroll.scrollHeight - | |
| 92 (overscrollBottom - visibleBottom); | |
| 93 overscroll.style.paddingBottom = Math.max(0, visibleOverscroll) + 'px'; | |
| 94 }.bind(this)); | |
| 81 }, | 95 }, |
| 82 | 96 |
| 83 /** | 97 /** |
| 84 * @param {boolean} opened Whether the menu is expanded. | 98 * @param {boolean} opened Whether the menu is expanded. |
| 85 * @return {string} Which icon to use. | 99 * @return {string} Which icon to use. |
| 86 * @private | 100 * @private |
| 87 */ | 101 */ |
| 88 arrowState_: function(opened) { | 102 arrowState_: function(opened) { |
| 89 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 103 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 90 }, | 104 }, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 | 222 |
| 209 /** | 223 /** |
| 210 * @param {(boolean|undefined)} visibility | 224 * @param {(boolean|undefined)} visibility |
| 211 * @return {boolean} True unless visibility is false. | 225 * @return {boolean} True unless visibility is false. |
| 212 * @private | 226 * @private |
| 213 */ | 227 */ |
| 214 showAdvancedSettings_: function(visibility) { | 228 showAdvancedSettings_: function(visibility) { |
| 215 return visibility !== false; | 229 return visibility !== false; |
| 216 }, | 230 }, |
| 217 }); | 231 }); |
| OLD | NEW |