mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
servoshell: Make fn request_resize
resize window w.r.t. outer_size accurately (#37848)
`toolbar_height` is already part of `inner_size`, caused wrongly calculated `outer_size`. Even worse, it tried to `request_inner_size` with the already wrong `outer_size`. This PR make sure resize is accurate by first calculate the title/border height, and then compute the `inner_size` for `request_inner_size`. This is necessary because no direct `request_outer_size` is available. Testing: As manually tested, set window size WebDriver command no longer overshoot. This is also shared by [window.resizeTo](https://drafts.csswg.org/cssom-view/#dom-window-resizeto) JS method. WPT test would be necessary. (But that one is intermittent TIMEOUT. So created new one in https://github.com/servo/servo/pull/37856) WebDriver test will be postponed after https://github.com/web-platform-tests/wpt/pull/53421 is merged and synced to Servo. Fixes: Task 3 of https://github.com/servo/servo/issues/37804 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
a990ff82b9
commit
aaf04883dd
3 changed files with 11 additions and 11 deletions
|
@ -444,11 +444,11 @@ impl WebViewDelegate for RunningAppState {
|
|||
self.inner().window.set_position(new_position);
|
||||
}
|
||||
|
||||
fn request_resize_to(&self, webview: servo::WebView, new_size: DeviceIntSize) {
|
||||
fn request_resize_to(&self, webview: servo::WebView, new_outer_size: DeviceIntSize) {
|
||||
let mut rect = webview.rect();
|
||||
rect.set_size(new_size.to_f32());
|
||||
rect.set_size(new_outer_size.to_f32());
|
||||
webview.move_resize(rect);
|
||||
self.inner().window.request_resize(&webview, new_size);
|
||||
self.inner().window.request_resize(&webview, new_outer_size);
|
||||
}
|
||||
|
||||
fn show_simple_dialog(&self, webview: servo::WebView, dialog: SimpleDialog) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue