Files
ladybird/Libraries/LibWeb/CSS/StyleValues/FunctionStyleValue.cpp
Callum Law c558d67ba9 LibWeb: Add generic FunctionStyleValue
Currently there are multiple style values which are essentially the same
thing, a function holding a value, just with different names. This
commit adds a generic style value to replace them with and the following
commits will do so.
2026-04-24 07:34:54 +01:00

30 lines
694 B
C++

/*
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "FunctionStyleValue.h"
namespace Web::CSS {
ValueComparingNonnullRefPtr<StyleValue const> FunctionStyleValue::absolutized(ComputationContext const& context) const
{
auto absolutized_value = m_value->absolutized(context);
if (absolutized_value == m_value)
return *this;
return FunctionStyleValue::create(m_name, absolutized_value);
}
void FunctionStyleValue::serialize(StringBuilder& builder, SerializationMode mode) const
{
builder.append(m_name);
builder.append('(');
m_value->serialize(builder, mode);
builder.append(')');
}
}