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

Unified Diff: client/layout/GridLayout.dart

Issue 9145004: Revert "Example showing alternate async measurement solution" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 38a3c39b3b552119418fc626977ff904eaf0703a..a3688a84dd68a0e13a3ca2f657ad9f7b66d8f0ff 100644
--- a/client/layout/GridLayout.dart
+++ b/client/layout/GridLayout.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -94,19 +94,23 @@ class GridLayout extends ViewLayout {
// 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. */
- bool measureLayout(int width, int height) {
- assert(window.inMeasurementFrame);
+ void measureLayout(Future<Size> size, Completer<bool> changed) {
_ensureAllTracks();
- _gridWidth = width;
- _gridHeight = height;
-
- if (_rowTracks.length > 0 && _columnTracks.length > 0) {
- _measureTracks();
- _setBoundsOfChildren();
- return true;
- }
- return false;
+ 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);
+ }
+ }
+ });
}
/**
« 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