webdriver: Implement maximize window for both headless&headed window (#38271)

- Implement [Maximize
Window](https://w3c.github.io/webdriver/#maximize-window)
- Previously, headless window screen size is same as inner size if not
specified in preference. We make it double as required by the test to
not have max window initially.
- Some other random cleanup.

Testing: webdriver Stress test for maximize window (headed + headless).

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-07-26 20:21:17 +08:00 committed by GitHub
parent 9ef4d0c9d7
commit a3de3ffa75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 76 additions and 91 deletions

View file

@ -392,6 +392,22 @@ impl App {
warn!("Failed to send response of GetWindowSize: {error}");
}
},
WebDriverCommandMsg::MaximizeWebView(webview_id, response_sender) => {
let window = self
.windows
.values()
.next()
.expect("Should have at least one window in servoshell");
window.maximize(
&running_state
.webview_by_id(webview_id)
.expect("Webview must exists as we just verified"),
);
if let Err(error) = response_sender.send(window.window_rect()) {
warn!("Failed to send response of GetWindowSize: {error}");
}
},
WebDriverCommandMsg::SetWindowRect(webview_id, requested_rect, size_sender) => {
let Some(webview) = running_state.webview_by_id(webview_id) else {
continue;