OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * Responds to route changes by expanding, collapsing, or scrolling to sections | 6 * Responds to route changes by expanding, collapsing, or scrolling to sections |
7 * on the page. Expanded sections take up the full height of the container. At | 7 * on the page. Expanded sections take up the full height of the container. At |
8 * most one section should be expanded at any given time. | 8 * most one section should be expanded at any given time. |
9 * @polymerBehavior MainPageBehavior | 9 * @polymerBehavior MainPageBehavior |
10 */ | 10 */ |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 /** @type {?HTMLElement} The scrolling container. */ | 35 /** @type {?HTMLElement} The scrolling container. */ |
36 scroller: null, | 36 scroller: null, |
37 | 37 |
38 listeners: { | 38 listeners: { |
39 'neon-animation-finish': 'onNeonAnimationFinish_' | 39 'neon-animation-finish': 'onNeonAnimationFinish_' |
40 }, | 40 }, |
41 | 41 |
42 /** @override */ | 42 /** @override */ |
43 attached: function() { | 43 attached: function() { |
44 if (this.domHost && this.domHost.parentNode.tagName == 'PAPER-HEADER-PANEL') | 44 this.scroller = this.domHost ? this.domHost.parentNode : document.body; |
45 this.scroller = this.domHost.parentNode.scroller; | |
46 else | |
47 this.scroller = document.body; // Used in unit tests. | |
48 }, | 45 }, |
49 | 46 |
50 /** | 47 /** |
51 * Remove the is-animating attribute once the animation is complete. | 48 * Remove the is-animating attribute once the animation is complete. |
52 * This may catch animations finishing more often than needed, which is not | 49 * This may catch animations finishing more often than needed, which is not |
53 * known to cause any issues (e.g. when animating from a shallower page to a | 50 * known to cause any issues (e.g. when animating from a shallower page to a |
54 * deeper page; or when transitioning to the main page). | 51 * deeper page; or when transitioning to the main page). |
55 * @private | 52 * @private |
56 */ | 53 */ |
57 onNeonAnimationFinish_: function() { | 54 onNeonAnimationFinish_: function() { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return /** @type {?SettingsSectionElement} */( | 342 return /** @type {?SettingsSectionElement} */( |
346 this.$$('settings-section[section="' + section + '"]')); | 343 this.$$('settings-section[section="' + section + '"]')); |
347 }, | 344 }, |
348 }; | 345 }; |
349 | 346 |
350 /** @polymerBehavior */ | 347 /** @polymerBehavior */ |
351 var MainPageBehavior = [ | 348 var MainPageBehavior = [ |
352 settings.RouteObserverBehavior, | 349 settings.RouteObserverBehavior, |
353 MainPageBehaviorImpl, | 350 MainPageBehaviorImpl, |
354 ]; | 351 ]; |
OLD | NEW |