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

Unified Diff: client/tests/client/layout/GridLayoutDemo.dart

Issue 8363040: Implement measurement using futures (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: take2 Created 9 years, 2 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 c931b2bdebcbdafdba5710d3f1402f75c48e9232..02adbc90b80f4f8c852e1bbf6888d7226a359e2a 100644
--- a/client/tests/client/layout/GridLayoutDemo.dart
+++ b/client/tests/client/layout/GridLayoutDemo.dart
@@ -110,15 +110,21 @@ void printMetrics(String example) {
for (Element child in node.elements) {
_appendMetrics(sb, child, ' ');
}
- sb.add(' });\n');
- sb.add('});\n\n');
- window.console.log(sb.toString());
+ window.requestLayoutFrame(() {
arv (Not doing code reviews) 2011/10/27 05:50:24 This is the first case where this is feeling ugly.
Jacob 2011/10/27 20:59:25 Agreed. I felt dirty writing that test code. Rewro
+ sb.add(' });\n');
+ sb.add('});\n\n');
+ window.console.log(sb.toString());
+ });
}
void _appendMetrics(StringBuffer sb, Element node, [String indent = '']) {
String id = node.id;
- num left = node.offsetLeft, top = node.offsetTop;
- num width = node.offsetWidth, height = node.offsetHeight;
- sb.add("${indent}'$id': [$left, $top, $width, $height],\n");
+ node.rect.then((rect) {
+ 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");
+ });
}

Powered by Google App Engine
This is Rietveld 408576698