ladybird/Libraries/LibWeb/CSS/StyleValues/TextIndentStyleValue.h
Callum Law ed2909674f LibWeb: Add computationally independent check for custom properties
Registered custom properties only accept "computationally independent"
values for their initial value
2026-03-26 01:11:39 +00:00

45 lines
1.4 KiB
C++

/*
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/StyleValues/StyleValue.h>
namespace Web::CSS {
class TextIndentStyleValue : public StyleValueWithDefaultOperators<TextIndentStyleValue> {
public:
enum class Hanging : u8 {
No,
Yes,
};
enum class EachLine : u8 {
No,
Yes,
};
static ValueComparingNonnullRefPtr<TextIndentStyleValue const> create(NonnullRefPtr<StyleValue const> length_percentage, Hanging hanging, EachLine each_line);
virtual ~TextIndentStyleValue() override;
StyleValue const& length_percentage() const { return m_length_percentage; }
bool hanging() const { return m_hanging; }
bool each_line() const { return m_each_line; }
virtual void serialize(StringBuilder&, SerializationMode) const override;
virtual ValueComparingNonnullRefPtr<StyleValue const> absolutized(ComputationContext const&) const override;
bool properties_equal(TextIndentStyleValue const&) const;
virtual bool is_computationally_independent() const override { return m_length_percentage->is_computationally_independent(); }
private:
TextIndentStyleValue(NonnullRefPtr<StyleValue const> length_percentage, Hanging hanging, EachLine each_line);
ValueComparingNonnullRefPtr<StyleValue const> m_length_percentage;
bool m_hanging;
bool m_each_line;
};
}