mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:47:35 +00:00
LibWeb: Use clip rectangles assigned to paintables in hit-testing
This change makes hit-testing more consistent in the handling of hidden overflow by reusing the same clip-rectangles. Also, it fixes bugs where the box is visible for hit-testing even though it is clipped by the hidden overflow of the containing block.
This commit is contained in:
parent
d3b983b201
commit
16f1962f10
8 changed files with 64 additions and 28 deletions
|
@ -676,6 +676,9 @@ Layout::BlockContainer& PaintableWithLines::layout_box()
|
|||
|
||||
Optional<HitTestResult> PaintableBox::hit_test(CSSPixelPoint position, HitTestType type) const
|
||||
{
|
||||
if (clip_rect().has_value() && !clip_rect()->contains(position))
|
||||
return {};
|
||||
|
||||
auto position_adjusted_by_scroll_offset = position;
|
||||
if (enclosing_scroll_frame_offset().has_value())
|
||||
position_adjusted_by_scroll_offset.translate_by(-enclosing_scroll_frame_offset().value());
|
||||
|
@ -712,6 +715,9 @@ Optional<HitTestResult> PaintableBox::hit_test(CSSPixelPoint position, HitTestTy
|
|||
|
||||
Optional<HitTestResult> PaintableWithLines::hit_test(CSSPixelPoint position, HitTestType type) const
|
||||
{
|
||||
if (clip_rect().has_value() && !clip_rect()->contains(position))
|
||||
return {};
|
||||
|
||||
auto position_adjusted_by_scroll_offset = position;
|
||||
if (enclosing_scroll_frame_offset().has_value())
|
||||
position_adjusted_by_scroll_offset.translate_by(-enclosing_scroll_frame_offset().value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue