1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:17:44 +00:00

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.
This commit is contained in:
Andreas Oppebøen 2022-11-30 01:02:26 +01:00 committed by Andreas Kling
parent 31f4ec66c5
commit 9cab5059f8

View file

@ -700,7 +700,7 @@ Optional<HitTestResult> 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() };
}
}