-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
servoshell: Make fn request_resize resize window w.r.t. outer_size accurately
#37848
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 <[email protected]>
|
🔨 Triggering try run (#16046257080) for Linux (WPT) |
|
Test results for linux-wpt from try job (#16046257080): Flaky unexpected result (23)
Stable unexpected results that are known to be intermittent (18)
|
|
✨ Try run (#16046257080) succeeded. |
Signed-off-by: Euclid Ye <[email protected]>
ae976ac to
7e1e81d
Compare
fn request_resize resize accuratelyfn request_resize resize window w.r.t. outer_size accurately
| /// Request a new inner size for the window, not including external decorations. | ||
| fn request_resize(&self, webview: &WebView, inner_size: DeviceIntSize) | ||
| /// Request a new outer size for the window, including external decorations. | ||
| /// This should be the same as `window.outerWidth` and `window.outerHeight`` | ||
| fn request_resize(&self, webview: &WebView, outer_size: DeviceIntSize) |
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.
This function is used for only two things:
- window.resizeTo
- WebDriver SetWindowRect
Both would request outer_size instead of inner_size
| let title_height = | ||
| self.winit_window.outer_size().height - self.winit_window.inner_size().height; |
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.
Should we calculate toolbar height in the same way as before? Since hidpi scale factor might be playing a role here.
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.
Not needed because inner_size already includes toolbar height.
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.
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.
Then what does inner_size stand for? Window.innerHeight should not include toolbar, but viewport only.
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.
inner_size is the terminology used by winit. It is everything except the title and border from OS.
Window.innerHeight should not include toolbar, but viewport only.
Yes. This is already done correctly, except that they didn't include Scrollbar. But that is another story..
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 see, LGTM!
| let title_height = | ||
| self.winit_window.outer_size().height - self.winit_window.inner_size().height; |
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 see, LGTM!
…& Fix wrong usage of `innerHeight` & add new test (#37856) 1. rename original `window_resizeTo.html` to `window_resize_event.html` to reflect the purpose. Also change {innerWidth, innerHeight} to {outerWidth, outerHeight} to match spec. 2. Add a new test `window_resizeTo.html` for #37848 Testing: new test always fails because of #37824, which gives inaccurate outerHeight. Signed-off-by: Euclid Ye <[email protected]>

toolbar_heightis already part ofinner_size, caused wrongly calculatedouter_size. Even worse, it tried torequest_inner_sizewith the already wrongouter_size.This PR make sure resize is accurate by first calculate the title/border height, and then compute the
inner_sizeforrequest_inner_size. This is necessary because no directrequest_outer_sizeis available.Testing: As manually tested, set window size WebDriver command no longer overshoot. This is also shared by window.resizeTo JS method. WPT test would be necessary. (But that one is intermittent TIMEOUT. So created new one in #37856)
WebDriver test will be postponed after web-platform-tests/wpt#53421 is merged and synced to Servo.
Fixes: Task 3 of #37804