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

Unified Diff: client/samples/swarm/Views.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/samples/swarm/Views.dart
diff --git a/client/samples/swarm/Views.dart b/client/samples/swarm/Views.dart
index c02a00e77238ae9f67e1a31a96de3333b6853b3b..e602d9c9e5d5e2ff8a16f3ec8e767cbeb3f00c63 100644
--- a/client/samples/swarm/Views.dart
+++ b/client/samples/swarm/Views.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.
@@ -288,25 +288,27 @@ class GenericListView<D> extends View {
void onResize() {
- int lastViewLength = _viewLength;
- node.rect.then((ElementRect rect) {
- _viewLength = _vertical ? rect.offset.height : rect.offset.width;
+ window.requestMeasurementFrame(() {
+ int lastViewLength = _viewLength;
+ final offset = node.rect.offset;
+ _viewLength = _vertical ? offset.height : offset.width;
if (_viewLength != lastViewLength) {
- if (_scrollbar != null) {
- _scrollbar.refresh();
- }
- renderVisibleItems(true);
+ return () {
+ if (_scrollbar != null) {
+ _scrollbar.refresh();
+ }
+ renderVisibleItems(true);
+ };
}
});
}
void enterDocument() {
if (scroller != null) {
- onResize();
-
if (_scrollbar != null) {
_scrollbar.initialize();
}
+ onResize();
}
}

Powered by Google App Engine
This is Rietveld 408576698