ladybird/Libraries/LibWeb/CSS/StyleValues/TextUnderlinePositionStyleValue.h
Callum Law b0e3af7d10 LibWeb: Parse text-underline-position property
This introduces the `TextUnderlinePositionStyleValue` class, it is
possible to represent `text-underline-position` as a `StyleValueList`
but would have required ugly workarounds for either serialization or in
`ComputedProperties::text_underline_position`
2025-09-15 15:24:20 +01:00

41 lines
1.4 KiB
C++

/*
* Copyright (c) 2025, 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 TextUnderlinePositionStyleValue : public StyleValueWithDefaultOperators<TextUnderlinePositionStyleValue> {
public:
static ValueComparingNonnullRefPtr<TextUnderlinePositionStyleValue const> create(TextUnderlinePositionHorizontal horizontal, TextUnderlinePositionVertical vertical)
{
return adopt_ref(*new (nothrow) TextUnderlinePositionStyleValue(horizontal, vertical));
}
virtual ~TextUnderlinePositionStyleValue() override = default;
TextUnderlinePositionHorizontal horizontal() const { return m_horizontal; }
TextUnderlinePositionVertical vertical() const { return m_vertical; }
virtual String to_string(SerializationMode serialization_mode) const override;
bool properties_equal(TextUnderlinePositionStyleValue const& other) const { return m_horizontal == other.m_horizontal && m_vertical == other.m_vertical; }
private:
explicit TextUnderlinePositionStyleValue(TextUnderlinePositionHorizontal horizontal, TextUnderlinePositionVertical vertical)
: StyleValueWithDefaultOperators(Type::TextUnderlinePosition)
, m_horizontal(horizontal)
, m_vertical(vertical)
{
}
TextUnderlinePositionHorizontal m_horizontal;
TextUnderlinePositionVertical m_vertical;
};
}