Add missing pieces for CSSMathValue objects
Categories
(Core :: CSS Parsing and Computation, task)
Tracking
()
People
(Reporter: janv, Assigned: janv)
References
(Blocks 2 open bugs)
Details
(Keywords: leave-open)
Attachments
(19 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 |
This bug tracks additional implementation work for CSSMathValue objects as defined in the CSS Typed OM Level 1 specification.
The work focuses on object infrastructure, including constructors, attribute getters, and serialization support for CSSMathValue subclasses.
This complements the existing stub CSSMathValue implementation and provides the remaining pieces needed for CSSMathProduct, CSSMathNegate, CSSMathInvert, CSSMathMin, CSSMathMax, and CSSMathClamp objects to be usable from JS.
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.
| Assignee | ||
Comment 1•5 days ago
|
||
Change MathSum from a wrapper struct to a type alias for ThinVec<NumericValue>,
matching the representation used by some other types.
This reduces boilerplate when constructing and iterating over sum values, and
prepares for introducing a separate MathValue enum matching CSSMathValue and
its subclasses.
| Assignee | ||
Comment 2•5 days ago
|
||
Change CSSNumericValue::ToStyleNumericValue() to return
Maybe<StyleNumericValue> instead of StyleNumericValueResult.
This matches the style planned for future conversion helpers and avoids the
need for dedicated result wrapper types for each return value.
| Assignee | ||
Comment 3•5 days ago
|
||
Introduce MathValue as the representation for CSSMathValue subclasses and move
MathSum under it.
This makes NumericValue distinguish between CSSUnitValue and CSSMathValue at
the top level, with individual CSSMathValue subclasses represented by
MathValue. Although this adds a small amount of construction boilerplate, it
gives the C++ side a cleaner type hierarchy and allows CSSMathValue-specific
switch statements without mixing in unrelated CSSUnitValue handling.
This also prepares adding the remaining CSSMathValue subclasses.
| Assignee | ||
Comment 4•5 days ago
|
||
Return the CSSMathOperator value corresponding to the stored MathValueType.
This currently only handles CSSMathSum, with the temporary uninitialized state
falling back to "sum". Follow-up patches will extend this as more CSSMathValue
subclasses are added.
| Assignee | ||
Comment 5•5 days ago
|
||
Make CSSMathSum use the existing CSSNumericValue creation, serialization, and
conversion helpers instead of handling CSSUnitValue directly.
This removes CSSMathSum-specific type checks and keeps the implementation
consistent with the rest of the code. It also prepares for adding the remaining
CSSMathValue subclasses, which will rely on the same CSSNumericValue entry
points.
| Assignee | ||
Comment 6•5 days ago
|
||
Add a CSSNumericValue::ToCssTextWithProperty overload with an explicit nested
flag and propagate it to CSSMathSum::ToCssTextWithProperty.
CSSMathSum currently always serializes as calc(...), even when nested inside
another math expression, resulting in output such as calc(calc(...)). With the
nested serialization context, nested sums are serialized using parentheses
instead, matching the CSSMathSum serialization algorithm.
While this fixes CSSMathSum serialization behavior, it also prepares for adding
other CSSMathValue subclasses that may need nested serialization support.
| Assignee | ||
Comment 7•5 days ago
|
||
Fix what appears to be a copy-and-paste error in the CSS Typed OM
serialization tests.
The "CSSMathMax with pixel arguments" test was constructing CSSMathMin and
expecting min(...) serialization. Update it to construct CSSMathMax and expect
max(...) serialization, matching the test description and surrounding
CSSMathMax coverage.
| Assignee | ||
Comment 8•5 days ago
|
||
Implement the remaining CSSMathMin object infrastructure, including the
constructor, values getter, and serialization support.
This makes CSSMathMin usable from JS and removes the corresponding WPT
expectations. Some functionality, such as type checking and future conversion
to StyleMathMin, will be implemented in follow-up bugs.
| Assignee | ||
Comment 9•4 days ago
|
||
Bug 2035572 refactored numeric types to distinguish between NoCalc and Calc
variants. As a result, percentage reification no longer receives values that
need the was_calc flag, and the flag is always false.
Remove the unused parameter and the corresponding dead code.
| Assignee | ||
Comment 10•4 days ago
|
||
Implement the remaining CSSMathMax object infrastructure, including the
constructor, values getter, and serialization support.
This makes CSSMathMax usable from JS and removes the corresponding WPT
expectations. Some functionality, such as type checking and future conversion
to StyleMathMax, will be implemented in follow-up bugs.
| Assignee | ||
Comment 11•4 days ago
|
||
Implement the remaining CSSMathClamp object infrastructure, including the
constructor, values getter, and serialization support.
This makes CSSMathClamp usable from JS and removes the corresponding WPT
expectations. Some functionality, such as type checking and future conversion
to StyleMathClamp, will be implemented in follow-up bugs.
| Assignee | ||
Comment 12•4 days ago
|
||
Implement the remaining CSSMathNegate object infrastructure, including the
constructor, values getter, and serialization support.
This makes CSSMathNegate usable from JS and removes the corresponding WPT
expectations. Some functionality, such as type checking and future conversion
to StyleMathNegate, will be implemented in follow-up bugs.
| Assignee | ||
Comment 13•4 days ago
|
||
Implement the remaining CSSMathInvert object infrastructure, including the
constructor, values getter, and serialization support.
This makes CSSMathInvert usable from JS and removes the corresponding WPT
expectations. Some functionality, such as type checking and future conversion
to StyleMathInvert, will be implemented in follow-up bugs.
| Assignee | ||
Comment 14•4 days ago
|
||
Implement the remaining CSSMathProduct object infrastructure, including the
constructor, values getter, and serialization support.
This makes CSSMathProduct usable from JS and removes the corresponding WPT
expectations. Some functionality, such as type checking and future conversion
to StyleMathProduct, will be implemented in follow-up bugs.
| Assignee | ||
Comment 15•4 days ago
|
||
Add a CSSNumericValue::ToCssTextWithProperty overload with an explicit
paren-less flag and propagate it to CSSMathValue::ToCssTextWithProperty.
For example, CSSMathMin currently always serializes nested values with
parentheses, resulting in output such as min((1 + 2), 3). With the paren-less
serialization context, nested values can be serialized as min(1 + 2, 3),
matching the CSSMathMin serialization algorithm.
This builds on the nested serialization context added previously and adjusts
the remaining CSSMathValue subclasses for correct serialization behavior.
| Assignee | ||
Comment 16•4 days ago
|
||
Replace the nested and paren-less boolean parameters with a dedicated
CSSNumericValue::SerializationContext.
The previous API allowed an invalid combination where paren-less serialization
was requested without nested serialization. The new context represents only the
valid serialization states: root, nested, and nested paren-less.
This keeps the serialization code aligned with the CSSMathValue serialization
algorithms in the spec while making the call sites harder to misuse.
| Assignee | ||
Comment 17•4 days ago
|
||
Handle CSSMathNegate children specially when serializing CSSMathSum.
The CSSMathSum serialization algorithm represents CSSMathNegate arguments after
the first value using subtraction syntax. For example, a sum that previously
serialized as calc(1 + (-2) + 3) now correctly serializes as calc(1 - 2 + 3).
This fixes the corresponding CSSMathSum serialization WPT.
| Assignee | ||
Comment 18•4 days ago
|
||
Update the CSSTransformValue serialization expectation for a nested
CSSMathProduct containing CSSMathInvert.
The CSSMathProduct serialization algorithm represents CSSMathInvert arguments
after the first value using division syntax. As a result, the value should
serialize as calc(1deg / 0), not calc(1deg * (1 / 0)).
This matches the current WebKit behavior and the serialization behavior fixed
in the following patch.
| Assignee | ||
Comment 19•4 days ago
|
||
Handle CSSMathInvert children specially when serializing CSSMathProduct.
The CSSMathProduct serialization algorithm represents CSSMathInvert arguments
after the first value using division syntax. For example, a product that
previously serialized as calc(1 * (1 / 2) * 3) now correctly serializes as
calc(1 / 2 * 3).
This fixes the corresponding CSSMathProduct serialization WPT.
| Assignee | ||
Updated•1 day ago
|
Comment 20•19 hours ago
|
||
Comment 21•15 hours ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b5210a0ee254
https://hg.mozilla.org/mozilla-central/rev/fab306bc6a8a
https://hg.mozilla.org/mozilla-central/rev/c53dc24d26e0
https://hg.mozilla.org/mozilla-central/rev/35c9fc741bc1
https://hg.mozilla.org/mozilla-central/rev/88fe2a75d85e
https://hg.mozilla.org/mozilla-central/rev/d08eb505617c
https://hg.mozilla.org/mozilla-central/rev/d8a64705b7dc
Comment 22•13 hours ago
|
||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/60440 for changes under testing/web-platform/tests
Comment 24•1 hour ago
|
||
| bugherder | ||
Comment 25•28 minutes ago
|
||
Description
•