| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 else | 59 else |
| 60 this.tryTransitionToSection_(scrollToSection); | 60 this.tryTransitionToSection_(scrollToSection); |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * When exiting search mode, we need to make another attempt to scroll to | 64 * When exiting search mode, we need to make another attempt to scroll to |
| 65 * the correct section, since it has just been re-rendered. | 65 * the correct section, since it has just been re-rendered. |
| 66 * @private | 66 * @private |
| 67 */ | 67 */ |
| 68 inSearchModeChanged_: function(inSearchMode) { | 68 inSearchModeChanged_: function(inSearchMode) { |
| 69 if (!this.isAttached) |
| 70 return; |
| 71 |
| 69 if (!inSearchMode) | 72 if (!inSearchMode) |
| 70 this.tryTransitionToSection_(!settings.lastRouteChangeWasPopstate()); | 73 this.tryTransitionToSection_(!settings.lastRouteChangeWasPopstate()); |
| 71 }, | 74 }, |
| 72 | 75 |
| 73 /** | 76 /** |
| 74 * If possible, transitions to the current route's section (by expanding or | 77 * If possible, transitions to the current route's section (by expanding or |
| 75 * scrolling to it). If another transition is running, finishes or cancels | 78 * scrolling to it). If another transition is running, finishes or cancels |
| 76 * that one, then schedules this function again. This ensures the current | 79 * that one, then schedules this function again. This ensures the current |
| 77 * section is quickly shown, without getting the page into a broken state -- | 80 * section is quickly shown, without getting the page into a broken state -- |
| 78 * if currentRoute changes in between calls, just transition to the new route. | 81 * if currentRoute changes in between calls, just transition to the new route. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 return /** @type {?SettingsSectionElement} */( | 298 return /** @type {?SettingsSectionElement} */( |
| 296 this.$$('settings-section[section="' + section + '"]')); | 299 this.$$('settings-section[section="' + section + '"]')); |
| 297 }, | 300 }, |
| 298 }; | 301 }; |
| 299 | 302 |
| 300 /** @polymerBehavior */ | 303 /** @polymerBehavior */ |
| 301 var MainPageBehavior = [ | 304 var MainPageBehavior = [ |
| 302 settings.RouteObserverBehavior, | 305 settings.RouteObserverBehavior, |
| 303 MainPageBehaviorImpl, | 306 MainPageBehaviorImpl, |
| 304 ]; | 307 ]; |
| OLD | NEW |