LibWeb/CSS: Serialize empty grid-template-* values correctly

Previously we would serialize these as the empty string. eg, this:

```
<div style="grid-auto-columns: auto"></div>
```

would have a computed `grid-auto-columns` value of ``.
This commit is contained in:
Sam Atkins 2024-10-14 14:32:27 +01:00 committed by Andreas Kling
commit 7c2680b7ef
Notes: github-actions[bot] 2024-10-16 06:35:06 +00:00
3 changed files with 10 additions and 4 deletions

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
@ -18,6 +18,9 @@ ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue> GridTemplateAreaStyleVal
String GridTemplateAreaStyleValue::to_string() const
{
if (m_grid_template_area.is_empty())
return "none"_string;
StringBuilder builder;
for (size_t y = 0; y < m_grid_template_area.size(); ++y) {
for (size_t x = 0; x < m_grid_template_area[y].size(); ++x) {