servoshell: Consider window decorations when handling resize requests from web content (#38174)

Also fix some docs. This is used by JS `resizeTo`, `resizeBy` and
webdriver [set window
rect](https://w3c.github.io/webdriver/#set-window-rect).

Testing: Can now pass more tests for headed window.
Fixes: Well.. Originally the attempt is to address
https://github.com/servo/servo/issues/38093#issuecomment-3092284104. But
it turns out as a more general problem to be fixed in another PR.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-07-24 13:42:04 +08:00 committed by GitHub
parent f62aa8edc2
commit 0b8986c8da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 47 additions and 30 deletions

View file

@ -553,11 +553,11 @@ impl WebViewDelegate for RunningAppState {
self.inner().window.set_position(new_position);
}
fn request_resize_to(&self, webview: servo::WebView, new_outer_size: DeviceIntSize) {
let mut rect = webview.rect();
rect.set_size(new_outer_size.to_f32());
webview.move_resize(rect);
self.inner().window.request_resize(&webview, new_outer_size);
fn request_resize_to(&self, webview: servo::WebView, requested_outer_size: DeviceIntSize) {
// We need to update compositor's view later as we not sure about resizing result.
self.inner()
.window
.request_resize(&webview, requested_outer_size);
}
fn show_simple_dialog(&self, webview: servo::WebView, dialog: SimpleDialog) {