servoshell: Respond resize with authentic result and Adjust minimum window size (#38258)

- We no longer pretend that resize is always successful and simplify the
result computation.
- Adjust minimum window size to match other browsers and the test
expectation.
- Restrict some unnecessary access specifier.

Testing: ` ./mach test-wpt -r
"tests\wpt\tests\webdriver\tests\classic\set_window_rect\set.py"
--log-raw "D:\servo test log\set.txt" --product servodriver
{--headless}`
Fixes: #37804 as Task 8 is last task.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-07-25 10:31:18 +08:00 committed by GitHub
parent d39e701b46
commit 928934d4b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 37 deletions

View file

@ -17,7 +17,7 @@ use servo::{RenderingContext, ScreenGeometry, SoftwareRenderingContext};
use winit::dpi::PhysicalSize;
use super::app_state::RunningAppState;
use crate::desktop::window_trait::WindowPortsMethods;
use crate::desktop::window_trait::{MIN_INNER_HEIGHT, MIN_INNER_WIDTH, WindowPortsMethods};
use crate::prefs::ServoShellPreferences;
pub struct Window {
@ -89,8 +89,10 @@ impl WindowPortsMethods for Window {
webview: &::servo::WebView,
outer_size: DeviceIntSize,
) -> Option<DeviceIntSize> {
// Surfman doesn't support zero-sized surfaces.
let new_size = DeviceIntSize::new(outer_size.width.max(1), outer_size.height.max(1));
let new_size = DeviceIntSize::new(
outer_size.width.max(MIN_INNER_WIDTH),
outer_size.height.max(MIN_INNER_HEIGHT),
);
if self.inner_size.get() == new_size {
return Some(new_size);
}