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

Side by Side Diff: client/samples/swarm/Views.dart

Issue 9145004: Revert "Example showing alternate async measurement solution" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 | « client/samples/dartcombat/views.dart ('k') | client/samples/total/src/HtmlTable.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) 2012, 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 // This file contains View framework classes. 5 // This file contains View framework classes.
6 // As it grows, it may need to be split into multiple files. 6 // As it grows, it may need to be split into multiple files.
7 7
8 /** A factory that creates a view from a data model. */ 8 /** A factory that creates a view from a data model. */
9 interface ViewFactory<D> { 9 interface ViewFactory<D> {
10 View newView(D item); 10 View newView(D item);
11 11
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (height != null) { 281 if (height != null) {
282 style.height = '${height}px'; 282 style.height = '${height}px';
283 } 283 }
284 // TODO(jacobr): this should be specified by the default CSS for a 284 // TODO(jacobr): this should be specified by the default CSS for a
285 // GenericListView. 285 // GenericListView.
286 style.overflow = 'hidden'; 286 style.overflow = 'hidden';
287 } 287 }
288 288
289 289
290 void onResize() { 290 void onResize() {
291 window.requestMeasurementFrame(() { 291 int lastViewLength = _viewLength;
292 int lastViewLength = _viewLength; 292 node.rect.then((ElementRect rect) {
293 final offset = node.rect.offset; 293 _viewLength = _vertical ? rect.offset.height : rect.offset.width;
294 _viewLength = _vertical ? offset.height : offset.width;
295 if (_viewLength != lastViewLength) { 294 if (_viewLength != lastViewLength) {
296 return () { 295 if (_scrollbar != null) {
297 if (_scrollbar != null) { 296 _scrollbar.refresh();
298 _scrollbar.refresh(); 297 }
299 } 298 renderVisibleItems(true);
300 renderVisibleItems(true);
301 };
302 } 299 }
303 }); 300 });
304 } 301 }
305 302
306 void enterDocument() { 303 void enterDocument() {
307 if (scroller != null) { 304 if (scroller != null) {
305 onResize();
306
308 if (_scrollbar != null) { 307 if (_scrollbar != null) {
309 _scrollbar.initialize(); 308 _scrollbar.initialize();
310 } 309 }
311 onResize();
312 } 310 }
313 } 311 }
314 312
315 int getNextIndex(int index, bool forward) { 313 int getNextIndex(int index, bool forward) {
316 int delta = forward ? 1 : -1; 314 int delta = forward ? 1 : -1;
317 if (_paginate) { 315 if (_paginate) {
318 int newPage = Math.max(0, _layout.getPage(index, _viewLength) + delta); 316 int newPage = Math.max(0, _layout.getPage(index, _viewLength) + delta);
319 index = _layout.getPageStartIndex(newPage, _viewLength); 317 index = _layout.getPageStartIndex(newPage, _viewLength);
320 } else { 318 } else {
321 index += delta; 319 index += delta;
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 976
979 container = node.query('.dialog-body'); 977 container = node.query('.dialog-body');
980 container.nodes.add(_content.node); 978 container.nodes.add(_content.node);
981 979
982 return node; 980 return node;
983 } 981 }
984 982
985 /** Override to handle dialog done. */ 983 /** Override to handle dialog done. */
986 void onDone() { } 984 void onDone() { }
987 } 985 }
OLDNEW
« no previous file with comments | « client/samples/dartcombat/views.dart ('k') | client/samples/total/src/HtmlTable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698