| Index: client/layout/GridLayout.dart
|
| diff --git a/client/layout/GridLayout.dart b/client/layout/GridLayout.dart
|
| index 872f53e941b0add64155d8991355ecd561d18dcb..32006f1c10aab151c2b752bf360e64c8be49d0da 100644
|
| --- a/client/layout/GridLayout.dart
|
| +++ b/client/layout/GridLayout.dart
|
| @@ -85,23 +85,32 @@ class GridLayout extends ViewLayout {
|
| _columnTracks = columns != null ? columns.tracks : new List<GridTrack>();
|
| }
|
|
|
| +
|
| int get currentWidth() => _gridWidth;
|
| int get currentHeight() => _gridHeight;
|
|
|
| - /** The main entry point for layout computation. */
|
| - bool measureLayout(int width, int height) {
|
| - _gridWidth = width;
|
| - _gridHeight = height;
|
| + void cacheExistingBrowserLayout() {
|
| + // We don't need to do anything as we don't rely on the _cachedViewRect
|
| + // when the grid layout is used.
|
| + }
|
|
|
| + // TODO(jacobr): cleanup this method so that it returns a Future
|
| + // rather than taking a Completer as an argument.
|
| + /** The main entry point for layout computation. */
|
| + void measureLayout(Future<Size> size, Completer<bool> changed) {
|
| _ensureAllTracks();
|
| -
|
| - if (_rowTracks.length < 1 || _columnTracks.length < 1) {
|
| - return false; // nothing to do
|
| - }
|
| -
|
| - _measureTracks();
|
| - _setBoundsOfChildren();
|
| - return true;
|
| + window.requestLayoutFrame(() {
|
| + _gridWidth = size.value.width;
|
| + _gridHeight = size.value.height;
|
| +
|
| + if (_rowTracks.length > 0 && _columnTracks.length > 0) {
|
| + _measureTracks();
|
| + _setBoundsOfChildren();
|
| + if (changed != null) {
|
| + changed.complete(true);
|
| + }
|
| + }
|
| + });
|
| }
|
|
|
| /**
|
| @@ -418,6 +427,7 @@ class GridLayout extends ViewLayout {
|
| _ensureTrack(_columnTracks, columnSizing, p.column, p.columnSpan);
|
| child.layoutParams = p;
|
| }
|
| + child.cacheExistingBrowserLayout();
|
| }
|
| }
|
|
|
|
|