| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2023, Ali Mohammad Pur <mpfard@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "CSSKeyframeRule.h"
 | 
					
						
							| 
									
										
										
										
											2023-06-25 14:06:11 -06:00
										 |  |  | #include <LibWeb/Bindings/CSSKeyframeRulePrototype.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Bindings/Intrinsics.h>
 | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | #include <LibWeb/CSS/CSSRuleList.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | GC_DEFINE_ALLOCATOR(CSSKeyframeRule); | 
					
						
							| 
									
										
										
										
											2023-11-19 19:47:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | GC::Ref<CSSKeyframeRule> CSSKeyframeRule::create(JS::Realm& realm, CSS::Percentage key, Web::CSS::PropertyOwningCSSStyleDeclaration& declarations) | 
					
						
							| 
									
										
										
										
											2023-07-09 11:40:17 +03:30
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2024-11-14 05:50:17 +13:00
										 |  |  |     return realm.create<CSSKeyframeRule>(realm, key, declarations); | 
					
						
							| 
									
										
										
										
											2023-07-09 11:40:17 +03:30
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-14 16:38:23 +02:00
										 |  |  | CSSKeyframeRule::CSSKeyframeRule(JS::Realm& realm, CSS::Percentage key, PropertyOwningCSSStyleDeclaration& declarations) | 
					
						
							| 
									
										
										
										
											2024-10-28 20:16:28 +01:00
										 |  |  |     : CSSRule(realm, Type::Keyframe) | 
					
						
							| 
									
										
										
										
											2024-06-14 16:38:23 +02:00
										 |  |  |     , m_key(key) | 
					
						
							|  |  |  |     , m_declarations(declarations) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_declarations->set_parent_rule(*this); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | void CSSKeyframeRule::visit_edges(Visitor& visitor) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Base::visit_edges(visitor); | 
					
						
							|  |  |  |     visitor.visit(m_declarations); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  | void CSSKeyframeRule::initialize(JS::Realm& realm) | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     Base::initialize(realm); | 
					
						
							| 
									
										
										
										
											2024-03-16 13:13:08 +01:00
										 |  |  |     WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSKeyframeRule); | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-20 23:16:39 +13:00
										 |  |  | String CSSKeyframeRule::serialized() const | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | { | 
					
						
							|  |  |  |     StringBuilder builder; | 
					
						
							|  |  |  |     builder.appendff("{}% {{ {} }}", key().value(), style()->serialized()); | 
					
						
							| 
									
										
										
										
											2023-11-20 23:16:39 +13:00
										 |  |  |     return MUST(builder.to_string()); | 
					
						
							| 
									
										
										
										
											2023-05-26 23:30:54 +03:30
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |