mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
LibWeb: Improve grid-template-area parsing and serialization
This commit is contained in:
parent
e1f4e8e6c2
commit
0afd7f166a
Notes:
github-actions[bot]
2024-12-02 16:20:49 +00:00
Author: https://github.com/Gingeh
Commit: 0afd7f166a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2263
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/shannonbooth
13 changed files with 274 additions and 62 deletions
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
#include "GridTemplateAreaStyleValue.h"
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -23,13 +24,15 @@ String GridTemplateAreaStyleValue::to_string() const
|
|||
|
||||
StringBuilder builder;
|
||||
for (size_t y = 0; y < m_grid_template_area.size(); ++y) {
|
||||
if (y != 0)
|
||||
builder.append(' ');
|
||||
StringBuilder row_builder;
|
||||
for (size_t x = 0; x < m_grid_template_area[y].size(); ++x) {
|
||||
builder.appendff("{}", m_grid_template_area[y][x]);
|
||||
if (x < m_grid_template_area[y].size() - 1)
|
||||
builder.append(" "sv);
|
||||
if (x != 0)
|
||||
row_builder.append(' ');
|
||||
row_builder.appendff("{}", m_grid_template_area[y][x]);
|
||||
}
|
||||
if (y < m_grid_template_area.size() - 1)
|
||||
builder.append(", "sv);
|
||||
serialize_a_string(builder, row_builder.string_view());
|
||||
}
|
||||
return MUST(builder.to_string());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue