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

Side by Side Diff: samples/ui_lib/view/view.dart

Issue 11367040: Removing Element.rect. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("view"); 5 #library("view");
6 6
7 #import('dart:html'); 7 #import('dart:html');
8 #import('dart:math', prefix: 'Math'); 8 #import('dart:math', prefix: 'Math');
9 9
10 #import('../base/base.dart'); 10 #import('../base/base.dart');
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 void _measureLayoutHelper(Completer<bool> changed) { 341 void _measureLayoutHelper(Completer<bool> changed) {
342 windowResized(); 342 windowResized();
343 343
344 // TODO(jmesserly): this logic is more complex than it needs to be because 344 // TODO(jmesserly): this logic is more complex than it needs to be because
345 // we're taking pains to not initialize _layout if it's not needed. Is that 345 // we're taking pains to not initialize _layout if it's not needed. Is that
346 // a good tradeoff? 346 // a good tradeoff?
347 if (ViewLayout.hasCustomLayout(this)) { 347 if (ViewLayout.hasCustomLayout(this)) {
348 Completer sizeCompleter = new Completer<Size>(); 348 Completer sizeCompleter = new Completer<Size>();
349 _node.rect.then((ElementRect rect) { 349 window.requestLayoutFrame(() {
350 sizeCompleter.complete( 350 sizeCompleter.complete(
351 new Size(rect.client.width, rect.client.height)); 351 new Size(_node.clientWidth, _node.clientHeight));
352 }); 352 });
353 layout.measureLayout(sizeCompleter.future, changed); 353 layout.measureLayout(sizeCompleter.future, changed);
354 } else { 354 } else {
355 for (final child in childViews) { 355 for (final child in childViews) {
356 child._measureLayoutHelper(changed); 356 child._measureLayoutHelper(changed);
357 } 357 }
358 } 358 }
359 } 359 }
360 360
361 void _applyLayoutToChildren() { 361 void _applyLayoutToChildren() {
362 for (final child in childViews) { 362 for (final child in childViews) {
363 child._applyLayout(); 363 child._applyLayout();
364 } 364 }
365 } 365 }
366 366
367 void _applyLayout() { 367 void _applyLayout() {
368 if (_layout != null) { 368 if (_layout != null) {
369 _layout.applyLayout(); 369 _layout.applyLayout();
370 } 370 }
371 _applyLayoutToChildren(); 371 _applyLayoutToChildren();
372 } 372 }
373 } 373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698