1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +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

@ -318,6 +318,15 @@ void Node::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned,
{
}
void Node::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned, unsigned, int wheel_delta)
{
if (auto* containing_block = this->containing_block()) {
auto new_offset = containing_block->scroll_offset();
new_offset.move_by(0, wheel_delta);
containing_block->set_scroll_offset(new_offset);
}
}
bool Node::is_root_element() const
{
if (is_anonymous())