OLD | NEW |
1 // Copyright (c) 2011, 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 part of layout; | 5 part of layout; |
6 | 6 |
7 /** | 7 /** |
8 * Implements a grid-based layout system based on: | 8 * Implements a grid-based layout system based on: |
9 * [http://dev.w3.org/csswg/css3-grid-align/] | 9 * [http://dev.w3.org/csswg/css3-grid-align/] |
10 * | 10 * |
11 * This layout is designed to support animations and work on browsers that | 11 * This layout is designed to support animations and work on browsers that |
12 * don't support grid natively. As such, we implement it on top of absolute | 12 * don't support grid natively. As such, we implement it on top of absolute |
13 * positioning. | 13 * positioning. |
14 */ | 14 */ |
15 // TODO(jmesserly): the DOM integration still needs work: | 15 // TODO(jmesserly): the DOM integration still needs work: |
16 // - The grid assumes it is absolutely positioned in its container. | 16 // - The grid assumes it is absolutely positioned in its container. |
17 // Becasue of that, the grid doesn't work right unless it has at least one | 17 // Because of that, the grid doesn't work right unless it has at least one |
18 // fractional size in each dimension. In other words, only "top down" grids | 18 // fractional size in each dimension. In other words, only "top down" grids |
19 // work at the moment, because the grid can't determine its own size. | 19 // work at the moment, because the grid can't determine its own size. |
20 // The core algorithm supports computing min breadth; the issue is about how | 20 // The core algorithm supports computing min breadth; the issue is about how |
21 // to integrate it into our View layer. | 21 // to integrate it into our View layer. |
22 // - Unless a child element is "display: inline-block" we can't get its | 22 // - Unless a child element is "display: inline-block" we can't get its |
23 // horizontal content size. | 23 // horizontal content size. |
24 // - Once we set an element's size to "position: absolute", we lose the | 24 // - Once we set an element's size to "position: absolute", we lose the |
25 // ability to get its original content size. If the width or height gets | 25 // ability to get its original content size. If the width or height gets |
26 // set to something other than the content size, we can't recover the | 26 // set to something other than the content size, we can't recover the |
27 // original content size. | 27 // original content size. |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return result; | 501 return result; |
502 } | 502 } |
503 | 503 |
504 int _getSpanCount(ViewLayout item) { | 504 int _getSpanCount(ViewLayout item) { |
505 GridLayoutParams childLayout = item.layoutParams; | 505 GridLayoutParams childLayout = item.layoutParams; |
506 return (_dimension == Dimension.WIDTH | 506 return (_dimension == Dimension.WIDTH |
507 ? childLayout.columnSpan | 507 ? childLayout.columnSpan |
508 : childLayout.rowSpan); | 508 : childLayout.rowSpan); |
509 } | 509 } |
510 } | 510 } |
OLD | NEW |