From 9cab5059f83b1d9879cca3acd7ca9c7db43981ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Oppeb=C3=B8en?= Date: Wed, 30 Nov 2022 01:02:26 +0100 Subject: [PATCH] LibWeb: Use correct end-of-fragment node index for HitTestResult The indexes are into the _node_, not in the fragment, so when a node is split into multiple fragments, simply taking the length of the fragment is incorrect. This patch corrects this mistake. --- Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 6634269b68..871d283a89 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -700,7 +700,7 @@ Optional PaintableWithLines::hit_test(CSSPixelPoint position, Hit return HitTestResult { *fragment.layout_node().paintable(), fragment.text_index_at(position.x().value()) }; } if (fragment_absolute_rect.top() <= position.y()) - last_good_candidate = HitTestResult { *fragment.layout_node().paintable(), fragment.length() + 1 }; + last_good_candidate = HitTestResult { *fragment.layout_node().paintable(), fragment.start() + fragment.length() }; } }