From 811b8a25c2e508a1a515e1ba275b6f9588a9b876 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 11 Jan 2023 14:36:27 +0100 Subject: [PATCH] LibWeb: Make Paintable visit its cached containing block pointer This was *probably* already safe, but there's no harm in making sure the cached pointer gets marked during GC. --- Userland/Libraries/LibWeb/Painting/Paintable.cpp | 2 ++ Userland/Libraries/LibWeb/Painting/Paintable.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.cpp b/Userland/Libraries/LibWeb/Painting/Paintable.cpp index 61ce2b96c9..59ececf2f8 100644 --- a/Userland/Libraries/LibWeb/Painting/Paintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/Paintable.cpp @@ -14,6 +14,8 @@ void Paintable::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_layout_node); + if (m_containing_block.has_value()) + visitor.visit(m_containing_block.value()); } Paintable::DispatchEventOfSameName Paintable::handle_mousedown(Badge, CSSPixelPoint, unsigned, unsigned) diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.h b/Userland/Libraries/LibWeb/Painting/Paintable.h index 9214208313..026b77d27d 100644 --- a/Userland/Libraries/LibWeb/Painting/Paintable.h +++ b/Userland/Libraries/LibWeb/Painting/Paintable.h @@ -141,7 +141,7 @@ protected: private: JS::NonnullGCPtr m_layout_node; - Optional mutable m_containing_block; + Optional> mutable m_containing_block; }; inline DOM::Node* HitTestResult::dom_node()