CSSFontFaceRule.h 921 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 CSSFontFaceRule* create(HTML::Window&, 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. explicit CSSFontFaceRule(HTML::Window&, FontFace&&);
  21. virtual String serialized() const override;
  22. FontFace m_font_face;
  23. };
  24. template<>
  25. inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }
  26. }