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

Unified Diff: client/tests/client/layout/GridLayoutDemo.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/tests/client/html/MeasurementTests.dart ('k') | client/tests/client/samples/swarm/swarm_tests.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/client/layout/GridLayoutDemo.dart
diff --git a/client/tests/client/layout/GridLayoutDemo.dart b/client/tests/client/layout/GridLayoutDemo.dart
index a1d950bed4b7626ead2c175cb73e49814933e8ff..27a6143efe221d1a10d0d0f16dc15c31ad6fe860 100644
--- a/client/tests/client/layout/GridLayoutDemo.dart
+++ b/client/tests/client/layout/GridLayoutDemo.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.
@@ -106,9 +106,15 @@ void printMetrics(String example) {
final sb = new StringBuffer();
sb.add("test('Spec Example $exampleId', () {\n");
sb.add(" verifyExample('$example', {\n");
- window.requestMeasurementFrame(() {
- for (Element element in node.elements) {
- _appendMetrics(sb, element, ' ');
+ 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, ' ');
}
sb.add(' });\n');
sb.add('});\n\n');
@@ -116,9 +122,10 @@ void printMetrics(String example) {
});
}
-void _appendMetrics(StringBuffer sb, Element node, [String indent = '']) {
+void _appendMetrics(StringBuffer sb, Element node, ElementRect rect,
+ [String indent = '']) {
String id = node.id;
- final offset = node.rect.offset;
+ final offset = 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");
« no previous file with comments | « client/tests/client/html/MeasurementTests.dart ('k') | client/tests/client/samples/swarm/swarm_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698