script: Improve webdriver_handler::get_element_in_view_center_point (#38058)

1. Some rounding was wrongly used which can be a source of inaccuracy. 
2. Use `window.InnerWidth` instead of `body.ClientWidth` according to
spec.

Testing: Many new passing cases.
Fixes: Part of #38042.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-07-15 08:14:17 +08:00 committed by GitHub
parent f13311a00e
commit 8877adccf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 63 additions and 69 deletions

View file

@ -1875,7 +1875,7 @@ impl Handler {
fn handle_element_click(&mut self, element: &WebElement) -> WebDriverResult<WebDriverResponse> {
let (sender, receiver) = ipc::channel().unwrap();
// Steps 1 - 7
// Steps 1 - 7 + Step 8 for <option>
let cmd = WebDriverScriptCommand::ElementClick(element.to_string(), sender);
self.browsing_context_script_command(cmd, VerifyBrowsingContextIsOpen::Yes)?;
@ -1883,7 +1883,7 @@ impl Handler {
Ok(element_id) => match element_id {
Some(element_id) => {
let id = Uuid::new_v4().to_string();
// Step 8 for elements other than <option>
// Step 8.1
self.session_mut()?.input_state_table.borrow_mut().insert(
id.clone(),