LibWeb: Simplify hit testing coordinate calculations

There are many simpler APIs that we can use here. No functional changes.
This commit is contained in:
Jelle Raaijmakers 2025-01-20 14:34:40 +01:00 committed by Jelle Raaijmakers
commit e076cb9b0e
Notes: github-actions[bot] 2025-01-23 08:34:17 +00:00
2 changed files with 7 additions and 16 deletions

View file

@ -374,10 +374,7 @@ TraversalDecision StackingContext::hit_test(CSSPixelPoint position, HitTestType
CSSPixelPoint transform_origin = paintable_box().transform_origin();
// NOTE: This CSSPixels -> Float -> CSSPixels conversion is because we can't AffineTransform::map() a CSSPixelPoint.
Gfx::FloatPoint offset_position {
(position.x() - transform_origin.x()).to_float(),
(position.y() - transform_origin.y()).to_float()
};
auto offset_position = position.translated(-transform_origin).to_type<float>();
auto transformed_position = affine_transform_matrix().inverse().value_or({}).map(offset_position).to_type<CSSPixels>() + transform_origin;
// NOTE: Hit testing basically happens in reverse painting order.