LibWeb: Use shortest serialization for repeated style list values

This commit is contained in:
Tim Ledbetter 2025-07-31 14:59:19 +01:00 committed by Jelle Raaijmakers
commit 4c91b42dd2
Notes: github-actions[bot] 2025-08-01 13:19:40 +00:00
3 changed files with 41 additions and 35 deletions

View file

@ -19,6 +19,9 @@ bool StyleValueList::Properties::operator==(Properties const& other) const
String StyleValueList::to_string(SerializationMode mode) const
{
if (m_properties.values.is_empty())
return {};
auto separator = ""sv;
switch (m_properties.separator) {
case Separator::Space:
@ -31,6 +34,10 @@ String StyleValueList::to_string(SerializationMode mode) const
VERIFY_NOT_REACHED();
}
auto first_value = m_properties.values.first();
if (all_of(m_properties.values, [&](auto const& property) { return property == first_value; }))
return first_value->to_string(mode);
StringBuilder builder;
for (size_t i = 0; i < m_properties.values.size(); ++i) {
builder.append(m_properties.values[i]->to_string(mode));

View file

@ -2,17 +2,17 @@ Harness status: OK
Found 364 tests
78 Pass
286 Fail
108 Pass
256 Fail
Fail CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (-0.25) should be [ 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px]
Fail CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (0) should be [10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px]
Pass CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (0) should be [10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px]
Fail CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (0.25) should be [12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px]
Fail CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (0.5) should be [15.0px 15.0px, 5.0px 5.0px, 15.0px 15.0px, 5.0px 5.0px]
Fail CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (0.75) should be [17.5px 17.5px, 2.5px 2.5px, 17.5px 17.5px, 2.5px 2.5px]
Fail CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (1) should be [20.0px 20.0px, 0.0px 0.0px, 20.0px 20.0px, 0.0px 0.0px]
Fail CSS Transitions: property <background-size> from neutral to [20px 20px, 0px 0px] at (1.25) should be [22.5px 22.5px, 0.0px 0.0px, 22.5px 22.5px, 0.0px 0.0px]
Fail CSS Transitions with transition: all: property <background-size> from neutral to [20px 20px, 0px 0px] at (-0.25) should be [ 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px]
Fail CSS Transitions with transition: all: property <background-size> from neutral to [20px 20px, 0px 0px] at (0) should be [10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px]
Pass CSS Transitions with transition: all: property <background-size> from neutral to [20px 20px, 0px 0px] at (0) should be [10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px]
Fail CSS Transitions with transition: all: property <background-size> from neutral to [20px 20px, 0px 0px] at (0.25) should be [12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px]
Fail CSS Transitions with transition: all: property <background-size> from neutral to [20px 20px, 0px 0px] at (0.5) should be [15.0px 15.0px, 5.0px 5.0px, 15.0px 15.0px, 5.0px 5.0px]
Fail CSS Transitions with transition: all: property <background-size> from neutral to [20px 20px, 0px 0px] at (0.75) should be [17.5px 17.5px, 2.5px 2.5px, 17.5px 17.5px, 2.5px 2.5px]
@ -75,28 +75,28 @@ Fail Web Animations: property <background-size> from [initial] to [20px 20px, 0p
Pass Web Animations: property <background-size> from [initial] to [20px 20px, 0px 0px] at (1) should be [20px 20px, 0px 0px]
Fail Web Animations: property <background-size> from [initial] to [20px 20px, 0px 0px] at (1.5) should be [20px 20px, 0px 0px]
Fail CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (-0.25) should be [120px 120px, 125px 125px, 120px 120px, 125px 125px]
Fail CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.25) should be [ 80px 80px, 75px 75px, 80px 80px, 75px 75px]
Fail CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.5) should be [ 60px 60px, 50px 50px, 60px 60px, 50px 50px]
Fail CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.75) should be [ 40px 40px, 25px 25px, 40px 40px, 25px 25px]
Fail CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (1) should be [ 20px 20px, 0px 0px, 20px 20px, 0px 0px]
Fail CSS Transitions: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (1.25) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (-0.25) should be [120px 120px, 125px 125px, 120px 120px, 125px 125px]
Fail CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.25) should be [ 80px 80px, 75px 75px, 80px 80px, 75px 75px]
Fail CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.5) should be [ 60px 60px, 50px 50px, 60px 60px, 50px 50px]
Fail CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.75) should be [ 40px 40px, 25px 25px, 40px 40px, 25px 25px]
Fail CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (1) should be [ 20px 20px, 0px 0px, 20px 20px, 0px 0px]
Fail CSS Transitions with transition: all: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (1.25) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (-0.25) should be [120px 120px, 125px 125px, 120px 120px, 125px 125px]
Fail CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.25) should be [ 80px 80px, 75px 75px, 80px 80px, 75px 75px]
Fail CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.5) should be [ 60px 60px, 50px 50px, 60px 60px, 50px 50px]
Fail CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.75) should be [ 40px 40px, 25px 25px, 40px 40px, 25px 25px]
Fail CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (1) should be [ 20px 20px, 0px 0px, 20px 20px, 0px 0px]
Fail CSS Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (1.25) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail Web Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (-0.25) should be [120px 120px, 125px 125px, 120px 120px, 125px 125px]
Fail Web Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass Web Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail Web Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.25) should be [ 80px 80px, 75px 75px, 80px 80px, 75px 75px]
Fail Web Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.5) should be [ 60px 60px, 50px 50px, 60px 60px, 50px 50px]
Fail Web Animations: property <background-size> from [inherit] to [20px 20px, 0px 0px] at (0.75) should be [ 40px 40px, 25px 25px, 40px 40px, 25px 25px]
@ -285,33 +285,33 @@ Pass Web Animations: property <background-size> from [0px 0px, 0px 0px, 0px 0px,
Pass Web Animations: property <background-size> from [0px 0px, 0px 0px, 0px 0px, 0px 0px] to [20px 20px, 40px 40px, 60px 60px, 100px 100px] at (1) should be [20px 20px, 40px 40px, 60px 60px, 100px 100px]
Pass Web Animations: property <background-size> from [0px 0px, 0px 0px, 0px 0px, 0px 0px] to [20px 20px, 40px 40px, 60px 60px, 100px 100px] at (1.25) should be [25px 25px, 50px 50px, 75px 75px, 125px 125px]
Fail CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (-0.25) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Fail CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Fail CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Fail CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Fail CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Pass CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Pass CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Pass CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Pass CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Pass CSS Transitions: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (-0.25) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Fail CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Fail CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Fail CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Fail CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Pass CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Pass CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Pass CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Pass CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Pass CSS Transitions with transition: all: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (-0.25) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Fail CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Fail CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Fail CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Fail CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Pass CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Pass CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Pass CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Pass CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Pass CSS Animations: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (-0.25) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Fail Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Fail Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Fail Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Fail Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Fail Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Pass Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0) should be [ 0px 0px, 0px 0px, 0px 0px, 0px 0px]
Pass Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.25) should be [ 20px 20px, 20px 20px, 20px 20px, 20px 20px]
Pass Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.5) should be [ 40px 40px, 40px 40px, 40px 40px, 40px 40px]
Pass Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (0.75) should be [ 60px 60px, 60px 60px, 60px 60px, 60px 60px]
Pass Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (1) should be [ 80px 80px, 80px 80px, 80px 80px, 80px 80px]
Pass Web Animations: property <background-size> from [0px 0px] to [80px 80px] at (1.25) should be [100px 100px, 100px 100px, 100px 100px, 100px 100px]
Fail CSS Transitions: property <background-size> from [0px] to [80px] at (-0.25) should be [ 0px, 0px, 0px, 0px]
Fail CSS Transitions: property <background-size> from [0px] to [80px] at (0) should be [ 0px, 0px, 0px, 0px]
Fail CSS Transitions: property <background-size> from [0px] to [80px] at (0.25) should be [ 20px, 20px, 20px, 20px]

View file

@ -2,8 +2,7 @@ Harness status: OK
Found 30 tests
29 Pass
1 Fail
30 Pass
Pass e.style['border-image'] = "none" should set the property value
Pass e.style['border-image'] = "stretch" should set the property value
Pass e.style['border-image'] = "none 100% / 1 / 0 stretch" should set the property value
@ -13,7 +12,7 @@ Pass e.style['border-image'] = "url(\"http://www.example.com/\")" should set the
Pass e.style['border-image'] = "repeat round" should set the property value
Pass e.style['border-image'] = "none repeat round" should set the property value
Pass e.style['border-image'] = "space" should set the property value
Fail e.style['border-image'] = "none space space" should set the property value
Pass e.style['border-image'] = "none space space" should set the property value
Pass e.style['border-image'] = "none 100% / 1 / 0 space" should set the property value
Pass e.style['border-image'] = "1" should set the property value
Pass e.style['border-image'] = "none 1 1 1 1" should set the property value