Closed Bug 2014183 Opened 9 months ago Closed 8 months ago

Create a representation for `@container style()` range queries in the style system

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
150 Branch
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.

Blocks: 2014184
Blocks: 2014187

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

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.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Blocks: 2017960
Pushed by jkew@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a8ec9e4d2f23 https://hg.mozilla.org/integration/autoland/rev/64e8063a6c25 Create a QueryStyleRange type to represent style-range queries. r=firefox-style-system-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
QA Whiteboard: [qa-triage-done-c151/b150]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: