mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Add a test to ensure "resize" event on VV is fired on pinch-zoom
This commit is contained in:
parent
835081d66e
commit
0fbadba2e1
|
|
@ -224,6 +224,13 @@ void Internals::wheel(double x, double y, double delta_x, double delta_y)
|
|||
page.handle_mousewheel(position, position, 0, 0, 0, delta_x, delta_y);
|
||||
}
|
||||
|
||||
void Internals::pinch(double x, double y, double scale_delta)
|
||||
{
|
||||
auto& page = this->page();
|
||||
auto position = page.css_to_device_point({ x, y });
|
||||
page.handle_pinch_event(position, scale_delta);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<bool> Internals::dispatch_user_activated_event(DOM::EventTarget& target, DOM::Event& event)
|
||||
{
|
||||
event.set_is_trusted(true);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public:
|
|||
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);
|
||||
void pinch(double x, double y, double scale_delta);
|
||||
|
||||
WebIDL::ExceptionOr<bool> dispatch_user_activated_event(DOM::EventTarget&, DOM::Event& event);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ interface Internals {
|
|||
undefined mouseDown(double x, double y);
|
||||
undefined movePointerTo(double x, double y);
|
||||
undefined wheel(double x, double y, double deltaX, double deltaY);
|
||||
undefined pinch(double x, double y, double scaleDelta);
|
||||
|
||||
boolean dispatchUserActivatedEvent(EventTarget target, Event event);
|
||||
undefined spoofCurrentURL(USVString url);
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
vv resize: width=533.3333333333334, height=400, scale=1.5, offsetLeft=33.328125, offsetTop=33.328125
|
||||
19
Tests/LibWeb/Text/input/vv-resize-on-pinch-to-zoom.html
Normal file
19
Tests/LibWeb/Text/input/vv-resize-on-pinch-to-zoom.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<script src="include.js"></script>
|
||||
<body></body>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
const vv = window.visualViewport;
|
||||
vv.addEventListener("resize", () => {
|
||||
println(`vv resize: width=${vv.width}, height=${vv.height}, scale=${vv.scale}, offsetLeft=${vv.offsetLeft}, offsetTop=${vv.offsetTop}`);
|
||||
done();
|
||||
});
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
// pinch from rAF to ensure resize event won't be skipped as "initial"
|
||||
internals.pinch(100, 100, 0.5);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user