CSSFontFaceRule.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/CSS/CSSRule.h>
  8. #include <LibWeb/CSS/FontFace.h>
  9. namespace Web::CSS {
  10. class CSSFontFaceRule final : public CSSRule {
  11. AK_MAKE_NONCOPYABLE(CSSFontFaceRule);
  12. AK_MAKE_NONMOVABLE(CSSFontFaceRule);
  13. public:
  14. using WrapperType = Bindings::CSSFontFaceRuleWrapper;
  15. static NonnullRefPtr<CSSFontFaceRule> create(FontFace&& font_face)
  16. {
  17. return adopt_ref(*new CSSFontFaceRule(move(font_face)));
  18. }
  19. virtual ~CSSFontFaceRule() override = default;
  20. virtual StringView class_name() const override { return "CSSFontFaceRule"; }
  21. virtual Type type() const override { return Type::FontFace; }
  22. FontFace const& font_face() const { return m_font_face; }
  23. CSSStyleDeclaration* style();
  24. private:
  25. explicit CSSFontFaceRule(FontFace&&);
  26. virtual String serialized() const override;
  27. FontFace m_font_face;
  28. };
  29. template<>
  30. inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }
  31. }