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

LibWeb: Only scroll BlockBox on wheel event if overflow==scroll

We implement this by adding a BlockBox::is_scrollable() helper,
and then ignoring wheel events for non-scrollable boxes.

Thanks to FireFox317 for pointing this out! :^)
This commit is contained in:
Andreas Kling 2021-02-22 23:44:51 +01:00
parent c9cd96894b
commit 82278d632f
3 changed files with 11 additions and 0 deletions

View file

@ -321,6 +321,8 @@ 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()) {
if (!containing_block->is_scrollable())
return;
auto new_offset = containing_block->scroll_offset();
new_offset.move_by(0, wheel_delta);
containing_block->set_scroll_offset(new_offset);