/* * Copyright (c) 2026, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Web::CSS { // Chain of custom property maps with structural sharing. // Each node stores only the properties declared directly on its element, // with a parent pointer to the inherited chain. class WEB_API CustomPropertyData : public RefCounted { public: static NonnullRefPtr create( OrderedHashMap own_values, RefPtr parent); StyleProperty const* get(FlyString const& name) const; OrderedHashMap const& own_values() const { return m_own_values; } void for_each_property(Function callback) const; RefPtr parent() const { return m_parent; } bool is_empty() const; private: CustomPropertyData(OrderedHashMap own_values, RefPtr parent, u8 ancestor_count); OrderedHashMap m_own_values; RefPtr m_parent; u8 m_ancestor_count { 0 }; }; }