ladybird/Libraries/LibWeb/CSS/StyleValues/CounterStyleStyleValue.h
Callum Law 8a82d116d6 LibWeb: Always parse <counter-style> as such
Previously we parsed it as `<custom-ident>` in `<counter>` and as a
keyword in `list-style-type`.

The practical effect of this is:
 - Spec defined counter style names in `<counter>` are ASCII lowercased
   on parse.
 - Non spec defined counter style names are allowed in `list-style-type.

We are still to parse the `symbols()` function but this gives us a
better base for that.
2026-02-12 10:33:09 +00:00

40 lines
1 KiB
C++

/*
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/Enums.h>
#include <LibWeb/CSS/StyleValues/StyleValue.h>
namespace Web::CSS {
class CounterStyleStyleValue : public StyleValueWithDefaultOperators<CounterStyleStyleValue> {
public:
static ValueComparingNonnullRefPtr<CounterStyleStyleValue const> create(FlyString name)
{
return adopt_ref(*new (nothrow) CounterStyleStyleValue(move(name)));
}
virtual ~CounterStyleStyleValue() override = default;
virtual void serialize(StringBuilder&, SerializationMode) const override;
Optional<CounterStyleNameKeyword> to_counter_style_name_keyword() const;
bool properties_equal(CounterStyleStyleValue const& other) const { return m_name == other.m_name; }
private:
explicit CounterStyleStyleValue(FlyString name)
: StyleValueWithDefaultOperators(Type::CounterStyle)
, m_name(move(name))
{
}
FlyString m_name;
};
}