Serialization of declaration block is wrong when shorthand has variable reference but some of its longhands have explicit value

NEW
Unassigned

Status

()

Core
CSS Parsing and Computation
P3
normal
9 months ago
4 months ago

People

(Reporter: xidorn, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

For example,
> div { padding: var(--x); padding-left: 0px; }
would be serialized to
> div { padding-top: ; padding-right: ; padding-bottom: ; padding-left: 1px; }
which is apparently incorrect. It should be serialized to
> div { padding: var(--x); padding-left: 0px; }

This is probably tricky to implement. And actually Blink is wrong in the same way at the moment, so it is probably not a high priority issue.

The spec seems to be correct that
> shorthands that are specified with explicit var() functions must
> serialize to the original, var()-containing value. [1]
but there are probably some edge cases tricky to handle, which would need some investigation, and change proposal to the spec.


[1] https://drafts.csswg.org/css-variables/#variables-in-shorthands
(I noticed this issue while looking at Servo's ShorthandID::get_shorthand_appendable_value function. This can be fixed after Stylo, so that we don't need to fix it twice.)

Updated

4 months ago
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.