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

Unified Diff: client/samples/total/src/InnerMenuView.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/total/src/InnerMenuView.dart
diff --git a/client/samples/total/src/InnerMenuView.dart b/client/samples/total/src/InnerMenuView.dart
index 4218ad02fb1e9920d4abb6d89618020b0229de8d..29e9564fe8c487165977ddff92608f55d413e645 100644
--- a/client/samples/total/src/InnerMenuView.dart
+++ b/client/samples/total/src/InnerMenuView.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.
@@ -47,13 +47,14 @@ class InnerMenuView {
// cell.
static void _pinHeight(Window window, TableRowElement row) {
Element firstCell = row.cells[0];
- final firstCellRect = firstCell.rect;
- final style = firstCell.computedStyle;
- window.requestLayoutFrame(() {
- int height = firstCellRect.value.client.height
- - HtmlUtils.fromPx(style.value.getPropertyValue('padding-top'))
- - HtmlUtils.fromPx(style.value.getPropertyValue('padding-bottom'));
- firstCell.style.setProperty('height', HtmlUtils.toPx(height));
+ window.requestMeasurementFrame(() {
+ final firstCellRect = firstCell.rect;
+ final style = firstCell.computedStyle;
+
+ int height = firstCell.rect.client.height
+ - HtmlUtils.fromPx(style.paddingTop)
+ - HtmlUtils.fromPx(style.paddingBottom);
+ return () { firstCell.style.height = HtmlUtils.toPx(height); };
});
}
@@ -212,13 +213,11 @@ class InnerMenuView {
}
// Must take into account the top of the table due to scrolling.
- final offsetParentRect = _row.offsetParent.rect;
- final rowRect = _row.rect;
- window.requestLayoutFrame(() {
- int tableTop = offsetParentRect.value.bounding.top.toInt();
+ window.requestMeasurementFrame(() {
+ int tableTop = _row.offsetParent.rect.bounding.top.toInt();
// Get the current bounding box of the row we're attached to.
- ClientRect boundingRowRect = rowRect.value.bounding;
+ ClientRect boundingRowRect = _row.rect.bounding;
CSSStyleDeclaration style = _bar.style;
int top = boundingRowRect.top.toInt() + _initialRowHeight - tableTop;
@@ -226,10 +225,12 @@ class InnerMenuView {
_currentRowHeight = height;
- style.setProperty("top", HtmlUtils.toPx(top));
- style.setProperty("height", HtmlUtils.toPx(height));
+ return () {
+ style.setProperty("top", HtmlUtils.toPx(top));
+ style.setProperty("height", HtmlUtils.toPx(height));
- _innerMenuMoved();
+ _innerMenuMoved();
+ };
});
}

Powered by Google App Engine
This is Rietveld 408576698