mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 10:20:22 +00:00
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.
26 lines
594 B
C++
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);
|
|
}
|
|
|
|
}
|