LibWeb: Add Internals.middleClick

This simulates click of the middle mouse button, which is necessary for
testing whether the `auxevent` fires correctly.
This commit is contained in:
Tim Ledbetter
2024-06-21 22:35:12 +01:00
committed by Andreas Kling
parent 9220a89d2f
commit 728fca1b1f
3 changed files with 17 additions and 2 deletions

View File

@@ -77,10 +77,20 @@ void Internals::commit_text()
}
void Internals::click(double x, double y)
{
click(x, y, UIEvents::MouseButton::Primary);
}
void Internals::middle_click(double x, double y)
{
click(x, y, UIEvents::MouseButton::Middle);
}
void Internals::click(double x, double y, UIEvents::MouseButton button)
{
auto& page = global_object().browsing_context()->page();
page.handle_mousedown({ x, y }, { x, y }, 1, 0, 0);
page.handle_mouseup({ x, y }, { x, y }, 1, 0, 0);
page.handle_mousedown({ x, y }, { x, y }, button, 0, 0);
page.handle_mouseup({ x, y }, { x, y }, button, 0, 0);
}
void Internals::move_pointer_to(double x, double y)