mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
servoshell: Use DeviceIndependentPixel for WebDriver Rect related requests (#37893)
[Spec](https://w3c.github.io/webdriver/#set-window-rect) expects CSS pixel for input and output. Previously, we use Device Pixel for them instead. Testing: Tested manually with different screen DPR and compared with other browsers. Fixes: Task 4 of https://github.com/servo/servo/issues/37804 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
0db02702e7
commit
3526b7e86e
8 changed files with 66 additions and 269 deletions
|
@ -39,3 +39,4 @@ stylo = { workspace = true }
|
|||
url = { workspace = true }
|
||||
webdriver = { workspace = true }
|
||||
webrender_api = { workspace = true }
|
||||
servo_geometry = { path = "../../geometry" }
|
||||
|
|
|
@ -16,11 +16,12 @@ use keyboard_types::KeyboardEvent;
|
|||
use keyboard_types::webdriver::Event as WebDriverInputEvent;
|
||||
use pixels::RasterImage;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_geometry::{DeviceIndependentIntRect, DeviceIndependentIntSize, DeviceIndependentPixel};
|
||||
use servo_url::ServoUrl;
|
||||
use style_traits::CSSPixel;
|
||||
use webdriver::common::{WebElement, WebFrame, WebWindow};
|
||||
use webdriver::error::ErrorStatus;
|
||||
use webrender_api::units::{DeviceIntRect, DeviceIntSize, DevicePixel};
|
||||
use webrender_api::units::DevicePixel;
|
||||
|
||||
use crate::{MouseButton, MouseButtonAction};
|
||||
|
||||
|
@ -34,7 +35,7 @@ pub enum WebDriverCommandMsg {
|
|||
/// back to the WebDriver client. It is set to constellation for now
|
||||
SetWebDriverResponseSender(IpcSender<WebDriverCommandResponse>),
|
||||
/// Get the window size.
|
||||
GetWindowRect(WebViewId, IpcSender<DeviceIntRect>),
|
||||
GetWindowRect(WebViewId, IpcSender<DeviceIndependentIntRect>),
|
||||
/// Get the viewport size.
|
||||
GetViewportSize(WebViewId, IpcSender<Size2D<u32, DevicePixel>>),
|
||||
/// Load a URL in the top-level browsing context with the given ID.
|
||||
|
@ -90,8 +91,8 @@ pub enum WebDriverCommandMsg {
|
|||
/// Set the window size.
|
||||
SetWindowSize(
|
||||
WebViewId,
|
||||
DeviceIntSize,
|
||||
IpcSender<Size2D<i32, DevicePixel>>,
|
||||
DeviceIndependentIntSize,
|
||||
IpcSender<Size2D<i32, DeviceIndependentPixel>>,
|
||||
),
|
||||
/// Take a screenshot of the window.
|
||||
TakeScreenshot(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue