WebDriver Chore: use enum instead of compile time constant for browsing_context_script_command (#37940)

This reduces unnecessary generated code and binary size. See
https://github.com/servo/servo/pull/37712#discussion_r2171957828

Testing: No Behaviour change

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
Euclid Ye 2025-07-09 01:47:23 +08:00 committed by GitHub
parent e64bc6d282
commit 68ec88465e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 66 additions and 56 deletions

View file

@ -20,7 +20,7 @@ use webdriver::actions::{
use webdriver::command::ActionsParameters;
use webdriver::error::{ErrorStatus, WebDriverError};
use crate::{Handler, WebElement, wait_for_script_response};
use crate::{Handler, VerifyBrowsingContextIsOpen, WebElement, wait_for_script_response};
// Interval between wheelScroll and pointerMove increments in ms, based on common vsync
static POINTERMOVE_INTERVAL: u64 = 17;
@ -738,8 +738,9 @@ impl Handler {
web_element: &WebElement,
) -> Result<(i64, i64), ErrorStatus> {
let (sender, receiver) = ipc::channel().unwrap();
self.browsing_context_script_command::<false>(
self.browsing_context_script_command(
WebDriverScriptCommand::GetElementInViewCenterPoint(web_element.to_string(), sender),
VerifyBrowsingContextIsOpen::No,
)
.unwrap();
let response = match wait_for_script_response(receiver) {