2026-01-13 21:44:21 +13:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/MapIterator.h>
|
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
|
|
|
#include <LibWeb/CSS/CSSFontFeatureValuesMap.h>
|
|
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
2026-02-20 16:08:47 +13:00
|
|
|
#include <LibWeb/CSS/FontFeatureData.h>
|
2026-01-13 21:44:21 +13:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
|
|
class CSSFontFeatureValuesRule final : public CSSRule {
|
|
|
|
|
WEB_PLATFORM_OBJECT(CSSFontFeatureValuesRule, CSSRule);
|
|
|
|
|
GC_DECLARE_ALLOCATOR(CSSFontFeatureValuesRule);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static GC::Ref<CSSFontFeatureValuesRule> create(JS::Realm&, Vector<FlyString> font_families);
|
|
|
|
|
|
2026-01-14 17:06:59 +13:00
|
|
|
static bool is_font_feature_value_type_at_keyword(FlyString const&);
|
|
|
|
|
|
2026-01-13 21:44:21 +13:00
|
|
|
FlyString font_family() const;
|
|
|
|
|
void set_font_family(FlyString const&);
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> annotation() const { return m_annotation; }
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> ornaments() const { return m_ornaments; }
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> stylistic() const { return m_stylistic; }
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> swash() const { return m_swash; }
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> character_variant() const { return m_character_variant; }
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> styleset() const { return m_styleset; }
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> historical_forms() const { return m_historical_forms; }
|
|
|
|
|
|
2026-02-20 16:08:47 +13:00
|
|
|
Vector<FlyString> const& font_families() const { return m_font_families; }
|
|
|
|
|
HashMap<FontFeatureValueKey, Vector<u32>> to_hash_map() const;
|
|
|
|
|
|
2026-02-20 12:17:07 +13:00
|
|
|
virtual void clear_caches() override;
|
|
|
|
|
|
2026-01-13 21:44:21 +13:00
|
|
|
virtual String serialized() const override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
CSSFontFeatureValuesRule(JS::Realm&, Vector<FlyString> font_families);
|
|
|
|
|
|
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
|
|
|
|
|
Vector<FlyString> m_font_families;
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> m_annotation;
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> m_ornaments;
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> m_stylistic;
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> m_swash;
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> m_character_variant;
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> m_styleset;
|
|
|
|
|
GC::Ref<CSSFontFeatureValuesMap> m_historical_forms;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|