LibWeb: Ensure shortest serialization is used for grid-column values

This commit is contained in:
Tim Ledbetter 2025-03-18 15:08:05 +00:00 committed by Alexander Kalenik
commit f0917ea150
Notes: github-actions[bot] 2025-03-19 01:08:57 +00:00
3 changed files with 10 additions and 10 deletions

View file

@ -330,7 +330,7 @@ String ShorthandStyleValue::to_string(SerializationMode mode) const
case PropertyID::GridColumn: { case PropertyID::GridColumn: {
auto start = longhand(PropertyID::GridColumnStart); auto start = longhand(PropertyID::GridColumnStart);
auto end = longhand(PropertyID::GridColumnEnd); auto end = longhand(PropertyID::GridColumnEnd);
if (end->as_grid_track_placement().grid_track_placement().is_auto()) if (end->as_grid_track_placement().grid_track_placement().is_auto() || start == end)
return start->to_string(mode); return start->to_string(mode);
return MUST(String::formatted("{} / {}", start->to_string(mode), end->to_string(mode))); return MUST(String::formatted("{} / {}", start->to_string(mode), end->to_string(mode)));
} }

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 57 tests Found 57 tests
18 Pass 19 Pass
39 Fail 38 Fail
Fail e.style['grid-area'] = "auto" should set the property value Fail e.style['grid-area'] = "auto" should set the property value
Fail e.style['grid-area'] = "auto / auto" should set the property value Fail e.style['grid-area'] = "auto / auto" should set the property value
Fail e.style['grid-area'] = "auto / auto / auto" should set the property value Fail e.style['grid-area'] = "auto / auto / auto" should set the property value
@ -23,7 +23,7 @@ Fail e.style['grid-area'] = "1" should set the property value
Fail e.style['grid-area'] = "+90 -a-" should set the property value Fail e.style['grid-area'] = "+90 -a-" should set the property value
Pass e.style['grid-row'] = "az 2" should set the property value Pass e.style['grid-row'] = "az 2" should set the property value
Pass e.style['grid-column'] = "9" should set the property value Pass e.style['grid-column'] = "9" should set the property value
Fail e.style['grid-column'] = "-19 zA" should set the property value Pass e.style['grid-column'] = "-19 zA" should set the property value
Fail e.style['grid-column'] = "-A0 33" should set the property value Fail e.style['grid-column'] = "-A0 33" should set the property value
Pass e.style['grid-row-start'] = "-19" should set the property value Pass e.style['grid-row-start'] = "-19" should set the property value
Fail e.style['grid-row-start'] = "9 -Z_" should set the property value Fail e.style['grid-row-start'] = "9 -Z_" should set the property value

View file

@ -2,20 +2,20 @@ Harness status: OK
Found 16 tests Found 16 tests
8 Pass 12 Pass
8 Fail 4 Fail
Pass Property grid-column value 'auto / auto' Pass Property grid-column value 'auto / auto'
Pass Property grid-column value 'auto' Pass Property grid-column value 'auto'
Pass Property grid-column value '10 / auto' Pass Property grid-column value '10 / auto'
Pass Property grid-column value '10' Pass Property grid-column value '10'
Pass Property grid-column value '-10 / auto' Pass Property grid-column value '-10 / auto'
Pass Property grid-column value '-10' Pass Property grid-column value '-10'
Fail Property grid-column value 'first / first' Pass Property grid-column value 'first / first'
Fail Property grid-column value 'first' Pass Property grid-column value 'first'
Pass Property grid-column value 'span 2 / auto' Pass Property grid-column value 'span 2 / auto'
Pass Property grid-column value 'span 2' Pass Property grid-column value 'span 2'
Fail Property grid-column value '2 first / auto' Pass Property grid-column value '2 first / auto'
Fail Property grid-column value '2 first' Pass Property grid-column value '2 first'
Fail Property grid-column value 'span first / auto' Fail Property grid-column value 'span first / auto'
Fail Property grid-column value 'span first' Fail Property grid-column value 'span first'
Fail Property grid-column value 'span 2 first / auto' Fail Property grid-column value 'span 2 first / auto'