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

Side by Side Diff: client/layout/GridLayout.dart

Issue 9145004: Revert "Example showing alternate async measurement solution" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/html/src/WindowWrappingImplementation.dart ('k') | client/layout/ViewLayout.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * Implements a grid-based layout system based on: 6 * Implements a grid-based layout system based on:
7 * [http://dev.w3.org/csswg/css3-grid-align/] 7 * [http://dev.w3.org/csswg/css3-grid-align/]
8 * 8 *
9 * This layout is designed to support animations and work on browsers that 9 * This layout is designed to support animations and work on browsers that
10 * don't support grid natively. As such, we implement it on top of absolute 10 * don't support grid natively. As such, we implement it on top of absolute
11 * positioning. 11 * positioning.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 88
89 int get currentWidth() => _gridWidth; 89 int get currentWidth() => _gridWidth;
90 int get currentHeight() => _gridHeight; 90 int get currentHeight() => _gridHeight;
91 91
92 void cacheExistingBrowserLayout() { 92 void cacheExistingBrowserLayout() {
93 // We don't need to do anything as we don't rely on the _cachedViewRect 93 // We don't need to do anything as we don't rely on the _cachedViewRect
94 // when the grid layout is used. 94 // when the grid layout is used.
95 } 95 }
96 96
97 // TODO(jacobr): cleanup this method so that it returns a Future
98 // rather than taking a Completer as an argument.
97 /** The main entry point for layout computation. */ 99 /** The main entry point for layout computation. */
98 bool measureLayout(int width, int height) { 100 void measureLayout(Future<Size> size, Completer<bool> changed) {
99 assert(window.inMeasurementFrame);
100 _ensureAllTracks(); 101 _ensureAllTracks();
101 _gridWidth = width; 102 window.requestLayoutFrame(() {
102 _gridHeight = height; 103 _gridWidth = size.value.width;
104 _gridHeight = size.value.height;
103 105
104 if (_rowTracks.length > 0 && _columnTracks.length > 0) { 106 if (_rowTracks.length > 0 && _columnTracks.length > 0) {
105 _measureTracks(); 107 _measureTracks();
106 _setBoundsOfChildren(); 108 _setBoundsOfChildren();
107 return true; 109 if (changed != null) {
108 } 110 changed.complete(true);
109 return false; 111 }
112 }
113 });
110 } 114 }
111 115
112 /** 116 /**
113 * The top level measurement function. 117 * The top level measurement function.
114 * [http://dev.w3.org/csswg/css3-grid-align/#calculating-size-of-grid-tracks] 118 * [http://dev.w3.org/csswg/css3-grid-align/#calculating-size-of-grid-tracks]
115 */ 119 */
116 void _measureTracks() { 120 void _measureTracks() {
117 // Resolve logical width, then height. Width comes first so we can use 121 // Resolve logical width, then height. Width comes first so we can use
118 // the width when determining the content-sized height. 122 // the width when determining the content-sized height.
119 try { 123 try {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 511 }
508 return result; 512 return result;
509 } 513 }
510 514
511 int _getSpanCount(ViewLayout item) { 515 int _getSpanCount(ViewLayout item) {
512 GridLayoutParams childLayout = item.layoutParams; 516 GridLayoutParams childLayout = item.layoutParams;
513 return (_dimension == Dimension.WIDTH ? 517 return (_dimension == Dimension.WIDTH ?
514 childLayout.columnSpan : childLayout.rowSpan); 518 childLayout.columnSpan : childLayout.rowSpan);
515 } 519 }
516 } 520 }
OLDNEW
« no previous file with comments | « client/html/src/WindowWrappingImplementation.dart ('k') | client/layout/ViewLayout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698