/* * Copyright (c) 2024, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include namespace Web::CSS { class CascadedProperties final : public JS::Cell { GC_CELL(CascadedProperties, JS::Cell); GC_DECLARE_ALLOCATOR(CascadedProperties); public: virtual ~CascadedProperties() override; [[nodiscard]] RefPtr property(PropertyID) const; [[nodiscard]] GC::Ptr property_source(PropertyID) const; [[nodiscard]] bool is_property_important(PropertyID) const; void set_property(PropertyID, NonnullRefPtr, Important, CascadeOrigin, Optional layer_name, GC::Ptr source); void set_property_from_presentational_hint(PropertyID, NonnullRefPtr); void revert_property(PropertyID, Important, CascadeOrigin); void revert_layer_property(PropertyID, Important, Optional layer_name); void resolve_unresolved_properties(GC::Ref, Optional); private: CascadedProperties(); virtual void visit_edges(Visitor&) override; struct Entry { StyleProperty property; CascadeOrigin origin; Optional layer_name; GC::Ptr source; }; HashMap> m_properties; }; }