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

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: Remove duplicated imports from html.dart 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
« no previous file with comments | « client/html/src/WindowWrappingImplementation.dart ('k') | client/layout/ViewLayout.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
}
« no previous file with comments | « client/html/src/WindowWrappingImplementation.dart ('k') | client/layout/ViewLayout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698