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

Unified Diff: samples/swarm/swarm_ui_lib/view/PagedViews.dart

Issue 12087004: Changing window.requestLayoutFrame into a microtask API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « samples/swarm/swarm_ui_lib/touch/Scroller.dart ('k') | samples/swarm/swarm_ui_lib/view/SliderMenu.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/swarm/swarm_ui_lib/view/PagedViews.dart
diff --git a/samples/swarm/swarm_ui_lib/view/PagedViews.dart b/samples/swarm/swarm_ui_lib/view/PagedViews.dart
index 310f554779f55417c9d2d1a9face98185101a35a..a03dd5ef25ddb7ac7500e4f6750af1d9f38164c9 100644
--- a/samples/swarm/swarm_ui_lib/view/PagedViews.dart
+++ b/samples/swarm/swarm_ui_lib/view/PagedViews.dart
@@ -135,7 +135,8 @@ class PagedColumnView extends View {
// TODO(jmesserly): would be better to not have this code in enterDocument.
// But we need computedStyle to read our CSS properties.
void enterDocument() {
- contentView.node.computedStyle.then((CssStyleDeclaration style) {
+ window.setImmediate(() {
+ var style = contentView.node.getComputedStyle();
_computeColumnGap(style);
// Trigger a fake resize event so we measure our height.
@@ -182,7 +183,7 @@ class PagedColumnView extends View {
// The content needs to have its height explicitly set, or columns don't
// flow to the right correctly. So we copy our own height and set the height
// of the content.
- window.requestLayoutFrame(() {
+ window.setImmediate(() {
contentView.node.style.height = '${node.offsetHeight}px';
});
_updatePageCount(null);
@@ -190,7 +191,7 @@ class PagedColumnView extends View {
bool _updatePageCount(Callback callback) {
int pageLength = 1;
- window.requestLayoutFrame(() {
+ window.setImmediate(() {
if (_container.scrollWidth > _container.offsetWidth) {
pageLength = (_container.scrollWidth / _computePageSize(_container))
.ceil().toInt();
@@ -215,7 +216,7 @@ class PagedColumnView extends View {
}
void _onContentMoved(Event e) {
- window.requestLayoutFrame(() {
+ window.setImmediate(() {
num current = scroller.contentOffset.x;
int pageSize = _computePageSize(_container);
pages.current.value = -(current / pageSize).round().toInt();
@@ -225,7 +226,7 @@ class PagedColumnView extends View {
void _snapToPage(Event e) {
num current = scroller.contentOffset.x;
num currentTarget = scroller.currentTarget.x;
- window.requestLayoutFrame(() {
+ window.setImmediate(() {
int pageSize = _computePageSize(_container);
int destination;
num currentPageNumber = -(current / pageSize).round();
@@ -277,7 +278,7 @@ class PagedColumnView extends View {
}
void _onPageSelected() {
- window.requestLayoutFrame(() {
+ window.setImmediate(() {
int translate = -pages.target.value * _computePageSize(_container);
scroller.throwTo(translate, 0);
});
« no previous file with comments | « samples/swarm/swarm_ui_lib/touch/Scroller.dart ('k') | samples/swarm/swarm_ui_lib/view/SliderMenu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698