UI: Send the current system visibility state to new WebContent clients

After a crash, we need to inform the new WebContent process of the
current system visibility state.
This commit is contained in:
Timothy Flynn 2024-11-13 11:31:06 -05:00 committed by Andreas Kling
parent 83b1db785a
commit 957032809b
Notes: github-actions[bot] 2024-11-13 19:37:42 +00:00
3 changed files with 8 additions and 2 deletions

View file

@ -163,6 +163,8 @@ void WebViewBridge::initialize_client(CreateNewClient create_new_client)
client().async_set_device_pixels_per_css_pixel(m_client_state.page_index, m_device_pixel_ratio); client().async_set_device_pixels_per_css_pixel(m_client_state.page_index, m_device_pixel_ratio);
client().async_set_preferred_color_scheme(m_client_state.page_index, m_preferred_color_scheme); client().async_set_preferred_color_scheme(m_client_state.page_index, m_preferred_color_scheme);
set_system_visibility_state(m_system_visibility_state);
update_palette(); update_palette();
if (!m_screen_rects.is_empty()) { if (!m_screen_rects.is_empty()) {

View file

@ -136,6 +136,8 @@ HeadlessWebView::HeadlessWebView(Core::AnonymousBuffer theme, Web::DevicePixelSi
m_pending_dialog = Web::Page::PendingDialog::None; m_pending_dialog = Web::Page::PendingDialog::None;
m_pending_prompt_text.clear(); m_pending_prompt_text.clear();
}; };
m_system_visibility_state = Web::HTML::VisibilityState::Visible;
} }
NonnullOwnPtr<HeadlessWebView> HeadlessWebView::create(Core::AnonymousBuffer theme, Web::DevicePixelSize window_size) NonnullOwnPtr<HeadlessWebView> HeadlessWebView::create(Core::AnonymousBuffer theme, Web::DevicePixelSize window_size)
@ -177,7 +179,7 @@ void HeadlessWebView::initialize_client(CreateNewClient create_new_client)
client().async_set_window_size(m_client_state.page_index, viewport_size()); client().async_set_window_size(m_client_state.page_index, viewport_size());
client().async_update_screen_rects(m_client_state.page_index, { screen_rect }, 0); client().async_update_screen_rects(m_client_state.page_index, { screen_rect }, 0);
set_system_visibility_state(Web::HTML::VisibilityState::Visible); set_system_visibility_state(m_system_visibility_state);
if (Application::chrome_options().allow_popups == WebView::AllowPopups::Yes) if (Application::chrome_options().allow_popups == WebView::AllowPopups::Yes)
client().async_debug_request(m_client_state.page_index, "block-pop-ups"sv, "off"sv); client().async_debug_request(m_client_state.page_index, "block-pop-ups"sv, "off"sv);

View file

@ -655,8 +655,10 @@ void WebContentView::initialize_client(WebView::ViewImplementation::CreateNewCli
client().async_set_window_handle(m_client_state.page_index, m_client_state.client_handle); client().async_set_window_handle(m_client_state.page_index, m_client_state.client_handle);
client().async_set_device_pixels_per_css_pixel(m_client_state.page_index, m_device_pixel_ratio); client().async_set_device_pixels_per_css_pixel(m_client_state.page_index, m_device_pixel_ratio);
update_palette();
set_system_visibility_state(m_system_visibility_state);
update_palette();
update_screen_rects(); update_screen_rects();
if (auto webdriver_content_ipc_path = WebView::Application::chrome_options().webdriver_content_ipc_path; webdriver_content_ipc_path.has_value()) if (auto webdriver_content_ipc_path = WebView::Application::chrome_options().webdriver_content_ipc_path; webdriver_content_ipc_path.has_value())