mirror of
https://github.com/servo/servo.git
synced 2025-07-19 13:23:46 +01:00
embedder: Improve documentation for various places that talk about "available screen size" (#37879)
Testing: Just add comment. It turns out difficult to achieve, see https://github.com/rust-windowing/winit/issues/2494. Fixes: Nothing. Provide some guidance to #37878 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
a81ddd5c18
commit
70b0fb840e
3 changed files with 6 additions and 2 deletions
|
@ -174,7 +174,8 @@ pub enum CompositorMsg {
|
||||||
GetClientWindowRect(WebViewId, IpcSender<DeviceIndependentIntRect>),
|
GetClientWindowRect(WebViewId, IpcSender<DeviceIndependentIntRect>),
|
||||||
/// Get the size of the screen that the client window inhabits.
|
/// Get the size of the screen that the client window inhabits.
|
||||||
GetScreenSize(WebViewId, IpcSender<DeviceIndependentIntSize>),
|
GetScreenSize(WebViewId, IpcSender<DeviceIndependentIntSize>),
|
||||||
/// Get the available screen size (without toolbars and docks) for the screen
|
/// Get the available screen size, without system interface elements such as menus, docks, and
|
||||||
|
/// taskbars.
|
||||||
/// the client window inhabits.
|
/// the client window inhabits.
|
||||||
GetAvailableScreenSize(WebViewId, IpcSender<DeviceIndependentIntSize>),
|
GetAvailableScreenSize(WebViewId, IpcSender<DeviceIndependentIntSize>),
|
||||||
|
|
||||||
|
|
|
@ -711,7 +711,7 @@ pub struct ScreenGeometry {
|
||||||
pub size: DeviceIntSize,
|
pub size: DeviceIntSize,
|
||||||
/// The available size of the screen in device pixels. This size is the size
|
/// The available size of the screen in device pixels. This size is the size
|
||||||
/// available for web content on the screen, and should be `size` minus any system
|
/// available for web content on the screen, and should be `size` minus any system
|
||||||
/// toolbars, docks, and interface elements of the browser. This will be converted to
|
/// toolbars, docks, and interface elements. This will be converted to
|
||||||
/// CSS pixels based on the pixel scaling of the `WebView`.
|
/// CSS pixels based on the pixel scaling of the `WebView`.
|
||||||
pub available_size: DeviceIntSize,
|
pub available_size: DeviceIntSize,
|
||||||
/// The offset of the `WebView` in device pixels for the purposes of the `window.screenLeft`
|
/// The offset of the `WebView` in device pixels for the purposes of the `window.screenLeft`
|
||||||
|
|
|
@ -431,6 +431,9 @@ impl WindowPortsMethods for Window {
|
||||||
);
|
);
|
||||||
|
|
||||||
let screen_size = self.screen_size.to_f32() * hidpi_factor;
|
let screen_size = self.screen_size.to_f32() * hidpi_factor;
|
||||||
|
// FIXME: In reality, this should subtract screen space used by the system interface
|
||||||
|
// elements, but it is difficult to get this value with `winit` currently. See:
|
||||||
|
// See https://github.com/rust-windowing/winit/issues/2494
|
||||||
let available_screen_size = screen_size - toolbar_size;
|
let available_screen_size = screen_size - toolbar_size;
|
||||||
|
|
||||||
// Offset the WebView origin by the toolbar so that it reflects the actual viewport and
|
// Offset the WebView origin by the toolbar so that it reflects the actual viewport and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue