LibWeb: Remove usage of layout_node() in dom_node_for_event_dispatch

No need to go through layout node when paintable has a direct pointer to
the DOM node.
This commit is contained in:
Aliaksandr Kalenik 2025-10-10 03:48:15 +02:00 committed by Jelle Raaijmakers
parent b786935169
commit 83fb690bce
Notes: github-actions[bot] 2025-10-10 07:04:46 +00:00

View file

@ -51,11 +51,11 @@ static GC::Ptr<DOM::Node> dom_node_for_event_dispatch(Painting::Paintable& paint
{
if (auto node = paintable.dom_node())
return node;
auto* layout_parent = paintable.layout_node().parent();
while (layout_parent) {
if (auto* node = layout_parent->dom_node())
auto* parent = paintable.parent();
while (parent) {
if (auto node = parent->dom_node())
return node;
layout_parent = layout_parent->parent();
parent = parent->parent();
}
return nullptr;
}