Skip to content

Commit

Permalink
feat: webview2 composition support
Browse files Browse the repository at this point in the history
  • Loading branch information
yydcnjjw authored and jiangjw committed Apr 7, 2024
1 parent 81d5e02 commit 5b1429c
Show file tree
Hide file tree
Showing 3 changed files with 1,152 additions and 16 deletions.
13 changes: 11 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,8 @@ pub(crate) struct PlatformSpecificWebViewAttributes {
additional_browser_args: Option<String>,
browser_accelerator_keys: bool,
theme: Option<Theme>,
use_https: bool,
https_scheme: bool,
composition: bool,
}

#[cfg(windows)]
Expand All @@ -1048,7 +1049,8 @@ impl Default for PlatformSpecificWebViewAttributes {
additional_browser_args: None,
browser_accelerator_keys: true, // This is WebView2's default behavior
theme: None,
use_https: false, // To match macOS & Linux behavior in the context of mixed content.
https_scheme: false, // To match macOS & Linux behavior in the context of mixed content.
composition: false,
}
}
}
Expand Down Expand Up @@ -1085,6 +1087,8 @@ pub trait WebViewBuilderExtWindows {
///
/// The default value is `false`.
fn with_https_scheme(self, enabled: bool) -> Self;

fn with_composition(self, enabled: bool) -> Self;
}

#[cfg(windows)]
Expand All @@ -1108,6 +1112,11 @@ impl WebViewBuilderExtWindows for WebViewBuilder<'_> {
self.platform_specific.use_https = enabled;
self
}

fn with_composition(mut self, enabled: bool) -> Self {
self.platform_specific.composition = enabled;
self
}
}

#[cfg(target_os = "android")]
Expand Down
Loading

0 comments on commit 5b1429c

Please sign in to comment.