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

Unified Diff: client/layout/GridLayout.dart

Issue 9148015: Example showing alternate async measurement solution (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final version 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
Index: client/layout/GridLayout.dart
diff --git a/client/layout/GridLayout.dart b/client/layout/GridLayout.dart
index a3688a84dd68a0e13a3ca2f657ad9f7b66d8f0ff..38a3c39b3b552119418fc626977ff904eaf0703a 100644
--- a/client/layout/GridLayout.dart
+++ b/client/layout/GridLayout.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, 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,23 +94,19 @@ 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. */
- void measureLayout(Future<Size> size, Completer<bool> changed) {
+ bool measureLayout(int width, int height) {
+ assert(window.inMeasurementFrame);
_ensureAllTracks();
- 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);
- }
- }
- });
+ _gridWidth = width;
+ _gridHeight = height;
+
+ if (_rowTracks.length > 0 && _columnTracks.length > 0) {
+ _measureTracks();
+ _setBoundsOfChildren();
+ return true;
+ }
+ return false;
}
/**

Powered by Google App Engine
This is Rietveld 408576698