From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- remote/shared/webdriver/Actions.sys.mjs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'remote/shared/webdriver/Actions.sys.mjs') diff --git a/remote/shared/webdriver/Actions.sys.mjs b/remote/shared/webdriver/Actions.sys.mjs index 2639c4dc9f..2c21e989dd 100644 --- a/remote/shared/webdriver/Actions.sys.mjs +++ b/remote/shared/webdriver/Actions.sys.mjs @@ -1318,6 +1318,7 @@ class WheelScrollAction extends WheelAction { this.duration ?? tickDuration, deltaTarget => this.performOneWheelScroll( + state, scrollCoordinates, deltaPosition, deltaTarget, @@ -1329,12 +1330,19 @@ class WheelScrollAction extends WheelAction { /** * Perform one part of a wheel scroll corresponding to a specific emitted event. * + * @param {State} state - Actions state. * @param {Array} scrollCoordinates - [x, y] viewport coordinates of the scroll. * @param {Array} deltaPosition - [deltaX, deltaY] coordinates of the scroll before this event. * @param {Array>} deltaTargets - Array of [deltaX, deltaY] coordinates to scroll to. * @param {WindowProxy} win - Current window global. */ - performOneWheelScroll(scrollCoordinates, deltaPosition, deltaTargets, win) { + performOneWheelScroll( + state, + scrollCoordinates, + deltaPosition, + deltaTargets, + win + ) { if (deltaTargets.length !== 1) { throw new Error("Can only scroll one wheel at a time"); } @@ -1350,6 +1358,7 @@ class WheelScrollAction extends WheelAction { deltaY, deltaZ: 0, }); + eventData.update(state); lazy.event.synthesizeWheelAtPoint( scrollCoordinates[0], @@ -2237,6 +2246,22 @@ class WheelEventData extends InputEventData { this.deltaY = deltaY; this.deltaZ = deltaZ; this.deltaMode = deltaMode; + + this.altKey = false; + this.ctrlKey = false; + this.metaKey = false; + this.shiftKey = false; + } + + update(state) { + // set modifier properties based on whether any corresponding keys are + // pressed on any key input source + for (const [, otherInputSource] of state.inputSourcesByType("key")) { + this.altKey = otherInputSource.alt || this.altKey; + this.ctrlKey = otherInputSource.ctrl || this.ctrlKey; + this.metaKey = otherInputSource.meta || this.metaKey; + this.shiftKey = otherInputSource.shift || this.shiftKey; + } } } -- cgit v1.2.3