ladybird/Libraries/LibWeb/CSS/Units.json
Sam Atkins 693517daa0 LibWeb: Resolve container-relative length units
Add cqw/cqh/cqi/cqb/cqmin/cqmax to the unit tables and generated
helpers, then thread them through the shared length resolution path.

Length::ResolutionContext now carries the subject element and whether
its inline axis is horizontal. Container units need that extra context:
the nearest eligible query container is selected from the subject
element's flat-tree ancestors, and cqi/cqb/cqmin/cqmax map logical axes
through the subject's writing mode before resolving to a physical width
or height.

Teach Length to resolve each axis against the selected container's
content box, fall back to viewport lengths when no eligible container
exists, and mark size-container dependencies so post-layout
recomputation can happen when layout is not up to date.

Also expose the new units through Typed OM, reject them for
computationally independent `@property` initial values, and add focused
font-size coverage.
2026-06-01 08:27:17 +01:00

200 lines
3.8 KiB
JSON

{
"angle": {
"deg": {
"is-canonical-unit": true
},
"grad": {
"number-of-canonical-unit": 0.9
},
"rad": {
"number-of-canonical-unit": 57.2957795130823208767981548141051703324054724665643215491602438612028471483
},
"turn": {
"number-of-canonical-unit": 360
}
},
"flex": {
"fr": {
"is-canonical-unit": true
}
},
"frequency": {
"Hz": {
"is-canonical-unit": true
},
"kHz": {
"number-of-canonical-unit": 1000
}
},
"length": {
"cap": {
"relative-to": "font"
},
"ch": {
"relative-to": "font"
},
"cm": {
"number-of-canonical-unit": 37.7952755905511811023622047244094488188976377952755905511811023622047244094
},
"cqb": {
"relative-to": "container"
},
"cqh": {
"relative-to": "container"
},
"cqi": {
"relative-to": "container"
},
"cqmax": {
"relative-to": "container"
},
"cqmin": {
"relative-to": "container"
},
"cqw": {
"relative-to": "container"
},
"dvb": {
"relative-to": "viewport"
},
"dvh": {
"relative-to": "viewport"
},
"dvi": {
"relative-to": "viewport"
},
"dvmax": {
"relative-to": "viewport"
},
"dvmin": {
"relative-to": "viewport"
},
"dvw": {
"relative-to": "viewport"
},
"em": {
"relative-to": "font"
},
"ex": {
"relative-to": "font"
},
"ic": {
"relative-to": "font"
},
"in": {
"number-of-canonical-unit": 96
},
"lh": {
"relative-to": "font"
},
"lvb": {
"relative-to": "viewport"
},
"lvh": {
"relative-to": "viewport"
},
"lvi": {
"relative-to": "viewport"
},
"lvmax": {
"relative-to": "viewport"
},
"lvmin": {
"relative-to": "viewport"
},
"lvw": {
"relative-to": "viewport"
},
"mm": {
"number-of-canonical-unit": 3.77952755905511811023622047244094488188976377952755905511811023622047244094
},
"pc": {
"number-of-canonical-unit": 16
},
"pt": {
"number-of-canonical-unit": 1.33333333333333333333333333333333333333333333333333333333333333333333333333
},
"px": {
"is-canonical-unit": true
},
"Q": {
"number-of-canonical-unit": 0.94488188976377952755905511811023622047244094488188976377952755905511811023
},
"rcap": {
"relative-to": "font"
},
"rch": {
"relative-to": "font"
},
"rem": {
"relative-to": "font"
},
"rex": {
"relative-to": "font"
},
"ric": {
"relative-to": "font"
},
"rlh": {
"relative-to": "font"
},
"svb": {
"relative-to": "viewport"
},
"svh": {
"relative-to": "viewport"
},
"svi": {
"relative-to": "viewport"
},
"svmax": {
"relative-to": "viewport"
},
"svmin": {
"relative-to": "viewport"
},
"svw": {
"relative-to": "viewport"
},
"vb": {
"relative-to": "viewport"
},
"vh": {
"relative-to": "viewport"
},
"vi": {
"relative-to": "viewport"
},
"vmax": {
"relative-to": "viewport"
},
"vmin": {
"relative-to": "viewport"
},
"vw": {
"relative-to": "viewport"
}
},
"resolution": {
"dpcm": {
"number-of-canonical-unit": 0.02645833333333333333333333333333333333333333333333333333333333333333333333
},
"dpi": {
"number-of-canonical-unit": 0.01041666666666666666666666666666666666666666666666666666666666666666666666
},
"dppx": {
"is-canonical-unit": true
},
"x": {
"number-of-canonical-unit": 1
}
},
"time": {
"ms": {
"number-of-canonical-unit": 0.001
},
"s": {
"is-canonical-unit": true
}
}
}