mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
webdriver: Greatly improve execution speed for all tests using SetWindowSize
(#37712)
1. Remove the unnecessary new thread which use GetWindowRect command and blocks for 500ms. Previously this is necessary because constellation forward "resize" to embedder, and WebDriver wait for a constant sufficient time to `GetWindowRect` in the new thread. This caused long delay because there are many subtests and SetWindowRect is called between each. 2. Remove `resize_timeout` 3. Return current dimension instead of 0 from embedder when it fails to resize. 4. Do resizing as long as one of width/height is `Some`, according to spec. Testing: All Conformance test with new passing cases. Fixes: https://github.com/servo/servo/pull/37663#issuecomment-2999120615 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
0774025d89
commit
9543482f51
4 changed files with 82 additions and 50 deletions
|
@ -373,7 +373,7 @@ impl App {
|
|||
warn!("Failed to send response of GetWindowSize: {error}");
|
||||
}
|
||||
},
|
||||
WebDriverCommandMsg::SetWindowSize(webview_id, size, size_sender) => {
|
||||
WebDriverCommandMsg::SetWindowSize(webview_id, requested_size, size_sender) => {
|
||||
let Some(webview) = running_state.webview_by_id(webview_id) else {
|
||||
continue;
|
||||
};
|
||||
|
@ -384,8 +384,12 @@ impl App {
|
|||
.next()
|
||||
.expect("Should have at least one window in servoshell");
|
||||
|
||||
let size = window.request_resize(&webview, size);
|
||||
if let Err(error) = size_sender.send(size.unwrap_or_default()) {
|
||||
// When None is returned, it means that the request went to the display system,
|
||||
// and the actual size will be delivered later with the WindowEvent::Resized.
|
||||
let returned_size = window.request_resize(&webview, requested_size);
|
||||
// TODO: Handle None case. For now, we assume always succeed.
|
||||
// In reality, the request may exceed available screen size.
|
||||
if let Err(error) = size_sender.send(returned_size.unwrap_or(requested_size)) {
|
||||
warn!("Failed to send window size: {error}");
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue