LibWeb: Escape custom-ident when serializing grid track placement values

This commit is contained in:
Tim Ledbetter 2025-09-24 22:47:16 +01:00 committed by Sam Atkins
parent d42235a642
commit 585e96d61d
3 changed files with 11 additions and 11 deletions

View File

@ -19,11 +19,11 @@ String GridTrackPlacement::to_string(SerializationMode mode) const
},
[&](AreaOrLine const& area_or_line) {
if (area_or_line.line_number.has_value() && area_or_line.name.has_value()) {
builder.appendff("{} {}", area_or_line.line_number->to_string(mode), *area_or_line.name);
builder.appendff("{} {}", area_or_line.line_number->to_string(mode), serialize_an_identifier(*area_or_line.name));
} else if (area_or_line.line_number.has_value()) {
builder.appendff("{}", area_or_line.line_number->to_string(mode));
} else if (area_or_line.name.has_value()) {
builder.appendff("{}", *area_or_line.name);
builder.appendff("{}", serialize_an_identifier(*area_or_line.name));
}
},
[&](Span const& span) {

View File

@ -2,8 +2,8 @@ Harness status: OK
Found 33 tests
29 Pass
4 Fail
31 Pass
2 Fail
Pass Property grid-area value 'auto / auto / auto / auto'
Pass Property grid-row value 'auto / auto'
Pass Property grid-column-end value 'auto'
@ -35,5 +35,5 @@ Pass Property grid-area value 'auto / i / 2 j'
Pass Property grid-area value 'auto / i / 2 j / span 3 k'
Pass Property grid-row value 'auto / i'
Pass Property grid-column value '2 j / span 3 k'
Fail Property grid-column-end value '\31st'
Fail Property grid-column-end value '\31 st'
Pass Property grid-column-end value '\31st'
Pass Property grid-column-end value '\31 st'

View File

@ -2,8 +2,8 @@ Harness status: OK
Found 57 tests
53 Pass
4 Fail
56 Pass
1 Fail
Pass e.style['grid-area'] = "auto" should set the property value
Pass e.style['grid-area'] = "auto / auto" should set the property value
Pass e.style['grid-area'] = "auto / auto / auto" should set the property value
@ -58,6 +58,6 @@ Fail e.style['grid-row'] = "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
Pass 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
Fail e.style['grid-column-end'] = "\\31 st" should set the property value
Fail e.style['grid-column'] = "\\31st / \\31 st" should set the property value
Pass e.style['grid-column-end'] = "\\31st" should set the property value
Pass e.style['grid-column-end'] = "\\31 st" should set the property value
Pass e.style['grid-column'] = "\\31st / \\31 st" should set the property value