CSSFontFaceRule.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
  3. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibWeb/CSS/CSSRule.h>
  9. #include <LibWeb/CSS/FontFace.h>
  10. namespace Web::CSS {
  11. class CSSFontFaceRule final : public CSSRule {
  12. WEB_PLATFORM_OBJECT(CSSFontFaceRule, CSSRule);
  13. public:
  14. static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSFontFaceRule>> create(JS::Realm&, FontFace&&);
  15. virtual ~CSSFontFaceRule() override = default;
  16. virtual Type type() const override { return Type::FontFace; }
  17. FontFace const& font_face() const { return m_font_face; }
  18. CSSStyleDeclaration* style();
  19. private:
  20. CSSFontFaceRule(JS::Realm&, FontFace&&);
  21. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  22. virtual DeprecatedString serialized() const override;
  23. FontFace m_font_face;
  24. };
  25. template<>
  26. inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }
  27. }