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

Side by Side Diff: samples/total/client/InnerMenuView.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/spirodraw/Spirodraw.dart ('k') | samples/ui_lib/base/AnimationScheduler.dart » ('j') | 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 // TODO: RE: implements RequestAnimationFrameCallback. File bug 5 // TODO: RE: implements RequestAnimationFrameCallback. File bug
6 // against dom libs because it should be possible to pass a function 6 // against dom libs because it should be possible to pass a function
7 // to webkitRequestAnimationFrame just like addEventListener. 7 // to webkitRequestAnimationFrame just like addEventListener.
8 class InnerMenuView { 8 class InnerMenuView {
9 static final List<String> _textAlignmentClassNames = const <String>[ "l", "c", "r" ]; 9 static final List<String> _textAlignmentClassNames = const <String>[ "l", "c", "r" ];
10 static final List<int> _textAlignmentValues = const <int>[ 10 static final List<int> _textAlignmentValues = const <int>[
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 _currentRowHeight = _initialRowHeight; 158 _currentRowHeight = _initialRowHeight;
159 159
160 EventListener f = myfunc(Event event) { 160 EventListener f = myfunc(Event event) {
161 _transitionDidComplete = true; 161 _transitionDidComplete = true;
162 _row.on.transitionEnd.remove(myfunc); 162 _row.on.transitionEnd.remove(myfunc);
163 _bar.style.setProperty("overflow", "visible"); 163 _bar.style.setProperty("overflow", "visible");
164 }; 164 };
165 _row.on.transitionEnd.add(f); 165 _row.on.transitionEnd.add(f);
166 _window.webkitRequestAnimationFrame((int time) { 166 _window.webkitRequestAnimationFrame((int time) {
167 _onRequestAnimationFrame(time); 167 _onRequestAnimationFrame(time);
168 }, _row); 168 });
169 169
170 _row.on['DOMNodeRemoved'].add(void g(Event event) { 170 _row.on['DOMNodeRemoved'].add(void g(Event event) {
171 if (_row == event.target) { 171 if (_row == event.target) {
172 _finishHide(); 172 _finishHide();
173 _row.on['DOMNodeRemoved'].remove(g); 173 _row.on['DOMNodeRemoved'].remove(g);
174 } 174 }
175 }); 175 });
176 176
177 // Initialize boolean 177 // Initialize boolean
178 _transitionDidComplete = false; 178 _transitionDidComplete = false;
(...skipping 13 matching lines...) Expand all
192 f = (Event event) { 192 f = (Event event) {
193 _finishHide(); 193 _finishHide();
194 _row.on.transitionEnd.remove(f); 194 _row.on.transitionEnd.remove(f);
195 if (callAtEnd != null) { 195 if (callAtEnd != null) {
196 callAtEnd(); 196 callAtEnd();
197 } 197 }
198 }; 198 };
199 _row.on.transitionEnd.add(f); 199 _row.on.transitionEnd.add(f);
200 _window.webkitRequestAnimationFrame((int time) { 200 _window.webkitRequestAnimationFrame((int time) {
201 _onRequestAnimationFrame(time); 201 _onRequestAnimationFrame(time);
202 }, _row); 202 });
203 } 203 }
204 204
205 bool isAttachedTo(TableRowElement row) => _row == row; 205 bool isAttachedTo(TableRowElement row) => _row == row;
206 206
207 void updateSize() { 207 void updateSize() {
208 if (_row.parent == null) { 208 if (_row.parent == null) {
209 // The row we were attached to has disappeared (e.g., by scrolling), so cl ean up the menu bar 209 // The row we were attached to has disappeared (e.g., by scrolling), so cl ean up the menu bar
210 _bar.remove(); 210 _bar.remove();
211 return; 211 return;
212 } 212 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // During CSS transitions, we use a webkitRequestAnimationFrame based 335 // During CSS transitions, we use a webkitRequestAnimationFrame based
336 // animation loop to keep visual state in sync. 336 // animation loop to keep visual state in sync.
337 void _onRequestAnimationFrame(int time) { 337 void _onRequestAnimationFrame(int time) {
338 updateSize(); 338 updateSize();
339 339
340 _selectionManager.updateSelection(); 340 _selectionManager.updateSelection();
341 341
342 if (!_transitionDidComplete) { 342 if (!_transitionDidComplete) {
343 _window.webkitRequestAnimationFrame((int time_) { 343 _window.webkitRequestAnimationFrame((int time_) {
344 _onRequestAnimationFrame(time_); 344 _onRequestAnimationFrame(time_);
345 }, _row); 345 });
346 } 346 }
347 } 347 }
348 348
349 void _selectTextStyle(int index, String className, bool selected) { 349 void _selectTextStyle(int index, String className, bool selected) {
350 Element element = _textStyleButtons[index]; 350 Element element = _textStyleButtons[index];
351 if (selected) { 351 if (selected) {
352 element.parent.style.setProperty("border", "1px solid black"); 352 element.parent.style.setProperty("border", "1px solid black");
353 className = "${className}-selected"; 353 className = "${className}-selected";
354 } else { 354 } else {
355 element.parent.style.removeProperty("border"); 355 element.parent.style.removeProperty("border");
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 for (int i = 0; i < 4; i++) { 416 for (int i = 0; i < 4; i++) {
417 if (_textStyleButtons[i].attributes["class"].length > 1) { 417 if (_textStyleButtons[i].attributes["class"].length > 1) {
418 textStyle += _textStyleValues[i]; 418 textStyle += _textStyleValues[i];
419 } 419 }
420 } 420 }
421 421
422 _execute(Style _(Style s, int selectedIndex) 422 _execute(Style _(Style s, int selectedIndex)
423 => s.setTextFormatByIndex(selectedIndex), textStyle); 423 => s.setTextFormatByIndex(selectedIndex), textStyle);
424 } 424 }
425 } 425 }
OLDNEW
« no previous file with comments | « samples/spirodraw/Spirodraw.dart ('k') | samples/ui_lib/base/AnimationScheduler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698