Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(windows): Enable edge's white flicker fix (requires v134+) #1513

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/wv2-white-flicker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
wry: "patch:enhance"
---

Wry by default now passes `--enable-features=RemoveRedirectionBitmap` to WebView2 to hide the initial white flash of newly created webviews. Only takes effect on WebView2 Runtime versions 134 and above.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,10 +1466,10 @@ pub trait WebViewBuilderExtWindows {
/// ## Warning
///
/// - Webview instances with different browser arguments must also have different [data directories](struct.WebContext.html#method.new).
/// - By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection`
/// `--autoplay-policy=no-user-gesture-required` if autoplay is enabled
/// and `--proxy-server=<scheme>://<host>:<port>` if a proxy is set.
/// so if you use this method, you have to add these arguments yourself if you want to keep the same behavior.
/// - By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection --enable-features=RemoveRedirectionBitmap`
/// `--autoplay-policy=no-user-gesture-required` if autoplay is enabled
/// and `--proxy-server=<scheme>://<host>:<port>` if a proxy is set.
/// so if you use this method, you have to add these arguments yourself if you want to keep the same behavior.
fn with_additional_browser_args<S: Into<String>>(self, additional_args: S) -> Self;

/// Determines whether browser-specific accelerator keys are enabled. When this setting is set to
Expand Down
3 changes: 2 additions & 1 deletion src/webview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ impl InnerWebView {
let additional_browser_args = pl_attrs.additional_browser_args.unwrap_or_else(|| {
// remove "mini menu" - See https://github.com/tauri-apps/wry/issues/535
// and "smart screen" - See https://github.com/tauri-apps/tauri/issues/1345
let default_args = "--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection";
// enable white flicker fix
let default_args = "--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection --enable-features=RemoveRedirectionBitmap";
let mut arguments = String::from(default_args);

if attributes.autoplay {
Expand Down