/src/serenity/Userland/Libraries/LibWeb/CSS/StyleValues/TransitionStyleValue.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>. |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/CSS/CSSStyleValue.h> |
10 | | #include <LibWeb/CSS/CalculatedOr.h> |
11 | | #include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h> |
12 | | #include <LibWeb/CSS/StyleValues/EasingStyleValue.h> |
13 | | #include <LibWeb/CSS/Time.h> |
14 | | |
15 | | namespace Web::CSS { |
16 | | |
17 | | class TransitionStyleValue final : public StyleValueWithDefaultOperators<TransitionStyleValue> { |
18 | | public: |
19 | | struct Transition { |
20 | | ValueComparingRefPtr<CustomIdentStyleValue> property_name; |
21 | | TimeOrCalculated duration { CSS::Time::make_seconds(0.0) }; |
22 | | TimeOrCalculated delay { CSS::Time::make_seconds(0.0) }; |
23 | | ValueComparingRefPtr<EasingStyleValue> easing; |
24 | | |
25 | 0 | bool operator==(Transition const&) const = default; |
26 | | }; |
27 | | |
28 | | static ValueComparingNonnullRefPtr<TransitionStyleValue> create(Vector<Transition> transitions) |
29 | 0 | { |
30 | 0 | return adopt_ref(*new (nothrow) TransitionStyleValue(move(transitions))); |
31 | 0 | } |
32 | | |
33 | 0 | virtual ~TransitionStyleValue() override = default; |
34 | | |
35 | 0 | auto const& transitions() const { return m_transitions; } |
36 | | |
37 | | virtual String to_string() const override; |
38 | | |
39 | | bool properties_equal(TransitionStyleValue const& other) const; |
40 | | |
41 | | private: |
42 | | explicit TransitionStyleValue(Vector<Transition> transitions) |
43 | 0 | : StyleValueWithDefaultOperators(Type::Transition) |
44 | 0 | , m_transitions(move(transitions)) |
45 | 0 | { |
46 | 0 | } |
47 | | |
48 | | Vector<Transition> m_transitions; |
49 | | }; |
50 | | |
51 | | } |