/src/serenity/Userland/Libraries/LibWeb/CSS/StyleValues/RotationStyleValue.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2024, Steffen T. Larssen <dudedbz@gmail.com> |
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 RotationStyleValue : public StyleValueWithDefaultOperators<RotationStyleValue> { |
14 | | public: |
15 | | static ValueComparingNonnullRefPtr<RotationStyleValue> create(ValueComparingNonnullRefPtr<CSSStyleValue const> angle, ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_x, ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_y, ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_z) |
16 | 0 | { |
17 | 0 | return adopt_ref(*new (nothrow) RotationStyleValue(move(angle), move(rotation_x), move(rotation_y), move(rotation_z))); |
18 | 0 | } |
19 | | |
20 | 0 | virtual ~RotationStyleValue() override = default; |
21 | | |
22 | 0 | ValueComparingNonnullRefPtr<CSSStyleValue const> const& angle() const { return m_properties.angle; } |
23 | 0 | ValueComparingNonnullRefPtr<CSSStyleValue const> const& rotation_x() const { return m_properties.rotation_x; } |
24 | 0 | ValueComparingNonnullRefPtr<CSSStyleValue const> const& rotation_y() const { return m_properties.rotation_y; } |
25 | 0 | ValueComparingNonnullRefPtr<CSSStyleValue const> const& rotation_z() const { return m_properties.rotation_z; } |
26 | | |
27 | | virtual String to_string() const override; |
28 | | |
29 | 0 | bool properties_equal(RotationStyleValue const& other) const { return m_properties == other.m_properties; } |
30 | | |
31 | | private: |
32 | | explicit RotationStyleValue( |
33 | | ValueComparingNonnullRefPtr<CSSStyleValue const> angle, |
34 | | ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_x, |
35 | | ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_y, |
36 | | ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_z) |
37 | 0 | : StyleValueWithDefaultOperators(Type::Rotation) |
38 | 0 | , m_properties { |
39 | 0 | .angle = move(angle), |
40 | 0 | .rotation_x = move(rotation_x), |
41 | 0 | .rotation_y = move(rotation_y), |
42 | 0 | .rotation_z = move(rotation_z) |
43 | 0 | } |
44 | 0 | { |
45 | 0 | } |
46 | | |
47 | | struct Properties { |
48 | | ValueComparingNonnullRefPtr<CSSStyleValue const> angle; |
49 | | ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_x; |
50 | | ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_y; |
51 | | ValueComparingNonnullRefPtr<CSSStyleValue const> rotation_z; |
52 | 0 | bool operator==(Properties const&) const = default; |
53 | | } m_properties; |
54 | | }; |
55 | | |
56 | | } |