| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Counter used to give webkit animations unique names. | 5 // Counter used to give webkit animations unique names. |
| 6 var animationCounter = 0; | 6 var animationCounter = 0; |
| 7 | 7 |
| 8 var animationEventTracker_ = new EventTracker(); | 8 var animationEventTracker_ = new EventTracker(); |
| 9 | 9 |
| 10 function addAnimation(code) { | 10 function addAnimation(code) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 el.offsetHeight; // Should force an update of the computed style. | 77 el.offsetHeight; // Should force an update of the computed style. |
| 78 animationEventTracker_.add( | 78 animationEventTracker_.add( |
| 79 el, 'webkitTransitionEnd', onFadeOutTransitionEnd.bind(el), false); | 79 el, 'webkitTransitionEnd', onFadeOutTransitionEnd.bind(el), false); |
| 80 el.classList.add('closing'); | 80 el.classList.add('closing'); |
| 81 el.classList.remove('visible'); | 81 el.classList.remove('visible'); |
| 82 el.setAttribute('aria-hidden', 'true'); | 82 el.setAttribute('aria-hidden', 'true'); |
| 83 } | 83 } |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * Executes when a fade out animation ends. | 86 * Executes when a fade out animation ends. |
| 87 * @param {WebkitTransitionEvent} event The event that triggered this listener. | 87 * @param {TransitionEvent} event The event that triggered this listener. |
| 88 * @this {HTMLElement} The element where the transition occurred. | 88 * @this {HTMLElement} The element where the transition occurred. |
| 89 */ | 89 */ |
| 90 function onFadeOutTransitionEnd(event) { | 90 function onFadeOutTransitionEnd(event) { |
| 91 if (event.propertyName != 'height') | 91 if (event.propertyName != 'height') |
| 92 return; | 92 return; |
| 93 animationEventTracker_.remove(this, 'webkitTransitionEnd'); | 93 animationEventTracker_.remove(this, 'webkitTransitionEnd'); |
| 94 this.hidden = true; | 94 this.hidden = true; |
| 95 } | 95 } |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Executes when a fade in animation ends. | 98 * Executes when a fade in animation ends. |
| 99 * @param {WebkitAnimationEvent} event The event that triggered this listener. | 99 * @param {Event} event The event that triggered this listener. |
| 100 * @this {HTMLElement} The element where the transition occurred. | 100 * @this {HTMLElement} The element where the transition occurred. |
| 101 */ | 101 */ |
| 102 function onFadeInAnimationEnd(event) { | 102 function onFadeInAnimationEnd(event) { |
| 103 this.style.height = ''; | 103 this.style.height = ''; |
| 104 fadeInAnimationCleanup(this); | 104 fadeInAnimationCleanup(this); |
| 105 } | 105 } |
| 106 | 106 |
| 107 /** | 107 /** |
| 108 * Removes the <style> element corresponding to |animationName| from the DOM. | 108 * Removes the <style> element corresponding to |animationName| from the DOM. |
| 109 * @param {HTMLElement} element The animated element. | 109 * @param {HTMLElement} element The animated element. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 while (el.childNodes.length > 0) | 187 while (el.childNodes.length > 0) |
| 188 div.appendChild(el.firstChild); | 188 div.appendChild(el.firstChild); |
| 189 el.appendChild(div); | 189 el.appendChild(div); |
| 190 } | 190 } |
| 191 | 191 |
| 192 div.className = ''; | 192 div.className = ''; |
| 193 div.classList.add('collapsible'); | 193 div.classList.add('collapsible'); |
| 194 for (var i = 0; i < classes.length; i++) | 194 for (var i = 0; i < classes.length; i++) |
| 195 div.classList.add(classes[i]); | 195 div.classList.add(classes[i]); |
| 196 } | 196 } |
| OLD | NEW |