Serenity Operating System
at master 40 lines 1.0 kB view raw
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 8#pragma once 9 10#include <LibWeb/CSS/CSSRule.h> 11#include <LibWeb/CSS/FontFace.h> 12 13namespace Web::CSS { 14 15class CSSFontFaceRule final : public CSSRule { 16 WEB_PLATFORM_OBJECT(CSSFontFaceRule, CSSRule); 17 18public: 19 static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSFontFaceRule>> create(JS::Realm&, FontFace&&); 20 21 virtual ~CSSFontFaceRule() override = default; 22 23 virtual Type type() const override { return Type::FontFace; } 24 25 FontFace const& font_face() const { return m_font_face; } 26 CSSStyleDeclaration* style(); 27 28private: 29 CSSFontFaceRule(JS::Realm&, FontFace&&); 30 31 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 32 virtual DeprecatedString serialized() const override; 33 34 FontFace m_font_face; 35}; 36 37template<> 38inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; } 39 40}