mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
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:
parent
f62aa8edc2
commit
0b8986c8da
6 changed files with 47 additions and 30 deletions
|
@ -77,10 +77,10 @@ impl WindowPortsMethods for Window {
|
|||
fn request_resize(
|
||||
&self,
|
||||
webview: &::servo::WebView,
|
||||
size: DeviceIntSize,
|
||||
outer_size: DeviceIntSize,
|
||||
) -> Option<DeviceIntSize> {
|
||||
// Surfman doesn't support zero-sized surfaces.
|
||||
let new_size = DeviceIntSize::new(size.width.max(1), size.height.max(1));
|
||||
let new_size = DeviceIntSize::new(outer_size.width.max(1), outer_size.height.max(1));
|
||||
if self.inner_size.get() == new_size {
|
||||
return Some(new_size);
|
||||
}
|
||||
|
@ -90,7 +90,11 @@ impl WindowPortsMethods for Window {
|
|||
// Because we are managing the rendering surface ourselves, there will be no other
|
||||
// notification (such as from the display manager) that it has changed size, so we
|
||||
// must notify the compositor here.
|
||||
webview.resize(PhysicalSize::new(size.width as u32, size.height as u32));
|
||||
webview.move_resize(outer_size.to_f32().into());
|
||||
webview.resize(PhysicalSize::new(
|
||||
outer_size.width as u32,
|
||||
outer_size.height as u32,
|
||||
));
|
||||
|
||||
Some(new_size)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue