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.
32 lines
840 B
C++
32 lines
840 B
C++
/*
|
|
* Copyright (c) 2025, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include "BorderImageSliceStyleValue.h"
|
|
#include <LibWeb/CSS/Serialize.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
void BorderImageSliceStyleValue::serialize(StringBuilder& builder, SerializationMode mode) const
|
|
{
|
|
top()->serialize(builder, mode);
|
|
if (!first_is_equal_to_all_of(top(), right(), bottom(), left())) {
|
|
builder.append(' ');
|
|
right()->serialize(builder, mode);
|
|
if (top() != bottom() || right() != left()) {
|
|
builder.append(' ');
|
|
bottom()->serialize(builder, mode);
|
|
if (left() != right()) {
|
|
builder.append(' ');
|
|
left()->serialize(builder, mode);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (fill())
|
|
builder.append(" fill"sv);
|
|
}
|
|
|
|
}
|