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

Unified Diff: client/layout/GridLayout.dart

Issue 8363040: Implement measurement using futures (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: take2 Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: client/layout/GridLayout.dart
diff --git a/client/layout/GridLayout.dart b/client/layout/GridLayout.dart
index 872f53e941b0add64155d8991355ecd561d18dcb..a66766b6e8cddc9f0e0bccc117a21c9fbe9f9e46 100644
--- a/client/layout/GridLayout.dart
+++ b/client/layout/GridLayout.dart
@@ -85,23 +85,30 @@ 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.
+ }
+ /** 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 (null != changed) {
+ changed.complete(true);
+ }
+ }
+ });
}
/**
@@ -418,6 +425,7 @@ class GridLayout extends ViewLayout {
_ensureTrack(_columnTracks, columnSizing, p.column, p.columnSpan);
child.layoutParams = p;
}
+ child.cacheExistingBrowserLayout();
}
}

Powered by Google App Engine
This is Rietveld 408576698