mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-06-28 04:00:33 +00:00
Remove the visit_edges hook from CSS::StyleValue and stop asking CSS properties, descriptors, computed values, and layout nodes to trace through their style values. Style values are refcounted data objects, so they should not be part of the GC graph. Keeping this cleanup separate makes the later layout tree ownership change smaller and easier to review.
49 lines
1.8 KiB
C++
49 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
|
#include <LibWeb/CSS/Descriptor.h>
|
|
#include <LibWeb/CSS/DescriptorID.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
// A non-spec base class for descriptor-list classes
|
|
class CSSDescriptors : public CSSStyleDeclaration {
|
|
WEB_NON_IDL_PLATFORM_OBJECT(CSSDescriptors, CSSStyleDeclaration);
|
|
|
|
public:
|
|
virtual ~CSSDescriptors() override;
|
|
|
|
virtual size_t length() const override;
|
|
virtual String item(size_t index) const override;
|
|
virtual WebIDL::ExceptionOr<void> set_property(FlyString const& property, StringView value, StringView priority) override;
|
|
virtual WebIDL::ExceptionOr<String> remove_property(FlyString const& property) override;
|
|
virtual String get_property_value(FlyString const& property) const override;
|
|
virtual StringView get_property_priority(FlyString const& property) const override;
|
|
|
|
Vector<Descriptor> const& descriptors() const { return m_descriptors; }
|
|
RefPtr<StyleValue const> descriptor(DescriptorNameAndID const&) const;
|
|
RefPtr<StyleValue const> descriptor_or_initial_value(DescriptorNameAndID const&) const;
|
|
virtual String serialized() const override;
|
|
|
|
virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override;
|
|
|
|
protected:
|
|
CSSDescriptors(JS::Realm&, AtRuleID, Vector<Descriptor>);
|
|
|
|
private:
|
|
bool set_a_css_declaration(DescriptorNameAndID const&, NonnullRefPtr<StyleValue const>, Important);
|
|
|
|
AtRuleID m_at_rule_id;
|
|
Vector<Descriptor> m_descriptors;
|
|
};
|
|
|
|
bool is_shorthand(AtRuleID, DescriptorNameAndID const&);
|
|
void for_each_expanded_longhand(AtRuleID, DescriptorNameAndID const&, RefPtr<StyleValue const>, Function<void(DescriptorNameAndID const&, RefPtr<StyleValue const>)>);
|
|
|
|
}
|