CSSKeyframeRule.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2023, Ali Mohammad Pur <mpfard@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "CSSKeyframeRule.h"
  7. #include <LibWeb/Bindings/CSSKeyframeRulePrototype.h>
  8. #include <LibWeb/Bindings/Intrinsics.h>
  9. #include <LibWeb/CSS/CSSRuleList.h>
  10. namespace Web::CSS {
  11. JS::NonnullGCPtr<CSSKeyframeRule> CSSKeyframeRule::create(JS::Realm& realm, CSS::Percentage key, Web::CSS::CSSStyleDeclaration& declarations)
  12. {
  13. return realm.heap().allocate<CSSKeyframeRule>(realm, realm, key, declarations);
  14. }
  15. void CSSKeyframeRule::visit_edges(Visitor& visitor)
  16. {
  17. Base::visit_edges(visitor);
  18. visitor.visit(m_declarations);
  19. }
  20. void CSSKeyframeRule::initialize(JS::Realm& realm)
  21. {
  22. Base::initialize(realm);
  23. set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSKeyframeRulePrototype>(realm, "CSSKeyframeRule"));
  24. }
  25. DeprecatedString CSSKeyframeRule::serialized() const
  26. {
  27. StringBuilder builder;
  28. builder.appendff("{}% {{ {} }}", key().value(), style()->serialized());
  29. return builder.to_deprecated_string();
  30. }
  31. }