mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:57:35 +00:00
LibWeb: Account for scroll offset in hit-testing
The hit-testing position is now shifted by the scroll offsets before performing any checks for containment. This is implemented by assigning each PaintableBox/InlinePaintable an offset corresponding to the scroll frame in which it is contained. The non-scroll-adjusted position is still passed down when recursing to children because the assigned offset accumulated for nested scroll frames. With this change, hit testing works in the Inspector. Fixes https://github.com/SerenityOS/serenity/issues/22068
This commit is contained in:
parent
beb1c85b6b
commit
556679fedd
7 changed files with 81 additions and 10 deletions
|
@ -38,6 +38,7 @@ public:
|
|||
Vector<ShadowData> const& box_shadow_data() const { return m_box_shadow_data; }
|
||||
|
||||
void set_scroll_frame_id(int id) { m_scroll_frame_id = id; }
|
||||
void set_enclosing_scroll_frame_offset(CSSPixelPoint offset) { m_enclosing_scroll_frame_offset = offset; }
|
||||
void set_clip_rect(Optional<CSSPixelRect> rect) { m_clip_rect = rect; }
|
||||
|
||||
private:
|
||||
|
@ -47,6 +48,7 @@ private:
|
|||
void for_each_fragment(Callback) const;
|
||||
|
||||
Optional<int> m_scroll_frame_id;
|
||||
Optional<CSSPixelPoint> m_enclosing_scroll_frame_offset;
|
||||
Optional<CSSPixelRect> m_clip_rect;
|
||||
|
||||
Vector<ShadowData> m_box_shadow_data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue