Create a representation for `@container style()` range queries in the style system
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox150 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
The current prototype support for @container style() queries supports custom-property queries like style(--foo), but the StyleFeature type does not support range queries like style(--foo >= 10px) or style(1em < --foo < 2em). As a first step towards this, we need to create a suitable type to represent these queries, before they can be parsed and processed.
My current thought is to convert the StyleFeature struct into an enum with variants for "plain" and "range" queries, where a "plain" query just has a custom property name and (optionally) value, while a "range" query has a sequence of values and operators.
Comment 1•9 months ago
|
||
Would be good to somehow reuse the existing QueryFeatureExpressionKind, which feels pretty similar in that regard: https://searchfox.org/firefox-main/rev/7709f0a26aeb3c39a5fd86e794425530f0d0b528/servo/components/style/queries/feature_expression.rs#159
| Assignee | ||
Comment 2•8 months ago
|
||
There are separate variants for queries with two values (a < b) vs those
with three values (a < b < c). Another approach would be a single type
where the second operator and third value are Option<>s, but implementing
them as distinct type variants makes for clearer code overall, IMO.
This shares the QueryExpressionValue type with QueryFeatureExpressionKind,
but will be used directly by the condition code rather than embedded in a
QueryFeatureExpression struct, as the feature_type and feature_index fields
there are irrelevant to style-range queries.
Updated•8 months ago
|
Comment 4•8 months ago
|
||
| bugherder | ||
Updated•7 months ago
|
Description
•