mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Set proper button value in WebDriver - ElementClick command (#36871)
Fix ElementClick: `ElementClick` should use `MouseButton::Left` to create `action`. Testing: No pass test now. Tests still fail because of other issues. For: https://github.com/servo/servo/issues/36658 cc: @xiaochengh , @yezhizhen , @PotatoCP Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
parent
eaf9224799
commit
b2e51820e4
3 changed files with 20 additions and 18 deletions
|
@ -23,7 +23,7 @@ use constellation_traits::{EmbedderToConstellationMessage, TraversalDirection};
|
|||
use cookie::{CookieBuilder, Expiration};
|
||||
use crossbeam_channel::{Receiver, Sender, after, select, unbounded};
|
||||
use embedder_traits::{
|
||||
WebDriverCommandMsg, WebDriverCookieError, WebDriverFrameId, WebDriverJSError,
|
||||
MouseButton, WebDriverCommandMsg, WebDriverCookieError, WebDriverFrameId, WebDriverJSError,
|
||||
WebDriverJSResult, WebDriverJSValue, WebDriverLoadStatus, WebDriverScriptCommand,
|
||||
};
|
||||
use euclid::{Rect, Size2D};
|
||||
|
@ -1619,7 +1619,10 @@ impl Handler {
|
|||
InputSourceState::Pointer(PointerInputState::new(&PointerType::Mouse)),
|
||||
);
|
||||
|
||||
// Steps 8.3 - 8.6
|
||||
// Step 8.7. Construct a pointer move action.
|
||||
// Step 8.8. Set a property x to 0 on pointer move action.
|
||||
// Step 8.9. Set a property y to 0 on pointer move action.
|
||||
// Step 8.10. Set a property origin to element on pointer move action.
|
||||
let pointer_move_action = PointerMoveAction {
|
||||
duration: None,
|
||||
origin: PointerOrigin::Element(WebElement(element_id)),
|
||||
|
@ -1628,32 +1631,32 @@ impl Handler {
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
// Steps 8.7 - 8.8
|
||||
// Step 8.11. Construct pointer down action.
|
||||
// Step 8.12. Set a property button to 0 on pointer down action.
|
||||
let pointer_down_action = PointerDownAction {
|
||||
button: 1,
|
||||
button: i16::from(MouseButton::Left) as u64,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Steps 8.9 - 8.10
|
||||
// Step 8.13. Construct pointer up action.
|
||||
// Step 8.14. Set a property button to 0 on pointer up action.
|
||||
let pointer_up_action = PointerUpAction {
|
||||
button: 1,
|
||||
button: i16::from(MouseButton::Left) as u64,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Step 8.11
|
||||
// Step 8.16 Dispatch a list of actions with input state,
|
||||
// actions, session's current browsing context, and actions options.
|
||||
if let Err(error) =
|
||||
self.dispatch_pointermove_action(&id, &pointer_move_action, 0)
|
||||
{
|
||||
return Err(WebDriverError::new(error, ""));
|
||||
}
|
||||
|
||||
// Steps 8.12
|
||||
self.dispatch_pointerdown_action(&id, &pointer_down_action);
|
||||
|
||||
// Steps 8.13
|
||||
self.dispatch_pointerup_action(&id, &pointer_up_action);
|
||||
|
||||
// Step 8.14
|
||||
// Step 8.17 Remove an input source with input state and input id.
|
||||
self.session_mut()?.input_state_table.remove(&id);
|
||||
|
||||
// Step 13
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue