Skip to content

Truly independent web browser

1006 B
Raw Blame
/*
 * Copyright (c) 2022-2025, Sam Atkins <[email protected]>
 * Copyright (c) 2022, Andreas Kling <[email protected]>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/Bindings/CSSFontFaceRule.h>
#include <LibWeb/CSS/CSSDescriptors.h>
#include <LibWeb/CSS/CSSRule.h>

namespace Web::CSS {

class FontFaceState;

class CSSFontFaceRule final : public CSSRule {
    WEB_RUST_INTERFACE(CSSFontFaceRule, css_font_face_rule)

public:
    bool is_valid() const;
    GC::Ref<CSSDescriptors> descriptors() const;

    RefPtr<FontFaceState> css_connected_font_face() const;
    void handle_descriptor_change(Utf16FlyString const& property);
    void handle_descriptor_block_change(bool src_changed);
    void disconnect_font_face();

private:
    void handle_descriptor_change(bool src_changed, bool affects_font_matching);
    void handle_src_descriptor_change();
};

template<>
inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }

}