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

@ -75,6 +75,17 @@ Layout::InitialContainingBlockBox* EventHandler::layout_root()
bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int buttons, unsigned int modifiers, int wheel_delta)
{
if (!layout_root())
return false;
// FIXME: Support wheel events in subframes.
auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact);
if (result.layout_node) {
result.layout_node->handle_mousewheel({}, position, buttons, modifiers, wheel_delta);
return true;
}
return false;
}