mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Simplify hit testing coordinate calculations
There are many simpler APIs that we can use here. No functional changes.
This commit is contained in:
parent
336684bc5c
commit
e076cb9b0e
Notes:
github-actions[bot]
2025-01-23 08:34:17 +00:00
Author: https://github.com/gmta
Commit: e076cb9b0e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3276
Reviewed-by: https://github.com/kalenikaliaksandr ✅
2 changed files with 7 additions and 16 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue