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

Side by Side Diff: samples/swarm/swarm_ui_lib/layout/GridLayout.dart

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 9 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
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 part of layout; 5 part of layout;
6 6
7 /** 7 /**
8 * Implements a grid-based layout system based on: 8 * Implements a grid-based layout system based on:
9 * [http://dev.w3.org/csswg/css3-grid-align/] 9 * [http://dev.w3.org/csswg/css3-grid-align/]
10 * 10 *
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 span = childLayout.columnSpan; 499 span = childLayout.columnSpan;
500 tracks = _columnTracks; 500 tracks = _columnTracks;
501 } else if (_dimension == Dimension.HEIGHT) { 501 } else if (_dimension == Dimension.HEIGHT) {
502 start = childLayout.row - 1; 502 start = childLayout.row - 1;
503 span = childLayout.rowSpan; 503 span = childLayout.rowSpan;
504 tracks = _rowTracks; 504 tracks = _rowTracks;
505 } 505 }
506 506
507 assert(start >= 0 && span >= 1); 507 assert(start >= 0 && span >= 1);
508 508
509 final result = new List<GridTrack>.fixedLength(span); 509 final result = new List<GridTrack>(span);
510 for (int i = 0; i < span; i++) { 510 for (int i = 0; i < span; i++) {
511 result[i] = tracks[start + i]; 511 result[i] = tracks[start + i];
512 } 512 }
513 return result; 513 return result;
514 } 514 }
515 515
516 int _getSpanCount(ViewLayout item) { 516 int _getSpanCount(ViewLayout item) {
517 GridLayoutParams childLayout = item.layoutParams; 517 GridLayoutParams childLayout = item.layoutParams;
518 return (_dimension == Dimension.WIDTH ? 518 return (_dimension == Dimension.WIDTH ?
519 childLayout.columnSpan : childLayout.rowSpan); 519 childLayout.columnSpan : childLayout.rowSpan);
520 } 520 }
521 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698