LibWeb: Don't serialize longhands if we directly serialized shorthand

The spec assumes that we only store values against expanded longhands,
there are however limited circumstances where we store against
shorthands directly in addition to the expanded longhands. For example
if the value of the shorthand is unresolved we store an
UnresolvedStyleValue against the shorthand directly and a
PendingSubstitutionStyleValue against each of the longhands.

This commit updates the logic so that in the case we serialize a
shorthand directly we should also mark it's longhands as serialized to
avoid serializing them separately.

This also avoids the scenario where we tried to create and serialize a
ShorthandStyleValue with PendingSubstitutionStyleValue longhands, so we
can remove the check and related FIXME for that.
This commit is contained in:
Callum Law
2025-06-12 18:53:08 +12:00
committed by Sam Atkins
parent f8f4da3b90
commit 62da650992
Notes: github-actions[bot] 2025-06-16 11:38:57 +00:00
2 changed files with 21 additions and 9 deletions

View File

@@ -2,9 +2,8 @@ Harness status: OK
Found 4 tests
2 Pass
2 Fail
4 Pass
Pass Longhand with variable preserves original serialization: with whitespace
Fail Shorthand with variable preserves original serialization: with whitespace
Pass Shorthand with variable preserves original serialization: with whitespace
Pass Longhand with variable preserves original serialization but trims whitespace: without whitespace
Fail Shorthand with variable preserves original serialization but trims whitespace: without whitespace
Pass Shorthand with variable preserves original serialization but trims whitespace: without whitespace