LibWeb: Merge consecutive grid lines in GridTrackSizeList

Fixes a bug where consecutively defined grid lines were not merged
during serialization.
This commit is contained in:
Aliaksandr Kalenik 2025-06-22 20:41:51 +02:00 committed by Alexander Kalenik
commit 6ec6e755b2
Notes: github-actions[bot] 2025-06-22 19:16:36 +00:00
3 changed files with 10 additions and 6 deletions

View file

@ -209,6 +209,11 @@ bool GridTrackSizeList::operator==(GridTrackSizeList const& other) const = defau
void GridTrackSizeList::append(GridLineNames&& line_names)
{
if (!m_list.is_empty() && m_list.last().has<GridLineNames>()) {
auto& last_line_names = m_list.last().get<GridLineNames>();
last_line_names.names.extend(move(line_names.names));
return;
}
m_list.append(move(line_names));
}

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 63 tests
34 Pass
29 Fail
35 Pass
28 Fail
Fail e.style['grid'] = "none" should set grid-auto-columns
Fail e.style['grid'] = "none" should set grid-auto-flow
Fail e.style['grid'] = "none" should set grid-auto-rows
@ -37,7 +37,7 @@ Fail e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \
Fail e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-auto-rows
Pass e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-areas
Pass e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-columns
Fail e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-rows
Pass e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-rows
Pass e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should not set unrelated longhands
Fail e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-columns
Fail e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-flow

View file

@ -2,8 +2,7 @@ Harness status: OK
Found 24 tests
23 Pass
1 Fail
24 Pass
Pass e.style['grid-template'] = "none" should set grid-template-areas
Pass e.style['grid-template'] = "none" should set grid-template-columns
Pass e.style['grid-template'] = "none" should set grid-template-rows
@ -18,7 +17,7 @@ Pass e.style['grid-template'] = "fit-content(calc(-0.5em + 10px)) / fit-content(
Pass e.style['grid-template'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should not set unrelated longhands
Pass e.style['grid-template'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-areas
Pass e.style['grid-template'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-columns
Fail e.style['grid-template'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-rows
Pass e.style['grid-template'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-rows
Pass e.style['grid-template'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should not set unrelated longhands
Pass e.style['grid-template'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-template-areas
Pass e.style['grid-template'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-template-columns