diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 4dbcf2349a..90bc55eb7b 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -550,12 +550,13 @@ Optional PaintableWithLines::hit_test(const Gfx::FloatPoint& posi for (auto& fragment : line_box.fragments()) { if (is(fragment.layout_node()) && static_cast(fragment.layout_node()).paint_box()->stacking_context()) continue; - if (fragment.absolute_rect().contains(position)) { + auto fragment_absolute_rect = fragment.absolute_rect(); + if (fragment_absolute_rect.contains(position)) { if (is(fragment.layout_node()) && fragment.layout_node().paintable()) return fragment.layout_node().paintable()->hit_test(position, type); return HitTestResult { *fragment.layout_node().paintable(), fragment.text_index_at(position.x()) }; } - if (fragment.absolute_rect().top() <= position.y()) + if (fragment_absolute_rect.top() <= position.y()) last_good_candidate = HitTestResult { *fragment.layout_node().paintable(), fragment.text_index_at(position.x()) }; } }