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 // This file has classes representing the grid sizing functions | 5 // This file has classes representing the grid sizing functions |
6 | 6 |
7 /** | 7 /** |
8 * Represents the sizing function used for the min or max of a row or column. | 8 * Represents the sizing function used for the min or max of a row or column. |
9 */ | 9 */ |
10 // TODO(jmesserly): rename to GridSizing, or make internal | 10 // TODO(jmesserly): rename to GridSizing, or make internal |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // TODO(jmesserly): kind of ugly to have this mutable property here, but | 38 // TODO(jmesserly): kind of ugly to have this mutable property here, but |
39 // we need to correctly track whether we're content sized during a layout | 39 // we need to correctly track whether we're content sized during a layout |
40 bool _contentSized; | 40 bool _contentSized; |
41 | 41 |
42 FixedSizing(this.length, [this.units = 'px']) | 42 FixedSizing(this.length, [this.units = 'px']) |
43 : super(), | 43 : super(), |
44 _contentSized = false { | 44 _contentSized = false { |
45 if (units != 'px' && units != '%') { | 45 if (units != 'px' && units != '%') { |
46 // TODO(jmesserly): support other unit types | 46 // TODO(jmesserly): support other unit types |
47 throw new UnsupportedOperationException('Units other than px and %'); | 47 throw new UnsupportedError('Units other than px and %'); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 // TODO(jmesserly): this is only needed because of our mutable property | 51 // TODO(jmesserly): this is only needed because of our mutable property |
52 FixedSizing clone() => new FixedSizing(length, units); | 52 FixedSizing clone() => new FixedSizing(length, units); |
53 | 53 |
54 bool get isMinContentSized => _contentSized; | 54 bool get isMinContentSized => _contentSized; |
55 | 55 |
56 num resolveLength(num gridSize) { | 56 num resolveLength(num gridSize) { |
57 if (units == '%') { | 57 if (units == '%') { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 class _MaxBreadthAccumulator implements _BreadthAccumulator { | 141 class _MaxBreadthAccumulator implements _BreadthAccumulator { |
142 const _MaxBreadthAccumulator(); | 142 const _MaxBreadthAccumulator(); |
143 | 143 |
144 void setSize(GridTrack t, num value) { t.maxBreadth = value; } | 144 void setSize(GridTrack t, num value) { t.maxBreadth = value; } |
145 num getSize(GridTrack t) => t.maxBreadth; | 145 num getSize(GridTrack t) => t.maxBreadth; |
146 | 146 |
147 SizingFunction getSizingFunction(GridTrack t) => t.maxSizing; | 147 SizingFunction getSizingFunction(GridTrack t) => t.maxSizing; |
148 } | 148 } |
149 | 149 |
OLD | NEW |