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 {
|
|
|
|
|
2023-08-13 13:05:26 +02:00
|
|
|
JS::NonnullGCPtr<CSSKeyframeRule> CSSKeyframeRule::create(JS::Realm& realm, CSS::Percentage key, Web::CSS::CSSStyleDeclaration& declarations)
|
2023-07-09 11:40:17 +03:30
|
|
|
{
|
2023-08-13 13:05:26 +02:00
|
|
|
return realm.heap().allocate<CSSKeyframeRule>(realm, realm, key, declarations);
|
2023-07-09 11:40:17 +03:30
|
|
|
}
|
|
|
|
|
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);
|
2023-06-25 14:06:11 -06:00
|
|
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSKeyframeRulePrototype>(realm, "CSSKeyframeRule"));
|
2023-05-26 23:30:54 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
DeprecatedString CSSKeyframeRule::serialized() const
|
|
|
|
{
|
|
|
|
StringBuilder builder;
|
|
|
|
builder.appendff("{}% {{ {} }}", key().value(), style()->serialized());
|
|
|
|
return builder.to_deprecated_string();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|