mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
servoshell: Sync window toolbar height with minibrowser (#38328)
Toolbar size can be changed if resized, such as entering fullscreen. Hit-test had wrong offsets after fullscreen/resize as `WindowEvent::CursorMoved` set wrong coordinates for `webview_relative_mouse_point` due to outdated toolbar height. Testing: #38297 now works properly. Fixes: #38297 --------- Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
parent
874645ae86
commit
f0eb6c2b97
2 changed files with 14 additions and 8 deletions
|
@ -201,10 +201,8 @@ impl App {
|
|||
webdriver_receiver,
|
||||
));
|
||||
running_state.create_and_focus_toplevel_webview(self.initial_url.clone().into_url());
|
||||
|
||||
if let Some(ref mut minibrowser) = self.minibrowser {
|
||||
minibrowser.update(window.winit_window().unwrap(), &running_state, "init");
|
||||
window.set_toolbar_height(minibrowser.toolbar_height);
|
||||
minibrowser.update(window.as_ref(), &running_state, "init");
|
||||
}
|
||||
|
||||
self.state = AppState::Running(running_state);
|
||||
|
@ -683,7 +681,7 @@ impl ApplicationHandler<AppEvent> for App {
|
|||
// WARNING: do not defer painting or presenting to some later tick of the event
|
||||
// loop or servoshell may become unresponsive! (servo#30312)
|
||||
if let Some(ref mut minibrowser) = self.minibrowser {
|
||||
minibrowser.update(window.winit_window().unwrap(), state, "RedrawRequested");
|
||||
minibrowser.update(window.as_ref(), state, "RedrawRequested");
|
||||
minibrowser.paint(window.winit_window().unwrap());
|
||||
}
|
||||
}
|
||||
|
@ -721,7 +719,7 @@ impl ApplicationHandler<AppEvent> for App {
|
|||
// Update minibrowser if there's resize event to sync up with window.
|
||||
if let WindowEvent::Resized(_) = event {
|
||||
minibrowser.update(
|
||||
window.winit_window().unwrap(),
|
||||
window.as_ref(),
|
||||
state,
|
||||
"Sync WebView size with Window Resize event",
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue