| 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 // This file has classes representing the grid tracks and grid template | 7 // This file has classes representing the grid tracks and grid template |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * The data structure representing the grid-rows or grid-columns | 10 * The data structure representing the grid-rows or grid-columns |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 _GridLocation align(_GridLocation span, int size) { | 84 _GridLocation align(_GridLocation span, int size) { |
| 85 switch (value) { | 85 switch (value) { |
| 86 case 'start': | 86 case 'start': |
| 87 return new _GridLocation(span.start, size); | 87 return new _GridLocation(span.start, size); |
| 88 case 'end': | 88 case 'end': |
| 89 return new _GridLocation(span.end - size, size); | 89 return new _GridLocation(span.end - size, size); |
| 90 case 'center': | 90 case 'center': |
| 91 size = Math.min(size, span.length); | 91 size = Math.min(size, span.length); |
| 92 num center = span.start + span.length / 2; | 92 num center = span.start + span.length / 2; |
| 93 num left = center - size / 2; | 93 num left = center - size / 2; |
| 94 return new _GridLocation(left.round().toInt(), size); | 94 return new _GridLocation(left.round(), size); |
| 95 case 'stretch': | 95 case 'stretch': |
| 96 return span; | 96 return span; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * Represents a grid-template. Used in conjunction with a grid-cell to | 103 * Represents a grid-template. Used in conjunction with a grid-cell to |
| 104 * place cells in the grid, without needing to specify the exact row/column. | 104 * place cells in the grid, without needing to specify the exact row/column. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 /** | 180 /** |
| 181 * Used to return a row/column and span during parsing of grid-row and | 181 * Used to return a row/column and span during parsing of grid-row and |
| 182 * grid-column during parsing. | 182 * grid-column during parsing. |
| 183 */ | 183 */ |
| 184 class _GridLocation { | 184 class _GridLocation { |
| 185 final int start, length; | 185 final int start, length; |
| 186 _GridLocation(this.start, this.length) {} | 186 _GridLocation(this.start, this.length) {} |
| 187 | 187 |
| 188 int get end => start + length; | 188 int get end => start + length; |
| 189 } | 189 } |
| OLD | NEW |