Open Bug 2044316 Opened 4 days ago Updated 2 days ago

Implement additional CSSMathValue reification support

Categories

(Core :: CSS Parsing and Computation, task)

task

Tracking

()

ASSIGNED

People

(Reporter: janv, Assigned: janv)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Attachments

(16 files, 1 obsolete file)

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

This bug tracks additional CSSMathValue reification work as defined in the CSS Typed OM Level 1 specification.

The work focuses on completing support for reifying CSS math expressions into the corresponding CSSMathValue subclasses, including CSSMathProduct, CSSMathNegate, CSSMathInvert, CSSMathMin, CSSMathMax, and CSSMathClamp.

This complements the existing CSSStyleValue reification infrastructure and extends the TypedValue machinery to represent a broader range of numeric expressions in their Typed OM form.

This intentionally excludes CSSMathSum, which already gained most of the required infrastructure to support reification and associated WPT coverage. However, this bug may still include additional improvements that are shared with or benefit CSSMathSum as well.

Fix the argument order in parse.tentative.html so the actual value is passed
before the expected value.

The previous ordering made failure output confusing because the expected and
actual values were reported in the wrong direction. No behavior change is
intended.

Reorder the math value match arms in CalcNode::to_typed_impl to match the
ordering of the corresponding GenericCalcNode variants.

This makes the code easier to navigate while preparing for additional math
reification support. No functional changes intended.

Add helper constructors for CalcNodeWithLevel and use them at existing call
sites.

This avoids repeating CalcNodeWithLevel initialization boilerplate and makes
the code easier to follow while preparing for additional math reification
support. No functional changes intended.

This patch introduces infrastructure for reifying min() expressions into
CSSMathMin objects as part of the CSS Typed OM implementation.

A new MathMin type is added to represent min() expressions, mirroring the
CSSMathMin object, and is integrated into the MathValue enum.

This is an incremental step, support for additional expressions will be added
in follow-up patches.

This patch introduces infrastructure for reifying max() expressions into
CSSMathMax objects as part of the CSS Typed OM implementation.

A new MathMax type is added to represent max() expressions, mirroring the
CSSMathMax object, and is integrated into the MathValue enum.

This is an incremental step, support for additional expressions will be added
in follow-up patches.

Add OwnedArray<T, N>, a cbindgen-friendly replacement for Box<[T; N]>.

OwnedArray provides a compact allocation-backed container for a fixed number
of elements while exposing a simple representation to generated C++ bindings.

This utility is expected to be useful in other cases in the future. As an
immediate follow-up, it will be used by CSSMathClamp reification.

This patch introduces infrastructure for reifying clamp() expressions into
CSSMathClamp objects as part of the CSS Typed OM implementation.

A new MathClamp type is added to represent clamp() expressions, mirroring the
CSSMathClamp object, and is integrated into the MathValue enum.

This is an incremental step, support for additional expressions will be added
in follow-up patches.

Add a CSSNumericValue.parse() test for calc() subtraction.

The new test verifies that subtraction is reified as CSSMathSum containing a
CSSMathNegate argument, matching the math expression reification algorithm.

This patch introduces infrastructure for reifying subtraction expressions into
CSSMathNegate objects as part of the CSS Typed OM implementation.

A new MathNegate type is added to represent subtraction expressions, mirroring
the CSSMathNegate object, and is integrated into the MathValue enum.

This is an incremental step, support for additional expressions will be added
in follow-up patches.

This patch introduces initial plumbing for reifying inversion expressions into
CSSMathInvert objects as part of the CSS Typed OM implementation.

A new MathInvert type is added to represent inversion expressions, mirroring
the CSSMathInvert object, and is integrated into the MathValue enum.

The actual reification remains unsupported for now, because division is
currently simplified or normalized away in all cases (except possibly
expressions involving colors, which are not supported by Typed OM math
expressions).

This is another incremental step; support for additional expressions will be
added in follow-up patches.

Add a CSSNumericValue.parse() test for calc() multiplication.

The new test verifies that multiplication is reified as CSSMathProduct and can
contain nested CSSMathSum, CSSMathMin, and CSSMathMax expressions, matching the math expression reification algorithm.

This patch introduces infrastructure for reifying multiplication expressions
into CSSMathProduct objects as part of the CSS Typed OM implementation.

A new MathProduct type is added to represent multiplication expressions,
mirroring the CSSMathProduct object, and is integrated into the MathValue
enum.

As a final integration step, this patch completes math expression reification
support.

Attachment #9593206 - Attachment description: Bug 2044316 - Add initial CSSMathInvert reification plumbing for inversion expressions; r=emilio → Bug 2044316 - Add initial CSSMathInvert reification plumbing for division expressions; r=emilio

Add a CSSNumericValue.parse() test for calc() division.

The new test verifies that division is reified as CSSMathProduct containing a
CSSMathInvert argument, matching the math expression reification algorithm.

This patch completes support for reifying division expressions into
CSSMathInvert objects as part of the CSS Typed OM implementation.

A previous patch added the underlying CSSMathInvert infrastructure, but the
actual reification path remained unsupported. In particular, CSSMathInvert
reification depends on CSSMathProduct support, and division expressions were
believed to be simplified or normalized away before reification.

A new WPT uncovered a valid expression that preserves division in the
calculation tree, allowing the final CSSMathInvert reification support to be
implemented and tested.

Add a CSSNumericValue.parse() test for calc() complex expression.

The new test verifies that a complex expression is reified as a nested
CSSMathSum containing CSSMathNegate and CSSMathProduct arguments, matching the
math expression reification algorithm.

Remove the uninitialized CSSMathValue internal type and the corresponding
placeholder handling from CSSMathValue.

All CSSMathValue-derived objects now use concrete internal types, so the
uninitialized placeholder used during incremental implementation is no longer
needed.

Remove the Maybe<> wrappers from the helpers that convert CSSNumericValue
derived objects back to their Style* counterparts for Stylo.

Now that CSSMathValue derived objects always have a concrete internal type,
these conversions no longer need to handle uninitialized values.

Blocks: 2044967
Attachment #9593475 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: