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 // Fast out, slow in. | 5 // Fast out, slow in. |
6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)'; | 6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)'; |
7 var EXPAND_DURATION = 350; | 7 var EXPAND_DURATION = 350; |
8 | 8 |
9 /** | 9 /** |
10 * Calls |readyTest| repeatedly until it returns true, then calls | 10 * Calls |readyTest| repeatedly until it returns true, then calls |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 if (section) | 400 if (section) |
401 this.expandSection(section); | 401 this.expandSection(section); |
402 } | 402 } |
403 } else { | 403 } else { |
404 if (oldRouteIsSubpage) { | 404 if (oldRouteIsSubpage) { |
405 var section = this.getSection_(oldRoute.section); | 405 var section = this.getSection_(oldRoute.section); |
406 if (section) | 406 if (section) |
407 this.collapseSection(section); | 407 this.collapseSection(section); |
408 } | 408 } |
409 | 409 |
410 if (newRoute && newRoute.section && | 410 if (newRoute && newRoute.section && this.getSection_(newRoute.section)) |
michaelpg
2016/07/28 23:22:32
is this just asking if the section is visible? can
tommycli
2016/07/29 00:03:35
I added a comment. This actually scrolls to the de
michaelpg
2016/07/29 00:21:12
oh, that makes sense. Ugh, this element was never
| |
411 this.$$('[data-page=' + newRoute.page + ']')) { | |
412 this.scrollToSection_(); | 411 this.scrollToSection_(); |
413 } | |
414 } | 412 } |
415 }, | 413 }, |
416 | 414 |
417 /** | 415 /** |
418 * Helper function to get a section from the local DOM. | 416 * Helper function to get a section from the local DOM. |
419 * @param {string} section Section name of the element to get. | 417 * @param {string} section Section name of the element to get. |
420 * @return {?SettingsSectionElement} | 418 * @return {?SettingsSectionElement} |
421 * @private | 419 * @private |
422 */ | 420 */ |
423 getSection_: function(section) { | 421 getSection_: function(section) { |
424 return /** @type {?SettingsSectionElement} */( | 422 return /** @type {?SettingsSectionElement} */( |
425 this.$$('[section=' + section + ']')); | 423 this.$$('[section=' + section + ']')); |
426 }, | 424 }, |
427 }; | 425 }; |
428 | 426 |
429 | 427 |
430 /** @polymerBehavior */ | 428 /** @polymerBehavior */ |
431 var RoutableBehavior = [ | 429 var RoutableBehavior = [ |
432 MainPageBehavior, | 430 MainPageBehavior, |
433 RoutableBehaviorImpl | 431 RoutableBehaviorImpl |
434 ]; | 432 ]; |
OLD | NEW |