mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
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:
parent
9220a89d2f
commit
728fca1b1f
Notes:
sideshowbarker
2024-07-17 01:04:03 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/728fca1b1f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/238 Issue: https://github.com/LadybirdBrowser/ladybird/issues/175
3 changed files with 17 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Internals/InternalAnimationTimeline.h>
|
||||
#include <LibWeb/UIEvents/MouseButton.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
|
@ -27,6 +28,7 @@ public:
|
|||
void commit_text();
|
||||
|
||||
void click(double x, double y);
|
||||
void middle_click(double x, double y);
|
||||
void move_pointer_to(double x, double y);
|
||||
void wheel(double x, double y, double delta_x, double delta_y);
|
||||
|
||||
|
@ -37,6 +39,8 @@ public:
|
|||
private:
|
||||
explicit Internals(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
void click(double x, double y, UIEvents::MouseButton);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ interface Internals {
|
|||
undefined commitText();
|
||||
|
||||
undefined click(double x, double y);
|
||||
undefined middleClick(double x, double y);
|
||||
undefined movePointerTo(double x, double y);
|
||||
undefined wheel(double x, double y, double deltaX, double deltaY);
|
||||
|
||||
|
|
Loading…
Reference in a new issue