| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 max = const MaxContentSizing(); | 115 max = const MaxContentSizing(); |
| 116 | 116 |
| 117 TrackSizing(this.min, this.max) {} | 117 TrackSizing(this.min, this.max) {} |
| 118 | 118 |
| 119 // TODO(jmesserly): this is only needed because FixedSizing is mutable | 119 // TODO(jmesserly): this is only needed because FixedSizing is mutable |
| 120 TrackSizing clone() => new TrackSizing(min.clone(), max.clone()); | 120 TrackSizing clone() => new TrackSizing(min.clone(), max.clone()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** Represents a GridTrack breadth property. */ | 123 /** Represents a GridTrack breadth property. */ |
| 124 // TODO(jmesserly): these classes could be replaced with reflection/mirrors | 124 // TODO(jmesserly): these classes could be replaced with reflection/mirrors |
| 125 interface _BreadthAccumulator { | 125 abstract class _BreadthAccumulator { |
| 126 void setSize(GridTrack t, num value); | 126 void setSize(GridTrack t, num value); |
| 127 num getSize(GridTrack t); | 127 num getSize(GridTrack t); |
| 128 | 128 |
| 129 SizingFunction getSizingFunction(GridTrack t); | 129 SizingFunction getSizingFunction(GridTrack t); |
| 130 } | 130 } |
| 131 | 131 |
| 132 class _UsedBreadthAccumulator implements _BreadthAccumulator { | 132 class _UsedBreadthAccumulator implements _BreadthAccumulator { |
| 133 const _UsedBreadthAccumulator(); | 133 const _UsedBreadthAccumulator(); |
| 134 | 134 |
| 135 void setSize(GridTrack t, num value) { t.usedBreadth = value; } | 135 void setSize(GridTrack t, num value) { t.usedBreadth = value; } |
| 136 num getSize(GridTrack t) => t.usedBreadth; | 136 num getSize(GridTrack t) => t.usedBreadth; |
| 137 | 137 |
| 138 SizingFunction getSizingFunction(GridTrack t) => t.minSizing; | 138 SizingFunction getSizingFunction(GridTrack t) => t.minSizing; |
| 139 } | 139 } |
| 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 |