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 * @typedef {{about: boolean, basic: boolean, advanced: boolean}} | 6 * @typedef {{about: boolean, basic: boolean, advanced: boolean}} |
7 */ | 7 */ |
8 var MainPageVisibility; | 8 var MainPageVisibility; |
9 | 9 |
10 /** | 10 /** |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 }.bind(this)); | 96 }.bind(this)); |
97 | 97 |
98 var currentRoute = settings.getCurrentRoute(); | 98 var currentRoute = settings.getCurrentRoute(); |
99 this.hasExpandedSection_ = currentRoute && currentRoute.isSubpage(); | 99 this.hasExpandedSection_ = currentRoute && currentRoute.isSubpage(); |
100 }, | 100 }, |
101 | 101 |
102 /** @private */ | 102 /** @private */ |
103 overscrollChanged_: function() { | 103 overscrollChanged_: function() { |
104 if (!this.overscroll_ && this.boundScroll_) { | 104 if (!this.overscroll_ && this.boundScroll_) { |
105 this.offsetParent.removeEventListener('scroll', this.boundScroll_); | 105 this.offsetParent.removeEventListener('scroll', this.boundScroll_); |
| 106 window.removeEventListener('resize', this.boundScroll_); |
106 this.boundScroll_ = null; | 107 this.boundScroll_ = null; |
107 } else if (this.overscroll_ && !this.boundScroll_) { | 108 } else if (this.overscroll_ && !this.boundScroll_) { |
108 this.boundScroll_ = function() { | 109 this.boundScroll_ = function() { |
109 if (!this.ignoreScroll_) | 110 if (!this.ignoreScroll_) |
110 this.setOverscroll_(0); | 111 this.setOverscroll_(0); |
111 }.bind(this); | 112 }.bind(this); |
112 this.offsetParent.addEventListener('scroll', this.boundScroll_); | 113 this.offsetParent.addEventListener('scroll', this.boundScroll_); |
| 114 window.addEventListener('resize', this.boundScroll_); |
113 } | 115 } |
114 }, | 116 }, |
115 | 117 |
116 /** | 118 /** |
117 * Sets the overscroll padding. Never forces a scroll, i.e., always leaves | 119 * Sets the overscroll padding. Never forces a scroll, i.e., always leaves |
118 * any currently visible overflow as-is. | 120 * any currently visible overflow as-is. |
119 * @param {number=} opt_minHeight The minimum overscroll height needed. | 121 * @param {number=} opt_minHeight The minimum overscroll height needed. |
120 * @private | 122 * @private |
121 */ | 123 */ |
122 setOverscroll_: function(opt_minHeight) { | 124 setOverscroll_: function(opt_minHeight) { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 365 |
364 /** | 366 /** |
365 * @param {(boolean|undefined)} visibility | 367 * @param {(boolean|undefined)} visibility |
366 * @return {boolean} True unless visibility is false. | 368 * @return {boolean} True unless visibility is false. |
367 * @private | 369 * @private |
368 */ | 370 */ |
369 showAdvancedSettings_: function(visibility) { | 371 showAdvancedSettings_: function(visibility) { |
370 return visibility !== false; | 372 return visibility !== false; |
371 }, | 373 }, |
372 }); | 374 }); |
OLD | NEW |