Skip to content

fix: Remove Skia Wasm WebView border #20605

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace UITests.Microsoft_UI_Xaml_Controls.WebView2Tests
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
[Uno.UI.Samples.Controls.Sample("WebView")]
[Uno.UI.Samples.Controls.Sample("WebView", IsManualTest = true, Description = "The WebView2 should be borderless and the Uno Platform website should be displayed.")]
public sealed partial class WebView2_Basic : Page
{
public WebView2_Basic()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ internal static partial class NativeMethods
[JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.buildImports")]
internal static partial void BuildImports(string assembly);

[JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.initializeStyling")]
internal static partial void InitializeStyling(ElementId htmlId);

[JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.reload")]
internal static partial void Reload(ElementId htmlId);

Expand All @@ -44,9 +47,6 @@ internal static partial class NativeMethods
[JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.setAttribute")]
internal static partial void SetAttribute(ElementId htmlId, string attribute, string value);

[JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.setBackground")]
internal static partial void SetBackground(ElementId htmlId, string value);

[JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.setupEvents")]
internal static partial void SetupEvents(ElementId htmlId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public NativeWebView(CoreWebView2 coreWebView, ElementId elementId)
_coreWebView = coreWebView;
_elementId = elementId;

NativeMethods.SetBackground(elementId, "transparent");
NativeMethods.InitializeStyling(elementId);
NativeMethods.SetupEvents(elementId);
}

Expand Down
6 changes: 4 additions & 2 deletions src/Uno.UI/ts/Windows/UI/Xaml/Controls/WebView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ namespace Microsoft.UI.Xaml.Controls {
return (<HTMLIFrameElement>document.getElementById(htmlId)).getAttribute(name);
}

static setBackground(htmlId: string, color: string) {
(<HTMLIFrameElement>document.getElementById(htmlId)).style.backgroundColor = color;
static initializeStyling(htmlId: string) {
const iframe = document.getElementById(htmlId) as HTMLIFrameElement;
iframe.style.backgroundColor = "transparent";
iframe.style.border = "0";
}

static setupEvents(htmlId: string) {
Expand Down
Loading