Move webdriver actions commands to servoshell (#37669)

Move webdriver actions commands to servoshell.

Testing: Test with webdriver enable in the CI
[Test result
1](https://github.com/longvatrong111/servo/actions/runs/15875355256)
[Test result
2](https://github.com/longvatrong111/servo/actions/runs/15875356595)
[Test result
3](https://github.com/longvatrong111/servo/actions/runs/15875361886)

Fixes: https://github.com/servo/servo/issues/37370

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
batu_hoang 2025-07-05 00:29:38 +08:00 committed by GitHub
parent 9bd8d4f026
commit 940eff9497
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 126 additions and 208 deletions

View file

@ -1468,6 +1468,9 @@ where
)
}
},
EmbedderToConstellationMessage::SetWebDriverResponseSender(sender) => {
self.webdriver.input_command_response_sender = Some(sender);
},
}
}
@ -1850,7 +1853,6 @@ where
.send(WebDriverCommandResponse { id: msg_id })
.unwrap_or_else(|_| {
warn!("Failed to send WebDriverInputComplete {:?}", msg_id);
self.webdriver.input_command_response_sender = None;
});
} else {
warn!("No WebDriver input_command_response_sender");
@ -4616,14 +4618,7 @@ where
}
}
},
WebDriverCommandMsg::KeyboardAction(
browsing_context_id,
key_event,
msg_id,
response_sender,
) => {
self.webdriver.input_command_response_sender = Some(response_sender);
WebDriverCommandMsg::KeyboardAction(browsing_context_id, key_event, msg_id) => {
let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) {
Some(browsing_context) => browsing_context.pipeline_id,
None => {
@ -4649,50 +4644,14 @@ where
self.handle_send_error(pipeline_id, e)
}
},
WebDriverCommandMsg::MouseButtonAction(
webview_id,
mouse_event_type,
mouse_button,
x,
y,
msg_id,
response_sender,
) => {
self.webdriver.input_command_response_sender = Some(response_sender);
self.compositor_proxy
.send(CompositorMsg::WebDriverMouseButtonEvent(
webview_id,
mouse_event_type,
mouse_button,
x,
y,
msg_id,
));
WebDriverCommandMsg::MouseButtonAction(..) => {
unreachable!("This command should be send directly to the embedder.");
},
WebDriverCommandMsg::MouseMoveAction(webview_id, x, y, msg_id, response_sender) => {
self.webdriver.input_command_response_sender = Some(response_sender);
self.compositor_proxy
.send(CompositorMsg::WebDriverMouseMoveEvent(
webview_id, x, y, msg_id,
));
WebDriverCommandMsg::MouseMoveAction(..) => {
unreachable!("This command should be send directly to the embedder.");
},
WebDriverCommandMsg::WheelScrollAction(
webview_id,
x,
y,
delta_x,
delta_y,
msg_id,
response_sender,
) => {
self.webdriver.input_command_response_sender = Some(response_sender);
self.compositor_proxy
.send(CompositorMsg::WebDriverWheelScrollEvent(
webview_id, x, y, delta_x, delta_y, msg_id,
));
WebDriverCommandMsg::WheelScrollAction(..) => {
unreachable!("This command should be send directly to the embedder.");
},
WebDriverCommandMsg::TakeScreenshot(webview_id, rect, response_sender) => {
self.compositor_proxy.send(CompositorMsg::CreatePng(