-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
webdriver: Get the window position as well as the size when resolving "Get Window Rect" #37812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
window_rect
to WindowPortsMethods
to Implement "Get Window Rect" in WebDriver
window_rect
to WindowPortsMethods
to Implement "Get Window Rect" in WebDriverfn window_rect
to WindowPortsMethods
to Implement "Get Window Rect" in WebDriver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also explored another possibility to reuse script handler: because we want result as close to window.ScreenY
, window.OuterHeight
etc. as possible.
Right now, this is done in Script like following:
servo/components/script/dom/window.rs
Lines 1662 to 1666 in a13f9bc
// https://drafts.csswg.org/cssom-view/#dom-window-screeny | |
fn ScreenY(&self) -> i32 { | |
let (_, origin) = self.client_window(); | |
origin.y | |
} |
It sends the request to compositor, who ignores the toolbar height etc, giving inaccurate result.
That's why I give up "reusing" and implements a new one directly in embedder. I filed a new issue below.
fn window_rect
to WindowPortsMethods
to Implement "Get Window Rect" in WebDriverSigned-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, with one nit:
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
It seems Firefox does exactly the same as Servo. But Chrome/Edge correctly reports So I believe this cannot be easily fixed.. @mrobinson @jdm EDIT: On Linux the result is perfect for Servo/Firefox as well. So it is misusage of Windows API from Winit & nsWindow I believe.🤣 |
servo/tests/wpt/tests/webdriver/tests/support/helpers.py Lines 230 to 233 in 87bbe0b
I just saw this and believe Firefox/Servo + Chrome/Edge are all correct, with their own fashion. |
GetWindowSize
toGetWindowRect
(0, 0, ScreenWidth, ScreenHeight)
which is a static value.fn window_rect
toWindowPortsMethods
. 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 #37804