ladybird/Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.cpp
Tim Ledbetter a27d269721 LibWeb: Pass StringBuilder around during StyleValue serialization
Previously, some StyleValues created a large number of intermediate
strings during serialization. Passing a StringBUilder into the
serialization function allows us to avoid a large number of these
unnecessary allocations.
2026-01-09 10:00:58 +01:00

26 lines
594 B
C++

/*
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "GridAutoFlowStyleValue.h"
namespace Web::CSS {
ValueComparingNonnullRefPtr<GridAutoFlowStyleValue const> GridAutoFlowStyleValue::create(Axis axis, Dense dense)
{
return adopt_ref(*new GridAutoFlowStyleValue(axis, dense));
}
void GridAutoFlowStyleValue::serialize(StringBuilder& builder, SerializationMode) const
{
if (m_row)
builder.append("row"sv);
else
builder.append("column"sv);
if (m_dense)
builder.append(" dense"sv);
}
}