| 
									
										
										
										
											2024-02-19 19:01:34 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-06 14:16:51 +02:00
										 |  |  | #include <LibWeb/CSS/CalculatedOr.h>
 | 
					
						
							| 
									
										
										
										
											2024-02-19 19:01:34 -07:00
										 |  |  | #include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/StyleValues/EasingStyleValue.h>
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  | #include <LibWeb/CSS/StyleValues/StyleValue.h>
 | 
					
						
							| 
									
										
										
										
											2024-02-19 19:01:34 -07:00
										 |  |  | #include <LibWeb/CSS/Time.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TransitionStyleValue final : public StyleValueWithDefaultOperators<TransitionStyleValue> { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     struct Transition { | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |         ValueComparingRefPtr<StyleValue const> property_name; | 
					
						
							| 
									
										
										
										
											2024-04-06 14:16:51 +02:00
										 |  |  |         TimeOrCalculated duration { CSS::Time::make_seconds(0.0) }; | 
					
						
							|  |  |  |         TimeOrCalculated delay { CSS::Time::make_seconds(0.0) }; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:18:27 -06:00
										 |  |  |         ValueComparingRefPtr<EasingStyleValue const> easing; | 
					
						
							| 
									
										
										
										
											2025-04-17 19:11:14 +01:00
										 |  |  |         TransitionBehavior transition_behavior { TransitionBehavior::Normal }; | 
					
						
							| 
									
										
										
										
											2024-02-19 19:01:34 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |         bool operator==(Transition const&) const = default; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:18:27 -06:00
										 |  |  |     static ValueComparingNonnullRefPtr<TransitionStyleValue const> create(Vector<Transition> transitions) | 
					
						
							| 
									
										
										
										
											2024-02-19 19:01:34 -07:00
										 |  |  |     { | 
					
						
							|  |  |  |         return adopt_ref(*new (nothrow) TransitionStyleValue(move(transitions))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual ~TransitionStyleValue() override = default; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto const& transitions() const { return m_transitions; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-07 00:59:49 +01:00
										 |  |  |     virtual String to_string(SerializationMode) const override; | 
					
						
							| 
									
										
										
										
											2024-02-19 19:01:34 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool properties_equal(TransitionStyleValue const& other) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     explicit TransitionStyleValue(Vector<Transition> transitions) | 
					
						
							|  |  |  |         : StyleValueWithDefaultOperators(Type::Transition) | 
					
						
							|  |  |  |         , m_transitions(move(transitions)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Vector<Transition> m_transitions; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |