ladybird/Libraries/LibWeb/CSS/StyleValues/CounterStyleStyleValue.cpp
Callum Law 858989e006 LibWeb: Make CounterStyle ref counted
Previously we just passed around a reference to the `CounterStyle`
stored on `Document::registered_counter_styles` but this won't be
possible for anonymous counter styles (i.e. those created by the
`<symbols()>` function)
2026-02-27 16:25:53 +00:00

24 lines
672 B
C++

/*
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "CounterStyleStyleValue.h"
#include <LibWeb/CSS/CounterStyle.h>
#include <LibWeb/CSS/Enums.h>
namespace Web::CSS {
void CounterStyleStyleValue::serialize(StringBuilder& builder, SerializationMode) const
{
builder.append(m_name);
}
RefPtr<CounterStyle const> CounterStyleStyleValue::resolve_counter_style(HashMap<FlyString, NonnullRefPtr<CounterStyle const>> const& registered_counter_styles) const
{
// FIXME: Support symbols() function for anonymous counter style
return registered_counter_styles.get(m_name).value_or(nullptr);
}
}