( edges: Value[], physicalEdge: number, ownerSize: number, // For margin/position we allow auto; for padding/border auto resolves to 0 allowAuto = false, )
| 202 | const EDGE_BOTTOM = 3 |
| 203 | |
| 204 | function resolveEdge( |
| 205 | edges: Value[], |
| 206 | physicalEdge: number, |
| 207 | ownerSize: number, |
| 208 | // For margin/position we allow auto; for padding/border auto resolves to 0 |
| 209 | allowAuto = false, |
| 210 | ): number { |
| 211 | // Precedence: specific edge > horizontal/vertical > all |
| 212 | let v = edges[physicalEdge]! |
| 213 | if (v.unit === Unit.Undefined) { |
| 214 | if (physicalEdge === EDGE_LEFT || physicalEdge === EDGE_RIGHT) { |
| 215 | v = edges[Edge.Horizontal]! |
| 216 | } else { |
| 217 | v = edges[Edge.Vertical]! |
| 218 | } |
| 219 | } |
| 220 | if (v.unit === Unit.Undefined) { |
| 221 | v = edges[Edge.All]! |
| 222 | } |
| 223 | // Start/End map to Left/Right for LTR (Ink is always LTR) |
| 224 | if (v.unit === Unit.Undefined) { |
| 225 | if (physicalEdge === EDGE_LEFT) v = edges[Edge.Start]! |
| 226 | if (physicalEdge === EDGE_RIGHT) v = edges[Edge.End]! |
| 227 | } |
| 228 | if (v.unit === Unit.Undefined) return 0 |
| 229 | if (v.unit === Unit.Auto) return allowAuto ? NaN : 0 |
| 230 | return resolveValue(v, ownerSize) |
| 231 | } |
| 232 | |
| 233 | function resolveEdgeRaw(edges: Value[], physicalEdge: number): Value { |
| 234 | let v = edges[physicalEdge]! |
no test coverage detected