1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LibWeb: Fix hit testing for fixed position nodes

Subtract the scroll offset translation from the position when checking
for intersection between boxes within fixed position nodes.
This commit is contained in:
Aliaksandr Kalenik 2023-07-15 16:32:13 +02:00 committed by Sam Atkins
parent e64a8751d1
commit 3c6fdde466

View file

@ -482,6 +482,11 @@ Optional<HitTestResult> StackingContext::hit_test(CSSPixelPoint position, HitTes
};
auto transformed_position = affine_transform_matrix().inverse().value_or({}).map(offset_position).to_type<CSSPixels>() + transform_origin;
if (paintable_box().layout_box().is_fixed_position()) {
auto scroll_offset = paintable_box().document().browsing_context()->viewport_scroll_offset();
transformed_position.translate_by(-scroll_offset);
}
// FIXME: Support more overflow variations.
if (paintable_box().computed_values().overflow_x() == CSS::Overflow::Hidden && paintable_box().computed_values().overflow_y() == CSS::Overflow::Hidden) {
if (!paintable_box().absolute_border_box_rect().contains(transformed_position.x(), transformed_position.y()))