mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +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
|
@ -361,6 +361,13 @@ impl WebView {
|
|||
.move_resize_webview(self.id(), rect);
|
||||
}
|
||||
|
||||
pub fn resize(&self, new_size: PhysicalSize<u32>) {
|
||||
self.inner()
|
||||
.compositor
|
||||
.borrow_mut()
|
||||
.resize_rendering_context(new_size);
|
||||
}
|
||||
|
||||
pub fn hidpi_scale_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
self.inner().hidpi_scale_factor
|
||||
}
|
||||
|
@ -490,13 +497,6 @@ impl WebView {
|
|||
self.inner().compositor.borrow_mut().on_vsync(self.id());
|
||||
}
|
||||
|
||||
pub fn resize(&self, new_size: PhysicalSize<u32>) {
|
||||
self.inner()
|
||||
.compositor
|
||||
.borrow_mut()
|
||||
.resize_rendering_context(new_size);
|
||||
}
|
||||
|
||||
pub fn set_zoom(&self, new_zoom: f32) {
|
||||
self.inner()
|
||||
.compositor
|
||||
|
|
|
@ -468,10 +468,10 @@ pub trait WebViewDelegate {
|
|||
/// Whether or not to allow a [`WebView`] to unload a `Document` in its main frame or one
|
||||
/// of its nested `<iframe>`s. By default, unloads are allowed.
|
||||
fn request_unload(&self, _webview: WebView, _unload_request: AllowOrDenyRequest) {}
|
||||
/// Move the window to a point
|
||||
/// Move the window to a point.
|
||||
fn request_move_to(&self, _webview: WebView, _: DeviceIntPoint) {}
|
||||
/// Resize the window to size
|
||||
fn request_resize_to(&self, _webview: WebView, _: DeviceIntSize) {}
|
||||
/// Try to resize the window that contains this [`WebView`] to the provided outer size.
|
||||
fn request_resize_to(&self, _webview: WebView, _requested_outer_size: DeviceIntSize) {}
|
||||
/// Whether or not to allow script to open a new `WebView`. If not handled by the
|
||||
/// embedder, these requests are automatically denied.
|
||||
fn request_open_auxiliary_webview(&self, _parent_webview: WebView) -> Option<WebView> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue