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

This commit is contained in:
Tim Ledbetter 2025-03-18 15:03:35 +00:00 committed by Alexander Kalenik
parent 83143e3018
commit 6811264b11
Notes: github-actions[bot] 2025-03-19 01:09:02 +00:00
4 changed files with 14 additions and 14 deletions

View file

@ -337,7 +337,7 @@ String ShorthandStyleValue::to_string(SerializationMode mode) const
case PropertyID::GridRow: {
auto start = longhand(PropertyID::GridRowStart);
auto end = longhand(PropertyID::GridRowEnd);
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 MUST(String::formatted("{} / {}", start->to_string(mode), end->to_string(mode)));
}

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 30 tests
12 Pass
18 Fail
13 Pass
17 Fail
Fail Property grid-area value 'auto / auto / auto / auto'
Pass Property grid-row value 'auto / auto'
Pass Property grid-column-end value 'auto'
@ -12,7 +12,7 @@ Pass Property grid-row-start value 'AZ'
Fail Property grid-column-start value '-_π'
Pass Property grid-row-end value '_9'
Fail Property grid-area value '1 / 90 -a- / auto / auto'
Fail Property grid-row value '2 az / auto'
Pass Property grid-row value '2 az / auto'
Pass Property grid-column value '9 / -19 zA'
Pass Property grid-row-start value '-19'
Fail Property grid-row-start value '9 -Z_'

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 57 tests
15 Pass
42 Fail
18 Pass
39 Fail
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 / auto" should set the property value
@ -15,13 +15,13 @@ Pass e.style['grid-column-end'] = "AuTo" should set the property value
Fail e.style['grid-area'] = "--a" should set the property value
Fail e.style['grid-row'] = "-zπ" should set the property value
Fail e.style['grid-row'] = "-zπ/-zπ" should set the property value
Fail e.style['grid-row'] = "i / i" should set the property value
Pass e.style['grid-row'] = "i / i" should set the property value
Pass e.style['grid-row-start'] = "AZ" should set the property value
Fail e.style['grid-column-start'] = "-_π" should set the property value
Pass e.style['grid-row-end'] = "_9" should set the property value
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-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
Fail e.style['grid-column'] = "-19 zA" should set the property value
Fail e.style['grid-column'] = "-A0 33" should set the property value
@ -55,7 +55,7 @@ Fail e.style['grid-area'] = "auto / i / 2 j" should set the property value
Fail e.style['grid-area'] = "auto / i / 2 j / span 3 k" should set the property value
Pass e.style['grid-row'] = "auto / i" should set the property value
Fail e.style['grid-row'] = "i / auto" should set the property value
Fail e.style['grid-row'] = "2 i / auto" should set the property value
Pass e.style['grid-row'] = "2 i / auto" should set the property value
Pass e.style['grid-row'] = "1 / auto" should set the property value
Fail e.style['grid-column'] = "2 j / span 3 k" should set the property value
Fail e.style['grid-column-end'] = "\\31st" should set the property value

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 15 tests
8 Pass
7 Fail
11 Pass
4 Fail
Pass Property grid-row value 'auto / auto'
Pass Property grid-row value 'auto'
Pass Property grid-row value '10 / auto'
@ -12,10 +12,10 @@ Pass Property grid-row value '-10 / auto'
Pass Property grid-row value '-10'
Pass Property grid-row value 'span 2 / auto'
Pass Property grid-row value 'span 2'
Fail Property grid-row value '3 last / auto'
Fail Property grid-row value '3 last'
Pass Property grid-row value '3 last / auto'
Pass Property grid-row value '3 last'
Fail Property grid-row value 'span first / auto'
Fail Property grid-row value 'span first'
Fail Property grid-row value 'span 2 first / auto'
Fail Property grid-row value 'span 2 first'
Fail Property grid-row value 'last / last'
Pass Property grid-row value 'last / last'