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-animated-pages' is a container for a page and animated subpages. | 7 * 'settings-animated-pages' is a container for a page and animated subpages. |
| 8 * It provides a set of common behaviors and animations. | 8 * It provides a set of common behaviors and animations. |
| 9 * | 9 * |
| 10 * Example: | 10 * Example: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 // Observe the light DOM so we know when it's ready. | 49 // Observe the light DOM so we know when it's ready. |
| 50 this.lightDomObserver_ = Polymer.dom(this).observeNodes( | 50 this.lightDomObserver_ = Polymer.dom(this).observeNodes( |
| 51 this.lightDomChanged_.bind(this)); | 51 this.lightDomChanged_.bind(this)); |
| 52 }, | 52 }, |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * @param {!Event} e | 55 * @param {!Event} e |
| 56 * @private | 56 * @private |
| 57 */ | 57 */ |
| 58 onIronSelect_: function(e) { | 58 onIronSelect_: function(e) { |
| 59 if (!this.focusConfig || !this.previousRoute_ || | 59 if (!this.focusConfig || !this.previousRoute_) |
| 60 e.detail.item.tagName != 'NEON-ANIMATABLE') { | 60 return; |
| 61 | |
| 62 if (e.detail.item.tagName != 'NEON-ANIMATABLE' && | |
| 63 // Don't handle iron-select events from any subpage except from the | |
| 64 // SITE_SETTINGS subpage. | |
| 65 !(e.detail.item.tagName == 'SETTINGS-SUBPAGE' && | |
| 66 e.detail.item.id == 'site-settings')) { | |
|
Dan Beam
2017/04/12 01:05:26
!e.detail.item.matches('neon-animatable, settings-
dpapad
2017/04/12 03:22:52
Done.
| |
| 61 return; | 67 return; |
| 62 } | 68 } |
| 63 | 69 |
| 64 var selector = this.focusConfig.get(this.previousRoute_.path); | 70 var selector = this.focusConfig.get(this.previousRoute_.path); |
| 65 if (selector) { | 71 if (selector) { |
| 66 // neon-animatable has "display: none" until the animation finishes, so | 72 // neon-animatable has "display: none" until the animation finishes, so |
| 67 // calling focus() on any of its children has no effect until | 73 // calling focus() on any of its children has no effect until |
| 68 // "display: none" is removed. Therefore can't call focus() from within | 74 // "display: none" is removed. Therefore can't call focus() from within |
| 69 // the currentRouteChanged callback. Using 'iron-select' listener which | 75 // the currentRouteChanged callback. Using 'iron-select' listener which |
| 70 // fires after the animation has finished allows focus() to work as | 76 // fires after the animation has finished allows focus() to work as |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 // instance, such that the stamped instance will also be ignored by the | 187 // instance, such that the stamped instance will also be ignored by the |
| 182 // searching algorithm. | 188 // searching algorithm. |
| 183 if (template.hasAttribute('no-search')) | 189 if (template.hasAttribute('no-search')) |
| 184 subpage.setAttribute('no-search', ''); | 190 subpage.setAttribute('no-search', ''); |
| 185 | 191 |
| 186 // Render synchronously so neon-animated-pages can select the subpage. | 192 // Render synchronously so neon-animated-pages can select the subpage. |
| 187 template.if = true; | 193 template.if = true; |
| 188 template.render(); | 194 template.render(); |
| 189 }, | 195 }, |
| 190 }); | 196 }); |
| OLD | NEW |