| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of base; | 5 part of base; |
| 6 | 6 |
| 7 typedef void AnimationCallback(num currentTime); | 7 typedef void AnimationCallback(num currentTime); |
| 8 | 8 |
| 9 class CallbackData { | 9 class CallbackData { |
| 10 final AnimationCallback callback; | 10 final AnimationCallback callback; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 assert(_intervalId != null); | 118 assert(_intervalId != null); |
| 119 if (USE_INTERVALS) { | 119 if (USE_INTERVALS) { |
| 120 window.clearInterval(_intervalId); | 120 window.clearInterval(_intervalId); |
| 121 } | 121 } |
| 122 _intervalId = null; | 122 _intervalId = null; |
| 123 } else if (USE_INTERVALS == false) { | 123 } else if (USE_INTERVALS == false) { |
| 124 _intervalId = null; | 124 _intervalId = null; |
| 125 _setupInterval(); | 125 _setupInterval(); |
| 126 } | 126 } |
| 127 int numRemaining = 0; | 127 int numRemaining = 0; |
| 128 int minTime = new Date.now().millisecondsSinceEpoch + MS_PER_FRAME; | 128 int minTime = new DateTime.now().millisecondsSinceEpoch + MS_PER_FRAME; |
| 129 | 129 |
| 130 int len = _callbacks.length; | 130 int len = _callbacks.length; |
| 131 for (final callback in _callbacks) { | 131 for (final callback in _callbacks) { |
| 132 if (!callback.ready(minTime)) { | 132 if (!callback.ready(minTime)) { |
| 133 numRemaining++; | 133 numRemaining++; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (numRemaining == len) { | 137 if (numRemaining == len) { |
| 138 // TODO(jacobr): we could be more clever about this case if delayed | 138 // TODO(jacobr): we could be more clever about this case if delayed |
| (...skipping 20 matching lines...) Expand all Loading... |
| 159 _frameCount++; | 159 _frameCount++; |
| 160 if (_isMobileSafari) { | 160 if (_isMobileSafari) { |
| 161 // Hack to work around an iOS bug where sometimes animations do not | 161 // Hack to work around an iOS bug where sometimes animations do not |
| 162 // render if only webkit transforms were modified. | 162 // render if only webkit transforms were modified. |
| 163 // TODO(jacobr): find a cleaner workaround. | 163 // TODO(jacobr): find a cleaner workaround. |
| 164 int offset = _frameCount % 2; | 164 int offset = _frameCount % 2; |
| 165 _safariHackStyle.left = '${offset}px'; | 165 _safariHackStyle.left = '${offset}px'; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 } | 168 } |
| OLD | NEW |