| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2023, Ali Mohammad Pur <mpfard@serenityos.org> | 
					
						
							| 
									
										
										
										
											2024-06-14 17:04:56 +02:00
										 |  |  |  * Copyright (c) 2024, Andreas Kling <andreas@ladybird.org> | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/FlyString.h>
 | 
					
						
							|  |  |  | #include <AK/NonnullRefPtr.h>
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | #include <LibGC/Ptr.h>
 | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | #include <LibWeb/CSS/CSSKeyframeRule.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/CSSRule.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							|  |  |  | #include <LibWeb/WebIDL/ExceptionOr.h>
 | 
					
						
							| 
									
										
										
										
											2024-06-14 17:04:56 +02:00
										 |  |  | #include <LibWeb/WebIDL/Types.h>
 | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://drafts.csswg.org/css-animations/#interface-csskeyframesrule
 | 
					
						
							|  |  |  | class CSSKeyframesRule final : public CSSRule { | 
					
						
							|  |  |  |     WEB_PLATFORM_OBJECT(CSSKeyframesRule, CSSRule); | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC_DECLARE_ALLOCATOR(CSSKeyframesRule); | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     [[nodiscard]] static GC::Ref<CSSKeyframesRule> create(JS::Realm&, FlyString name, GC::Ref<CSSRuleList>); | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual ~CSSKeyframesRule() = default; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-14 17:04:56 +02:00
										 |  |  |     auto const& css_rules() const { return m_rules; } | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  |     FlyString const& name() const { return m_name; } | 
					
						
							| 
									
										
										
										
											2024-06-14 17:04:56 +02:00
										 |  |  |     [[nodiscard]] WebIDL::UnsignedLong length() const; | 
					
						
							| 
									
										
										
										
											2023-06-20 16:30:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-27 19:01:28 +12:00
										 |  |  |     void set_name(String const& name) { m_name = name; } | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     CSSKeyframesRule(JS::Realm&, FlyString name, GC::Ref<CSSRuleList> keyframes); | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  |     virtual void visit_edges(Visitor&) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2023-11-20 23:16:39 +13:00
										 |  |  |     virtual String serialized() const override; | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | 
 | 
					
						
							|  |  |  |     FlyString m_name; | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC::Ref<CSSRuleList> m_rules; | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							|  |  |  | inline bool CSSRule::fast_is<CSSKeyframesRule>() const { return type() == CSSRule::Type::Keyframes; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |