mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 01:52:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Ali Mohammad Pur <mpfard@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include "CSSKeyframesRule.h"
 | |
| #include <LibWeb/Bindings/CSSKeyframesRulePrototype.h>
 | |
| #include <LibWeb/Bindings/Intrinsics.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| JS_DEFINE_ALLOCATOR(CSSKeyframesRule);
 | |
| 
 | |
| JS::NonnullGCPtr<CSSKeyframesRule> CSSKeyframesRule::create(JS::Realm& realm, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes)
 | |
| {
 | |
|     return realm.heap().allocate<CSSKeyframesRule>(realm, realm, move(name), move(keyframes));
 | |
| }
 | |
| 
 | |
| void CSSKeyframesRule::visit_edges(Visitor& visitor)
 | |
| {
 | |
|     Base::visit_edges(visitor);
 | |
|     for (auto& keyframe : m_keyframes)
 | |
|         visitor.visit(keyframe);
 | |
| }
 | |
| 
 | |
| void CSSKeyframesRule::initialize(JS::Realm& realm)
 | |
| {
 | |
|     Base::initialize(realm);
 | |
|     set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSKeyframesRulePrototype>(realm, "CSSKeyframesRule"_fly_string));
 | |
| }
 | |
| 
 | |
| String CSSKeyframesRule::serialized() const
 | |
| {
 | |
|     StringBuilder builder;
 | |
|     builder.appendff("@keyframes \"{}\"", name());
 | |
|     builder.append(" { "sv);
 | |
|     for (auto const& keyframe : keyframes()) {
 | |
|         builder.append(keyframe->css_text());
 | |
|         builder.append(' ');
 | |
|     }
 | |
|     builder.append('}');
 | |
|     return MUST(builder.to_string());
 | |
| }
 | |
| 
 | |
| }
 | 
