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

Unified Diff: client/tests/client/layout/GridLayoutDemo.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/tests/client/layout/GridLayoutDemo.dart
diff --git a/client/tests/client/layout/GridLayoutDemo.dart b/client/tests/client/layout/GridLayoutDemo.dart
index 27a6143efe221d1a10d0d0f16dc15c31ad6fe860..a1d950bed4b7626ead2c175cb73e49814933e8ff 100644
--- a/client/tests/client/layout/GridLayoutDemo.dart
+++ b/client/tests/client/layout/GridLayoutDemo.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.
@@ -106,15 +106,9 @@ void printMetrics(String example) {
final sb = new StringBuffer();
sb.add("test('Spec Example $exampleId', () {\n");
sb.add(" verifyExample('$example', {\n");
- final rects = new List();
- final elements = node.elements;
- for (Element child in elements) {
- rects.add(child.rect);
- }
-
- window.requestLayoutFrame(() {
- for (int i = 0; i < elements.length; i++) {
- _appendMetrics(sb, elements[i], rects[i].value, ' ');
+ window.requestMeasurementFrame(() {
+ for (Element element in node.elements) {
+ _appendMetrics(sb, element, ' ');
}
sb.add(' });\n');
sb.add('});\n\n');
@@ -122,10 +116,9 @@ void printMetrics(String example) {
});
}
-void _appendMetrics(StringBuffer sb, Element node, ElementRect rect,
- [String indent = '']) {
+void _appendMetrics(StringBuffer sb, Element node, [String indent = '']) {
String id = node.id;
- final offset = rect.offset;
+ final offset = node.rect.offset;
num left = offset.left, top = offset.top;
num width = offset.width, height = offset.height;
sb.add("${indent}'$id': [$left, $top, $width, $height],\n");

Powered by Google App Engine
This is Rietveld 408576698