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 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void cacheExistingBrowserLayout() { | 94 void cacheExistingBrowserLayout() { |
95 // We don't need to do anything as we don't rely on the _cachedViewRect | 95 // We don't need to do anything as we don't rely on the _cachedViewRect |
96 // when the grid layout is used. | 96 // when the grid layout is used. |
97 } | 97 } |
98 | 98 |
99 // TODO(jacobr): cleanup this method so that it returns a Future | 99 // TODO(jacobr): cleanup this method so that it returns a Future |
100 // rather than taking a Completer as an argument. | 100 // rather than taking a Completer as an argument. |
101 /** The main entry point for layout computation. */ | 101 /** The main entry point for layout computation. */ |
102 void measureLayout(Future<Size> size, Completer<bool> changed) { | 102 void measureLayout(Future<Size> size, Completer<bool> changed) { |
103 _ensureAllTracks(); | 103 _ensureAllTracks(); |
104 window.setImmediate(() { | 104 window.immediate.then((_) { |
105 _gridWidth = size.value.width; | 105 _gridWidth = size.value.width; |
106 _gridHeight = size.value.height; | 106 _gridHeight = size.value.height; |
107 | 107 |
108 if (_rowTracks.length > 0 && _columnTracks.length > 0) { | 108 if (_rowTracks.length > 0 && _columnTracks.length > 0) { |
109 _measureTracks(); | 109 _measureTracks(); |
110 _setBoundsOfChildren(); | 110 _setBoundsOfChildren(); |
111 if (changed != null) { | 111 if (changed != null) { |
112 changed.complete(true); | 112 changed.complete(true); |
113 } | 113 } |
114 } | 114 } |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |