mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Add internals.mouseDown(x, y)
This triggers a mouse button press without the up event, allowing us to e.g. simulate a selection by moving the mouse while keeping the button depressed.
This commit is contained in:
parent
bfb87b24a3
commit
15e3db5932
Notes:
github-actions[bot]
2024-12-10 13:55:25 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/15e3db59321 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2844
3 changed files with 15 additions and 0 deletions
|
@ -124,6 +124,18 @@ void Internals::click(double x, double y, UIEvents::MouseButton button)
|
|||
page.handle_mouseup(position, position, button, 0, 0);
|
||||
}
|
||||
|
||||
void Internals::mouse_down(double x, double y)
|
||||
{
|
||||
mouse_down(x, y, UIEvents::MouseButton::Primary);
|
||||
}
|
||||
|
||||
void Internals::mouse_down(double x, double y, UIEvents::MouseButton button)
|
||||
{
|
||||
auto& page = internals_page();
|
||||
auto position = page.css_to_device_point({ x, y });
|
||||
page.handle_mousedown(position, position, button, 0, 0);
|
||||
}
|
||||
|
||||
void Internals::move_pointer_to(double x, double y)
|
||||
{
|
||||
auto& page = internals_page();
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
void click(double x, double y);
|
||||
void doubleclick(double x, double y);
|
||||
void middle_click(double x, double y);
|
||||
void mouse_down(double x, double y);
|
||||
void move_pointer_to(double x, double y);
|
||||
void wheel(double x, double y, double delta_x, double delta_y);
|
||||
|
||||
|
@ -59,6 +60,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
void click(double x, double y, UIEvents::MouseButton);
|
||||
void mouse_down(double x, double y, UIEvents::MouseButton);
|
||||
|
||||
HTML::Window& internals_window() const;
|
||||
Page& internals_page() const;
|
||||
|
|
|
@ -23,6 +23,7 @@ interface Internals {
|
|||
undefined click(double x, double y);
|
||||
undefined doubleclick(double x, double y);
|
||||
undefined middleClick(double x, double y);
|
||||
undefined mouseDown(double x, double y);
|
||||
undefined movePointerTo(double x, double y);
|
||||
undefined wheel(double x, double y, double deltaX, double deltaY);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue