mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
headless-browser: Update the viewport when WebDriver resizes the window
When the window resizes, we should also update the viewport to match, rather than remaining at the hard-coded 800x600 size.
This commit is contained in:
parent
71ccaeda16
commit
e094712e3a
Notes:
github-actions[bot]
2024-11-13 10:02:07 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/e094712e3a0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2303
1 changed files with 10 additions and 1 deletions
|
@ -45,21 +45,30 @@ HeadlessWebView::HeadlessWebView(Core::AnonymousBuffer theme, Web::DevicePixelSi
|
|||
};
|
||||
|
||||
on_resize_window = [this](auto size) {
|
||||
client().async_set_window_size(m_client_state.page_index, size.template to_type<Web::DevicePixels>());
|
||||
m_viewport_size = size.template to_type<Web::DevicePixels>();
|
||||
|
||||
client().async_set_window_size(m_client_state.page_index, m_viewport_size);
|
||||
client().async_set_viewport_size(m_client_state.page_index, m_viewport_size);
|
||||
|
||||
client().async_did_update_window_rect(m_client_state.page_index);
|
||||
};
|
||||
|
||||
on_maximize_window = [this]() {
|
||||
m_viewport_size = screen_rect.size();
|
||||
|
||||
client().async_set_window_position(m_client_state.page_index, screen_rect.location());
|
||||
client().async_set_window_size(m_client_state.page_index, screen_rect.size());
|
||||
client().async_set_viewport_size(m_client_state.page_index, screen_rect.size());
|
||||
|
||||
client().async_did_update_window_rect(m_client_state.page_index);
|
||||
};
|
||||
|
||||
on_fullscreen_window = [this]() {
|
||||
m_viewport_size = screen_rect.size();
|
||||
|
||||
client().async_set_window_position(m_client_state.page_index, screen_rect.location());
|
||||
client().async_set_window_size(m_client_state.page_index, screen_rect.size());
|
||||
client().async_set_viewport_size(m_client_state.page_index, screen_rect.size());
|
||||
|
||||
client().async_did_update_window_rect(m_client_state.page_index);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue