From 957032809b761dfab819bac6ea4b1177994257d3 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 13 Nov 2024 11:31:06 -0500 Subject: [PATCH] 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. --- UI/AppKit/Interface/LadybirdWebViewBridge.cpp | 2 ++ UI/Headless/HeadlessWebView.cpp | 4 +++- UI/Qt/WebContentView.cpp | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/UI/AppKit/Interface/LadybirdWebViewBridge.cpp b/UI/AppKit/Interface/LadybirdWebViewBridge.cpp index 0d14450802d..c9319e58234 100644 --- a/UI/AppKit/Interface/LadybirdWebViewBridge.cpp +++ b/UI/AppKit/Interface/LadybirdWebViewBridge.cpp @@ -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_preferred_color_scheme(m_client_state.page_index, m_preferred_color_scheme); + + set_system_visibility_state(m_system_visibility_state); update_palette(); if (!m_screen_rects.is_empty()) { diff --git a/UI/Headless/HeadlessWebView.cpp b/UI/Headless/HeadlessWebView.cpp index b47444f118d..e0be92096d6 100644 --- a/UI/Headless/HeadlessWebView.cpp +++ b/UI/Headless/HeadlessWebView.cpp @@ -136,6 +136,8 @@ HeadlessWebView::HeadlessWebView(Core::AnonymousBuffer theme, Web::DevicePixelSi m_pending_dialog = Web::Page::PendingDialog::None; m_pending_prompt_text.clear(); }; + + m_system_visibility_state = Web::HTML::VisibilityState::Visible; } NonnullOwnPtr 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_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) client().async_debug_request(m_client_state.page_index, "block-pop-ups"sv, "off"sv); diff --git a/UI/Qt/WebContentView.cpp b/UI/Qt/WebContentView.cpp index 8f4ae0d2228..26965c906e6 100644 --- a/UI/Qt/WebContentView.cpp +++ b/UI/Qt/WebContentView.cpp @@ -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_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(); if (auto webdriver_content_ipc_path = WebView::Application::chrome_options().webdriver_content_ipc_path; webdriver_content_ipc_path.has_value())