mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
LibWeb: Return whether handle_mousewheel was handled
We try scrolling a Node with the handle_mousewheel event, but if it isn't scrollable, the event should be passed back up to the page host. This is the first step in that process.
This commit is contained in:
parent
17e6287333
commit
e9c1d9c89a
5 changed files with 13 additions and 7 deletions
|
@ -322,15 +322,18 @@ void Node::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned,
|
|||
{
|
||||
}
|
||||
|
||||
void Node::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned, unsigned, int wheel_delta)
|
||||
bool 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;
|
||||
return false;
|
||||
auto new_offset = containing_block->scroll_offset();
|
||||
new_offset.move_by(0, wheel_delta);
|
||||
containing_block->set_scroll_offset(new_offset);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Node::is_root_element() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue