1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:27:39 +00:00

LibWeb: Allow scrolling overflowed content with the mouse wheel :^)

This is rather crude, but you can now use the mouse wheel to scroll up
and down in block-level boxes with clipped overflowing content.
There's no limit to how far you can scroll in either direction, since
we don't yet track how much overflow there is. But it's a start. :^)
This commit is contained in:
Andreas Kling 2021-02-22 19:48:24 +01:00
parent ded8c728d2
commit cd79b807dd
5 changed files with 44 additions and 0 deletions

View file

@ -53,10 +53,17 @@ public:
virtual void split_into_lines(InlineFormattingContext&, LayoutMode) override;
const Gfx::FloatPoint& scroll_offset() const { return m_scroll_offset; }
void set_scroll_offset(const Gfx::FloatPoint&);
private:
virtual bool is_block_box() const final { return true; }
virtual bool wants_mouse_events() const override { return true; }
virtual void handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta) override;
bool should_clip_overflow() const;
Gfx::FloatPoint m_scroll_offset;
};
template<>