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 30 matching lines...) Expand all Loading... |
41 * animation. | 41 * animation. |
42 */ | 42 */ |
43 function fadeInElement(el, opt_justShow) { | 43 function fadeInElement(el, opt_justShow) { |
44 if (el.classList.contains('visible')) | 44 if (el.classList.contains('visible')) |
45 return; | 45 return; |
46 el.classList.remove('closing'); | 46 el.classList.remove('closing'); |
47 el.hidden = false; | 47 el.hidden = false; |
48 el.setAttribute('aria-hidden', 'false'); | 48 el.setAttribute('aria-hidden', 'false'); |
49 el.style.height = 'auto'; | 49 el.style.height = 'auto'; |
50 var height = el.offsetHeight; | 50 var height = el.offsetHeight; |
51 if (opt_justShow && false) { | 51 if (opt_justShow) { |
52 el.style.height = ''; | 52 el.style.height = ''; |
53 el.style.opacity = ''; | 53 el.style.opacity = ''; |
54 } else { | 54 } else { |
55 el.style.height = height + 'px'; | 55 el.style.height = height + 'px'; |
56 var animName = addAnimation(getFadeInAnimationCode(height)); | 56 var animName = addAnimation(getFadeInAnimationCode(height)); |
57 animationEventTracker_.add( | 57 animationEventTracker_.add( |
58 el, 'webkitAnimationEnd', onFadeInAnimationEnd.bind(el), false); | 58 el, 'webkitAnimationEnd', onFadeInAnimationEnd.bind(el), false); |
59 el.style.webkitAnimationName = animName; | 59 el.style.webkitAnimationName = animName; |
60 } | 60 } |
61 el.classList.add('visible'); | 61 el.classList.add('visible'); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 while (el.childNodes.length > 0) | 182 while (el.childNodes.length > 0) |
183 div.appendChild(el.firstChild); | 183 div.appendChild(el.firstChild); |
184 el.appendChild(div); | 184 el.appendChild(div); |
185 } | 185 } |
186 | 186 |
187 div.className = ''; | 187 div.className = ''; |
188 div.classList.add('collapsible'); | 188 div.classList.add('collapsible'); |
189 for (var i = 0; i < classes.length; i++) | 189 for (var i = 0; i < classes.length; i++) |
190 div.classList.add(classes[i]); | 190 div.classList.add(classes[i]); |
191 } | 191 } |
OLD | NEW |