CSSFontFaceRule.h 993 B

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