Skip to content
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

[Bug]: CSS rendering is different when webview transparency set #4945

Open
leaanthony opened this issue Nov 23, 2024 · 4 comments
Open

[Bug]: CSS rendering is different when webview transparency set #4945

leaanthony opened this issue Nov 23, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@leaanthony
Copy link

leaanthony commented Nov 23, 2024

What happened?

When using a background colour for both host window and webview with Alpha = 0, the CSS backdrop-filter: blur does not work as expected.

Example when using Mica:

image

It works as expected if Alpha = 255:

image

Original report (via Wails): wailsapp/wails#2340
I don't know if it's useful or not, but the same bug happened on Mac: illixion/vscode-vibrancy-continued#87

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

131.0.2903.63

SDK Version

No response

Framework

Win32

Operating System

Windows 11

OS Version

26100.2454

Repro steps

  • Create a standard win32 window
  • Embed the webview
  • Set the webview background colour to {0,0,0,0}
  • Load the attached html file
  • See the text without blur
  • Set the webview background colour to {0,0,0,255}
  • Load the attached html file
  • See the text with blur

Index html (renamed to txt to upload)
index.txt

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

AB#52983110

@leaanthony leaanthony added the bug Something isn't working label Nov 23, 2024
@hbl917070
Copy link

I encountered the same issue as well.
However, blur processing needs to calculate with the surrounding pixels to achieve the effect. If all the surrounding pixels are transparent, it makes sense that the blur cannot be computed.
After all, CSS's backdrop-filter only applies to elements within the webpage, and the content beneath the browser window is not included in the computation.
To solve this problem, the only option would be to continuously set the content beneath the window as the webpage background when the WebView2 background color is transparent. However, this approach would likely incur a very high computational cost.

@leaanthony
Copy link
Author

@hbl917070 that does make sense... If this is a "wont do" fair enough. I would have thought it was possible to blur against a transparent background though, somehow.

@bradp0721 bradp0721 assigned leonhsl and unassigned bradp0721 Nov 25, 2024
@bradp0721
Copy link
Member

We are already tracking this issue internally. I've marked this issue so it is linked to our internal backlog.

Currently, the above behavior is by design in Chromium. The blurring effect uses the surrounding pixels to achieve the effect. Since the top level window of the browser always has an opaque color, this isn't an issue for Chromium and other browsers. However, since WebView2 enables a transparent background color, now the blurring effect has no surrounding pixels to use to achieve the blur. We are still investigating how to solve this issue for WebView2s with transparent backgrounds.

@leaanthony
Copy link
Author

Thank you so much for the quick feedback @bradp0721 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants