Open Bug 2017250 Opened 1 month ago Updated 11 hours ago

Add initial infrastructure for list-valued property reification in Typed OM

Categories

(Core :: CSS Parsing and Computation, task)

task

Tracking

()

REOPENED
150 Branch
Tracking Status
firefox150 --- affected

People

(Reporter: janv, Assigned: janv)

References

(Blocks 2 open bugs)

Details

(Keywords: leave-open)

Attachments

(19 files, 4 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Introduce initial infrastructure for reification of list-valued CSS properties in Typed OM.

This includes:

  • Changing ToTyped to write into a TypedValueList instead of returning a single value.
  • Using existing #[css(iterable)] metadata to trigger subdivision of list-valued properties into iterations.
  • Supporting subdivision logic for both StylePropertyMap.get()/getAll() and future CSSStyleValue::parse().

This provides the foundation for proper reification of list-valued properties. As a result, some existing Typed OM WPTs for list-valued properties may start passing. Broader property coverage and more complete reification support will follow in subsequent bugs.

In other words, this is mainly about creating the infrastructure so that StylePropertyMap will be able to return multiple values for a list-valued property.

Depends on: 2004057

Introduce initial infrastructure for reification of list-valued CSS
properties in Typed OM.

Change the ToTyped trait to append results into a ThinVec<TypedValue> instead
of returning a single TypedValue, allowing values to reify into multiple Typed
OM objects.

Add a convenience helper to_typed_value() which returns the first TypedValue
so existing call sites continue to behave as before, and update the derive and
callers accordingly.

Refactor reify_number and reify_percentage to return the final TypedValue
type directly.

This prepares for upcoming iterable reification changes where these helpers
will append results into the output vector used by ToTyped::to_typed.

This patch extends the ToTyped derive to support fields marked with
entries.

When such a field is present, the generated implementation iterates over the
items and delegates to ToTyped for each element, adding the necessary trait
bounds only for the element types involved. This keeps the derive lightweight
and avoids forcing unrelated container types to implement ToTyped.

This builds on the earlier derive_fields support and prepares the groundwork
for proper reification of list-valued CSS properties.

Fix what appears to be a copy/paste error in the WPT for the container-name
property.

The test appears to have been copied from the container-type test. Adjust it
so it correctly reflects the behavior of container-name with multiple values.

Update ToTyped derive documentation to better describe supported attributes
and their behavior.

Teach the ToTyped derive to recognize #[css(comma)] as a signal that an
iterable field represents a comma-separated CSS list whose items can be
reified as separate TypedValue entries.

If #[css(comma)] is not present and the iterable contains more than one item,
the derive treats the value as unsupported and returns Err(()).

This matches current Typed OM Level 1 behavior reflected by WPT, where only
comma-separated lists are subdivided into iterations. Properties such as
container-name may accept multiple space-separated values but are currently
reified as unsupported when more than one value is present.

Demonstrate iterable-field support in the ToTyped derive using the
container-name property.

The property accepts a list of identifiers, but Typed OM Level 1 currently
treats space-separated multi-value cases as unsupported. Reification therefore
succeeds for a single identifier and returns Err(()) when more than one value
is present.

Demonstrate iterable-field support in the ToTyped derive using the
container-name property.

The property accepts a list of identifiers, but Typed OM Level 1 currently
treats space-separated multi-value cases as unsupported. Reification therefore
succeeds for a single identifier and returns Err(()) when more than one value
is present.

Demonstrate iterable-field support in the ToTyped derive using the
container-name property.

The property accepts a list of identifiers, but Typed OM Level 1 currently
treats space-separated multi-value cases as unsupported. Reification therefore
succeeds for a single identifier and returns Err(()) when more than one value
is present.

Demonstrate iterable-field support in the ToTyped derive using the
container-name property.

The property accepts a list of identifiers, but Typed OM Level 1 currently
treats space-separated multi-value cases as unsupported. Reification therefore
succeeds for a single identifier and returns Err(()) when more than one value
is present.

Demonstrate iterable-field support in the ToTyped derive using the
container-name property.

The property accepts a list of identifiers, but Typed OM Level 1 currently
treats space-separated multi-value cases as unsupported. Reification therefore
succeeds for a single identifier and returns Err(()) when more than one value
is present.

Attachment #9550630 - Attachment is obsolete: true

Enable ToTyped derive for the OwnedList type used for computed values
generated by helpers.mako.rs for predefined types using the vector
field.

This further exercises the iterable-field support recently added to the
ToTyped derive. A few default ToTyped implementations were also added for
element types used by these iterable OwnedList representations.

This makes Typed OM reification pass WPTs for the following properties:

  • animation-direction
  • animation-fill-mode
  • animation-play-state
  • backdrop-filter
  • background-attachment
  • background-blend-mode
  • background-clip
  • background-image
  • background-origin
  • background-size
  • box-shadow
  • filter
  • mask-image

Enable ToTyped derive for SpecifiedValue type generated by helpers.mako.rs for
predefined types using the vector field.

This exercises the recently added iterable-field support in the ToTyped derive
across a broader set of property value types. Some additional ToTyped
implementations were added for element types used by these iterable
SpecifiedValue representations.

No new WPTs pass yet, as relevant tests also require iterable computed values
to be supported.

Attachment #9550627 - Attachment is obsolete: true
Attachment #9550628 - Attachment is obsolete: true
Attachment #9550629 - Attachment is obsolete: true

Enable ToTyped derive for ComputedList type generated by helpers.mako.rs for
predefined types using the vector field.

This further exercises the iterable-field support recently added to the
ToTyped derive.

This makes Typed OM reification pass WPTs for the text-shadow property.

animation-iteration-count values can now be reified into Typed OM values.

animation-name values can now be reified into Typed OM values.

background-repeat values can now be reified into Typed OM values.

Refactor the ToTyped derive implementation so that multiple supported fields
can contribute TypedValue items. The derive now accumulates the reified output
of fields into a temporary list and validates the result against the variant's

No observable behavior changes occur yet. Existing derived types either
reify a single field or rely on iterable fields, so existing WPT tests
continue to pass.

A follow-up patch will demonstrate the new behavior by enabling reification
for BackgroundSize type (background-size property).

Allow fields participating in ToTyped derive reification to be conditionally
skipped using a new #[typed_value(skip_if = "...")] attribute.

When present, the provided function is called with the field value during
reification. If it returns true, the field is ignored and produces no
TypedValue items.

This is useful for fields that only contribute to reification in specific
situations, without requiring the entire variant or struct to be treated as
unsupported.

Demonstrate multi-field support in the ToTyped derive using the
background-size property.

The ExplicitSize variant contains separate width and height fields.
Reification now derives TypedValue items for both fields, using

This allows cases such as background-size: 3.14px or 200px 100px to
reify correctly (the former producing a CSSUnitValue while the latter falls
back to CSSUnsupportedValue).

Negative values are invalid per the property definition, but in computed-value
tests they effectively appear as 0. Without custom handling in the test,
negative percentage inputs were compared directly, causing failures across
browsers (e.g. when setting values such as -3.14%).

Add a custom computed-value assertion that clamps percentage values below 0
to 0 before comparison.

Fix what appears to be a copy/paste error in the WPT for the fill-rule
property.

The test currently uses the helper intended for list-valued properties even
though fill-rule is not list-valued. This does not affect the actual coverage,
since the helper ultimately delegates to the same underlying test logic, but
it is misleading.

Switch the test to the appropriate helper so it correctly reflects the
behavior of fill-rule.

transition-timing-function values can now be reified into Typed OM values.

Keywords: leave-open
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/cfe4b640ee6d https://hg.mozilla.org/integration/autoland/rev/703247f3dc89 Return final TypedValue from reify_number/percentage; r=firefox-style-system-reviewers,dshin
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/3f9dbb9c2200 https://hg.mozilla.org/integration/autoland/rev/1b93cd4c1ad0 Change ToTyped to append into a ThinVec; r=firefox-style-system-reviewers,dshin
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/58495e10c188 https://hg.mozilla.org/integration/autoland/rev/e5f3f483bd3e Update documentation for ToTyped derive; r=firefox-style-system-reviewers,dshin https://github.com/mozilla-firefox/firefox/commit/e96510b03d61 https://hg.mozilla.org/integration/autoland/rev/d966f63c2771 Extend ToTyped derive to support iterable fields; r=firefox-style-system-reviewers,dshin
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/2a395257ca40 https://hg.mozilla.org/integration/autoland/rev/083dcd6e7206 Support #[css(comma)] in ToTyped derive for list-valued property reification; r=firefox-style-system-reviewers,dshin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/58505 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Keywords: leave-open
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/8da047f2352d https://hg.mozilla.org/integration/autoland/rev/080771f8e35b Demonstrate ToTyped derive on iterable field (container-name); r=emilio,firefox-style-system-reviewers
Status: NEW → RESOLVED
Closed: 5 days ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
Status: RESOLVED → REOPENED
Keywords: leave-open
Resolution: FIXED → ---
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/cb6a88b9bb17 https://hg.mozilla.org/integration/autoland/rev/b21e681bfaa2 Enable reification for SpecifiedValue used by predefined types with vector; r=firefox-style-system-reviewers,boris
Blocks: 2023997
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/0ce894ada67d https://hg.mozilla.org/integration/autoland/rev/4e3d5741d554 Enable reification for OwnedList (computed values) used by predefined types with vector; r=firefox-style-system-reviewers,boris
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/9e20cf6a61f7 https://hg.mozilla.org/integration/autoland/rev/75ced7b38d80 Enable reification for ComputedList used by predefined types with vector; r=firefox-style-system-reviewers,boris
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/684219f31d6b https://hg.mozilla.org/integration/autoland/rev/c93c5649168b Enable reification for AnimationIterationCount; r=firefox-style-system-reviewers,boris https://github.com/mozilla-firefox/firefox/commit/81324e5fb4e0 https://hg.mozilla.org/integration/autoland/rev/5d0d81c73930 Enable reification for AnimationName; r=firefox-style-system-reviewers,boris https://github.com/mozilla-firefox/firefox/commit/d88050142b25 https://hg.mozilla.org/integration/autoland/rev/79aa8c3d89b1 Enable reification for BackgroundRepeat; r=firefox-style-system-reviewers,boris
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/547b95d07407 https://hg.mozilla.org/integration/autoland/rev/e6e038b4bcdf Refactor ToTyped derive to support multiple fields; r=emilio,firefox-style-system-reviewers https://github.com/mozilla-firefox/firefox/commit/522123402214 https://hg.mozilla.org/integration/autoland/rev/3c83e7cabfb2 Add #[typed_value(skip_if)] support to ToTyped derive; r=emilio,firefox-style-system-reviewers
Pushed by jvarga@igalia.com: https://github.com/mozilla-firefox/firefox/commit/922c8db835a4 https://hg.mozilla.org/integration/autoland/rev/222a9e780b85 Demonstrate ToTyped derive on multi-field BackgroundSize type; r=emilio,firefox-style-system-reviewers
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/58664 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: