diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index ddc406c8954..e9f45e3cf74 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -4625,31 +4625,8 @@ where } } }, - 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 => { - return warn!("{}: KeyboardAction after closure", browsing_context_id); - }, - }; - let event_loop = match self.pipelines.get(&pipeline_id) { - Some(pipeline) => pipeline.event_loop.clone(), - None => return warn!("{}: KeyboardAction after closure", pipeline_id), - }; - let event = InputEvent::Keyboard(KeyboardEvent::new(key_event.clone())) - .with_webdriver_message_id(msg_id); - let control_msg = ScriptThreadMessage::SendInputEvent( - pipeline_id, - ConstellationInputEvent { - pressed_mouse_buttons: self.pressed_mouse_buttons, - active_keyboard_modifiers: key_event.modifiers, - hit_test_result: None, - event, - }, - ); - if let Err(e) = event_loop.send(control_msg) { - self.handle_send_error(pipeline_id, e) - } + WebDriverCommandMsg::KeyboardAction(..) => { + unreachable!("This command should be send directly to the embedder."); }, WebDriverCommandMsg::MouseButtonAction(..) => { unreachable!("This command should be send directly to the embedder."); diff --git a/components/shared/embedder/webdriver.rs b/components/shared/embedder/webdriver.rs index 0d6e982869f..be19e6a2855 100644 --- a/components/shared/embedder/webdriver.rs +++ b/components/shared/embedder/webdriver.rs @@ -52,7 +52,7 @@ pub enum WebDriverCommandMsg { SendKeys(BrowsingContextId, Vec), /// Act as if keys were pressed or release in the browsing context with the given ID. KeyboardAction( - BrowsingContextId, + WebViewId, KeyboardEvent, // Should never be None. Option, diff --git a/components/webdriver_server/actions.rs b/components/webdriver_server/actions.rs index 8b2f59e5dbc..a4e28d352f3 100644 --- a/components/webdriver_server/actions.rs +++ b/components/webdriver_server/actions.rs @@ -311,11 +311,8 @@ impl Handler { // Step 12 self.increment_num_pending_actions(); let msg_id = self.current_action_id.get(); - let cmd_msg = WebDriverCommandMsg::KeyboardAction( - self.session().unwrap().browsing_context_id, - keyboard_event, - msg_id, - ); + let cmd_msg = + WebDriverCommandMsg::KeyboardAction(session.webview_id, keyboard_event, msg_id); let _ = self.send_message_to_embedder(cmd_msg); } @@ -350,11 +347,8 @@ impl Handler { // Step 12 self.increment_num_pending_actions(); let msg_id = self.current_action_id.get(); - let cmd_msg = WebDriverCommandMsg::KeyboardAction( - self.session().unwrap().browsing_context_id, - keyboard_event, - msg_id, - ); + let cmd_msg = + WebDriverCommandMsg::KeyboardAction(session.webview_id, keyboard_event, msg_id); let _ = self.send_message_to_embedder(cmd_msg); } } diff --git a/ports/servoshell/desktop/app.rs b/ports/servoshell/desktop/app.rs index d2e010bc88d..75a24e5059f 100644 --- a/ports/servoshell/desktop/app.rs +++ b/ports/servoshell/desktop/app.rs @@ -24,8 +24,8 @@ use servo::servo_url::ServoUrl; use servo::user_content_manager::{UserContentManager, UserScript}; use servo::webrender_api::ScrollLocation; use servo::{ - EventLoopWaker, InputEvent, MouseButtonEvent, MouseMoveEvent, WebDriverCommandMsg, WheelDelta, - WheelEvent, WheelMode, + EventLoopWaker, InputEvent, KeyboardEvent, MouseButtonEvent, MouseMoveEvent, + WebDriverCommandMsg, WheelDelta, WheelEvent, WheelMode, }; use url::Url; use winit::application::ApplicationHandler; @@ -458,8 +458,14 @@ impl App { WebDriverCommandMsg::SendKeys(..) => { running_state.forward_webdriver_command(msg); }, - WebDriverCommandMsg::KeyboardAction(..) => { - running_state.forward_webdriver_command(msg); + WebDriverCommandMsg::KeyboardAction(webview_id, key_event, msg_id) => { + // TODO: We should do processing like in `headed_window:handle_keyboard_input`. + if let Some(webview) = running_state.webview_by_id(webview_id) { + webview.notify_input_event( + InputEvent::Keyboard(KeyboardEvent::new(key_event)) + .with_webdriver_message_id(msg_id), + ); + } }, WebDriverCommandMsg::MouseButtonAction( webview_id, diff --git a/tests/wpt/meta/webdriver/tests/classic/perform_actions/pointer_modifier_click.py.ini b/tests/wpt/meta/webdriver/tests/classic/perform_actions/pointer_modifier_click.py.ini deleted file mode 100644 index af13d756701..00000000000 --- a/tests/wpt/meta/webdriver/tests/classic/perform_actions/pointer_modifier_click.py.ini +++ /dev/null @@ -1,21 +0,0 @@ -[pointer_modifier_click.py] - [test_modifier_click[\\ue00a-altKey\]] - expected: FAIL - - [test_modifier_click[\\ue052-altKey\]] - expected: FAIL - - [test_modifier_click[\\ue03d-metaKey\]] - expected: FAIL - - [test_modifier_click[\\ue053-metaKey\]] - expected: FAIL - - [test_modifier_click[\\ue008-shiftKey\]] - expected: FAIL - - [test_modifier_click[\\ue050-shiftKey\]] - expected: FAIL - - [test_many_modifiers_click] - expected: FAIL