LibWeb: Stop tracing CSS style values

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.
This commit is contained in:
Andreas Kling 2026-06-07 17:43:37 +02:00 committed by Andreas Kling
parent 9c040f1dd3
commit 0b94af1109
7 changed files with 0 additions and 61 deletions

View file

@ -256,14 +256,6 @@ WebIDL::ExceptionOr<void> CSSDescriptors::set_css_text(StringView value)
return {};
}
void CSSDescriptors::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
for (auto& descriptor : m_descriptors) {
descriptor.value->visit_edges(visitor);
}
}
RefPtr<StyleValue const> CSSDescriptors::descriptor(DescriptorNameAndID const& descriptor_name_and_id) const
{
auto match = m_descriptors.first_matching([descriptor_name_and_id](Descriptor const& descriptor) {

View file

@ -39,8 +39,6 @@ protected:
private:
bool set_a_css_declaration(DescriptorNameAndID const&, NonnullRefPtr<StyleValue const>, Important);
virtual void visit_edges(Visitor&) override;
AtRuleID m_at_rule_id;
Vector<Descriptor> m_descriptors;
};

View file

@ -120,14 +120,6 @@ void CSSStyleProperties::initialize(JS::Realm& realm)
Base::initialize(realm);
}
void CSSStyleProperties::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
for (auto& property : m_properties) {
property.value->visit_edges(visitor);
}
}
size_t CSSStyleProperties::external_memory_size() const
{
auto size = Base::external_memory_size();

View file

@ -74,7 +74,6 @@ private:
CSSStyleProperties(JS::Realm&, Computed, Readonly, Vector<StyleProperty> properties, OrderedHashMap<FlyString, StyleProperty> custom_properties, Optional<DOM::AbstractElement>);
static Vector<StyleProperty> convert_declarations_to_specified_order(Vector<StyleProperty>&);
virtual void visit_edges(Cell::Visitor&) override;
virtual size_t external_memory_size() const override;
RefPtr<StyleValue const> style_value_for_computed_property(Layout::NodeWithStyle const&, PropertyID) const;

View file

@ -487,15 +487,6 @@ struct ContentData {
Vector<Variant<String, NonnullRefPtr<ImageStyleValue>>> data;
Vector<ValueComparingRefPtr<CounterStyle const>> counter_style_dependencies;
Optional<String> alt_text {};
void visit_edges(GC::Cell::Visitor& visitor) const
{
for (auto const& item : data) {
if (auto* ptr = item.get_pointer<NonnullRefPtr<ImageStyleValue>>()) {
(*ptr)->visit_edges(visitor);
}
}
}
};
struct CounterData {
@ -546,11 +537,6 @@ public:
ComputedValues() = default;
~ComputedValues() = default;
void visit_edges(GC::Cell::Visitor& visitor)
{
m_noninherited.visit_edges(visitor);
}
AspectRatio aspect_ratio() const { return m_noninherited.aspect_ratio; }
Float float_() const { return m_noninherited.float_; }
Length border_spacing_horizontal() const { return m_inherited.border_spacing_horizontal; }
@ -977,26 +963,6 @@ protected:
Vector<CounterData, 0> counter_set;
WillChange will_change { InitialValues::will_change() };
Resize resize { InitialValues::resize() };
void visit_edges(GC::Cell::Visitor& visitor)
{
for (auto& layer : background_layers)
layer.background_image->visit_edges(visitor);
for (auto& layer : mask_layers)
layer.background_image->visit_edges(visitor);
if (mask_image)
mask_image->visit_edges(visitor);
for (auto const& transform : transformations)
transform->visit_edges(visitor);
if (rotate)
rotate->visit_edges(visitor);
if (translate)
translate->visit_edges(visitor);
if (scale)
scale->visit_edges(visitor);
if (content.has_value())
content->visit_edges(visitor);
}
};
NonInheritedValues m_noninherited;

View file

@ -173,7 +173,6 @@ public:
virtual StyleValueVector subdivide_into_iterations(PropertyNameAndID const&) const;
virtual void set_style_sheet(GC::Ptr<CSSStyleSheet>) { }
virtual void visit_edges(JS::Cell::Visitor&) const { }
virtual bool equals(StyleValue const& other) const = 0;

View file

@ -700,13 +700,6 @@ void NodeWithStyle::rebuild_image_observers()
void NodeWithStyle::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
for (auto const& layer : computed_values().background_layers())
layer.background_image->visit_edges(visitor);
if (m_list_style_image)
m_list_style_image->visit_edges(visitor);
m_computed_values->visit_edges(visitor);
}
void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)