Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(885)

Side by Side Diff: samples/ui_lib/base/AnimationScheduler.dart

Issue 10067009: Migrate the samples to one-argument version of requestAnimationFrame and re-enable the test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/total/client/InnerMenuView.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 typedef void AnimationCallback(num currentTime); 5 typedef void AnimationCallback(num currentTime);
6 6
7 class CallbackData { 7 class CallbackData {
8 final AnimationCallback callback; 8 final AnimationCallback callback;
9 final num minTime; 9 final num minTime;
10 int id; 10 int id;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void _setupInterval() { 90 void _setupInterval() {
91 // Assert that we never schedule multiple frames at once. 91 // Assert that we never schedule multiple frames at once.
92 assert(_intervalId === null); 92 assert(_intervalId === null);
93 if (USE_INTERVALS) { 93 if (USE_INTERVALS) {
94 _intervalId = window.setInterval(_step, MS_PER_FRAME); 94 _intervalId = window.setInterval(_step, MS_PER_FRAME);
95 } else { 95 } else {
96 if (_webkitAnimationFrameMaybeAvailable) { 96 if (_webkitAnimationFrameMaybeAvailable) {
97 try { 97 try {
98 // TODO(jacobr): passing in document should not be required. 98 // TODO(jacobr): passing in document should not be required.
99 _intervalId = window.webkitRequestAnimationFrame( 99 _intervalId = window.webkitRequestAnimationFrame(
100 (int ignored) { _step(); }, document); 100 (int ignored) { _step(); });
101 // TODO(jacobr) fix this odd type error. 101 // TODO(jacobr) fix this odd type error.
102 } catch (var e) { 102 } catch (var e) {
103 _webkitAnimationFrameMaybeAvailable = false; 103 _webkitAnimationFrameMaybeAvailable = false;
104 } 104 }
105 } 105 }
106 if (!_webkitAnimationFrameMaybeAvailable) { 106 if (!_webkitAnimationFrameMaybeAvailable) {
107 _intervalId = window.setTimeout(() { _step(); }, MS_PER_FRAME); 107 _intervalId = window.setTimeout(() { _step(); }, MS_PER_FRAME);
108 } 108 }
109 } 109 }
110 } 110 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 _frameCount++; 157 _frameCount++;
158 if (_isMobileSafari) { 158 if (_isMobileSafari) {
159 // Hack to work around an iOS bug where sometimes animations do not 159 // Hack to work around an iOS bug where sometimes animations do not
160 // render if only webkit transforms were modified. 160 // render if only webkit transforms were modified.
161 // TODO(jacobr): find a cleaner workaround. 161 // TODO(jacobr): find a cleaner workaround.
162 int offset = _frameCount % 2; 162 int offset = _frameCount % 2;
163 _safariHackStyle.left = '${offset}px'; 163 _safariHackStyle.left = '${offset}px';
164 } 164 }
165 } 165 }
166 } 166 }
OLDNEW
« no previous file with comments | « samples/total/client/InnerMenuView.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698