From 7ead20d575d9bc943ac94b301b0c1b23d16460dc Mon Sep 17 00:00:00 2001 From: attila Date: Thu, 11 Jul 2024 13:36:07 +0200 Subject: [PATCH] WebBrowserComponent: Windows: Avoid flash to default JUCE background colour The default background colour of the WebBrowserComponent is white on all platforms. Before the first page finishes loading this is the colour that should fill the WebBrowserComponent's area. Prior to this change however, on Windows a sudden flash to the default JUCE background colour would occur, before the default white background could take effect. At the time of this commit there is a known issue with the icorewebview2controller2, where a white flash is inevitable, unless the WEBVIEW2_DEFAULT_BACKGROUND_COLOR environment variable is set. Using a white background behind the WebView avoids this issue. --- .../native/juce_WebBrowserComponent_windows.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_extra/native/juce_WebBrowserComponent_windows.cpp b/modules/juce_gui_extra/native/juce_WebBrowserComponent_windows.cpp index 945fc6d8e8..6e6c3853ed 100644 --- a/modules/juce_gui_extra/native/juce_WebBrowserComponent_windows.cpp +++ b/modules/juce_gui_extra/native/juce_WebBrowserComponent_windows.cpp @@ -491,11 +491,10 @@ public: void fallbackPaint (Graphics& webBrowserComponentContext) override { + webBrowserComponentContext.fillAll (Colours::white); + if (! hasBrowserBeenCreated()) - { - webBrowserComponentContext.fillAll (Colours::white); checkWindowAssociation(); - } } void focusGainedWithDirection (FocusChangeType, FocusChangeDirection direction) override