mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
Having the dumping code in a separate Dump.cpp meant that it was often overlooked when the rules gained new features, and also limits dumping to publicly-accessible information.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2022-2025, Sam Atkins <sam@ladybird.org>
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/CSS/CSSFontFaceDescriptors.h>
|
|
#include <LibWeb/CSS/CSSRule.h>
|
|
#include <LibWeb/CSS/ParsedFontFace.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
class CSSFontFaceRule final : public CSSRule {
|
|
WEB_PLATFORM_OBJECT(CSSFontFaceRule, CSSRule);
|
|
GC_DECLARE_ALLOCATOR(CSSFontFaceRule);
|
|
|
|
public:
|
|
[[nodiscard]] static GC::Ref<CSSFontFaceRule> create(JS::Realm&, GC::Ref<CSSFontFaceDescriptors>);
|
|
|
|
virtual ~CSSFontFaceRule() override = default;
|
|
|
|
bool is_valid() const;
|
|
ParsedFontFace font_face() const;
|
|
GC::Ref<CSSStyleDeclaration> style() { return m_style; }
|
|
GC::Ref<CSSFontFaceDescriptors const> descriptors() const { return m_style; }
|
|
|
|
private:
|
|
CSSFontFaceRule(JS::Realm&, GC::Ref<CSSFontFaceDescriptors>);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual String serialized() const override;
|
|
virtual void visit_edges(Visitor&) override;
|
|
virtual void dump(StringBuilder&, int indent_levels) const override;
|
|
|
|
GC::Ref<CSSFontFaceDescriptors> m_style;
|
|
};
|
|
|
|
template<>
|
|
inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }
|
|
|
|
}
|