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

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: Remove duplicated imports from html.dart 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
« no previous file with comments | « client/tests/client/html/html_tests.dart ('k') | client/tests/client/layout/layout_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 c931b2bdebcbdafdba5710d3f1402f75c48e9232..27a6143efe221d1a10d0d0f16dc15c31ad6fe860 100644
--- a/client/tests/client/layout/GridLayoutDemo.dart
+++ b/client/tests/client/layout/GridLayoutDemo.dart
@@ -106,19 +106,27 @@ void printMetrics(String example) {
final sb = new StringBuffer();
sb.add("test('Spec Example $exampleId', () {\n");
sb.add(" verifyExample('$example', {\n");
- final elems = new List.from(node.elements);
- for (Element child in node.elements) {
- _appendMetrics(sb, child, ' ');
+ final rects = new List();
+ final elements = node.elements;
+ for (Element child in elements) {
+ rects.add(child.rect);
}
- sb.add(' });\n');
- sb.add('});\n\n');
- window.console.log(sb.toString());
+
+ window.requestLayoutFrame(() {
+ for (int i = 0; i < elements.length; i++) {
+ _appendMetrics(sb, elements[i], rects[i].value, ' ');
+ }
+ sb.add(' });\n');
+ sb.add('});\n\n');
+ window.console.log(sb.toString());
+ });
}
-void _appendMetrics(StringBuffer sb, Element node, [String indent = '']) {
+void _appendMetrics(StringBuffer sb, Element node, ElementRect rect,
+ [String indent = '']) {
String id = node.id;
- num left = node.offsetLeft, top = node.offsetTop;
- num width = node.offsetWidth, height = node.offsetHeight;
+ 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/html_tests.dart ('k') | client/tests/client/layout/layout_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698