mirror of
https://github.com/servo/servo.git
synced 2025-08-23 06:15:35 +01:00
webdriver: Get the window position as well as the size when resolving "Get Window Rect" (#37812)
1. Rename `GetWindowSize` to `GetWindowRect` 2. Return the WindowRect in device pixels correctly. Previously, it returns `(0, 0, ScreenWidth, ScreenHeight)` which is a static value. 3. Add `fn window_rect` to `WindowPortsMethods`. Implement it for both Headless Window and Headed Window. Testing: Tested manually with powershell script. Result is now dynamic and reflects the truth. Fixes: Task 1 & 2 of https://github.com/servo/servo/issues/37804 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
95d9d3a412
commit
94f35ba998
7 changed files with 35 additions and 19 deletions
|
@ -362,14 +362,14 @@ impl App {
|
|||
// TODO: send a response to the WebDriver
|
||||
// so it knows when the focus has finished.
|
||||
},
|
||||
WebDriverCommandMsg::GetWindowSize(_webview_id, response_sender) => {
|
||||
WebDriverCommandMsg::GetWindowRect(_webview_id, response_sender) => {
|
||||
let window = self
|
||||
.windows
|
||||
.values()
|
||||
.next()
|
||||
.expect("Should have at least one window in servoshell");
|
||||
|
||||
if let Err(error) = response_sender.send(window.screen_geometry().size) {
|
||||
if let Err(error) = response_sender.send(window.window_rect()) {
|
||||
warn!("Failed to send response of GetWindowSize: {error}");
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue