CSSFontFaceRule.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/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. virtual Type type() const override { return Type::FontFace; }
  18. ParsedFontFace const& font_face() const { return m_font_face; }
  19. CSSStyleDeclaration* style();
  20. private:
  21. CSSFontFaceRule(JS::Realm&, ParsedFontFace&&);
  22. virtual void initialize(JS::Realm&) override;
  23. virtual String serialized() const override;
  24. ParsedFontFace m_font_face;
  25. };
  26. template<>
  27. inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }
  28. }