/src/serenity/Userland/Libraries/LibWeb/CSS/StyleValues/MathDepthStyleValue.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/CSS/CSSStyleValue.h> |
10 | | |
11 | | namespace Web::CSS { |
12 | | |
13 | | class MathDepthStyleValue : public StyleValueWithDefaultOperators<MathDepthStyleValue> { |
14 | | public: |
15 | | static ValueComparingNonnullRefPtr<MathDepthStyleValue> create_auto_add(); |
16 | | static ValueComparingNonnullRefPtr<MathDepthStyleValue> create_add(ValueComparingNonnullRefPtr<CSSStyleValue const> integer_value); |
17 | | static ValueComparingNonnullRefPtr<MathDepthStyleValue> create_integer(ValueComparingNonnullRefPtr<CSSStyleValue const> integer_value); |
18 | 0 | virtual ~MathDepthStyleValue() override = default; |
19 | | |
20 | 0 | bool is_auto_add() const { return m_type == MathDepthType::AutoAdd; } |
21 | 0 | bool is_add() const { return m_type == MathDepthType::Add; } |
22 | 0 | bool is_integer() const { return m_type == MathDepthType::Integer; } |
23 | | auto integer_value() const |
24 | 0 | { |
25 | 0 | VERIFY(!m_integer_value.is_null()); |
26 | 0 | return m_integer_value; |
27 | 0 | } |
28 | | virtual String to_string() const override; |
29 | | |
30 | | bool properties_equal(MathDepthStyleValue const& other) const; |
31 | | |
32 | | private: |
33 | | enum class MathDepthType { |
34 | | AutoAdd, |
35 | | Add, |
36 | | Integer, |
37 | | }; |
38 | | |
39 | | MathDepthStyleValue(MathDepthType type, ValueComparingRefPtr<CSSStyleValue const> integer_value = nullptr); |
40 | | |
41 | | MathDepthType m_type; |
42 | | ValueComparingRefPtr<CSSStyleValue const> m_integer_value; |
43 | | }; |
44 | | |
45 | | } |