mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
[webdriver] Add synchronization for wheel action (#37260)
Implement action synchronization for wheel event. Previously only done for pointer here https://github.com/servo/servo/pull/36932. Testing: `tests/wpt/meta/webdriver/tests/classic/perform_actions/wheel.py` --------- Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
This commit is contained in:
parent
5114e24db1
commit
15eadb56a4
8 changed files with 89 additions and 34 deletions
|
@ -54,7 +54,7 @@ impl InputEvent {
|
|||
InputEvent::MouseButton(event) => event.webdriver_id,
|
||||
InputEvent::MouseMove(event) => event.webdriver_id,
|
||||
InputEvent::Touch(..) => None,
|
||||
InputEvent::Wheel(..) => None,
|
||||
InputEvent::Wheel(event) => event.webdriver_id,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,9 @@ impl InputEvent {
|
|||
event.webdriver_id = webdriver_id;
|
||||
},
|
||||
InputEvent::Touch(..) => {},
|
||||
InputEvent::Wheel(..) => {},
|
||||
InputEvent::Wheel(ref mut event) => {
|
||||
event.webdriver_id = webdriver_id;
|
||||
},
|
||||
};
|
||||
|
||||
self
|
||||
|
@ -275,6 +277,17 @@ pub struct WheelDelta {
|
|||
pub struct WheelEvent {
|
||||
pub delta: WheelDelta,
|
||||
pub point: DevicePoint,
|
||||
webdriver_id: Option<WebDriverMessageId>,
|
||||
}
|
||||
|
||||
impl WheelEvent {
|
||||
pub fn new(delta: WheelDelta, point: DevicePoint) -> Self {
|
||||
WheelEvent {
|
||||
delta,
|
||||
point,
|
||||
webdriver_id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
|
|
@ -50,7 +50,8 @@ pub enum WebDriverCommandMsg {
|
|||
MouseButton,
|
||||
f32,
|
||||
f32,
|
||||
WebDriverMessageId,
|
||||
// Should never be None.
|
||||
Option<WebDriverMessageId>,
|
||||
IpcSender<WebDriverCommandResponse>,
|
||||
),
|
||||
/// Act as if the mouse was moved in the browsing context with the given ID.
|
||||
|
@ -58,11 +59,23 @@ pub enum WebDriverCommandMsg {
|
|||
WebViewId,
|
||||
f32,
|
||||
f32,
|
||||
WebDriverMessageId,
|
||||
// None if it's not the last `perform_pointer_move` since we only
|
||||
// expect one response from constellation for each tick actions.
|
||||
Option<WebDriverMessageId>,
|
||||
IpcSender<WebDriverCommandResponse>,
|
||||
),
|
||||
/// Act as if the mouse wheel is scrolled in the browsing context given the given ID.
|
||||
WheelScrollAction(WebViewId, f32, f32, f64, f64),
|
||||
WheelScrollAction(
|
||||
WebViewId,
|
||||
f32,
|
||||
f32,
|
||||
f64,
|
||||
f64,
|
||||
// None if it's not the last `perform_wheel_scroll` since we only
|
||||
// expect one response from constellation for each tick actions.
|
||||
Option<WebDriverMessageId>,
|
||||
IpcSender<WebDriverCommandResponse>,
|
||||
),
|
||||
/// Set the window size.
|
||||
SetWindowSize(WebViewId, DeviceIntSize, IpcSender<Size2D<f32, CSSPixel>>),
|
||||
/// Take a screenshot of the window.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue