fix: BrowserWindow backgroundColor#30777
Merged
jkleinsc merged 1 commit intoelectron:15-x-yfrom Sep 2, 2021
Merged
Conversation
This was referenced Aug 31, 2021
jkleinsc
approved these changes
Sep 1, 2021
codebytere
approved these changes
Sep 1, 2021
|
Release Notes Persisted
|
Contributor
|
I have automatically backported this PR to "14-x-y", please check out #30819 |
3 tasks
|
@codebytere will you backported this PR to "13-x-y"? BrowserView can also be fixed? |
This was referenced Sep 15, 2021
Contributor
|
Can this be backported? |
3 tasks
3 tasks
3 tasks
This was referenced Nov 3, 2021
ChALkeR
reviewed
Nov 6, 2021
| // explicitly set by calling | ||
| // RenderWidgetHostOwnerDelegate::SetBackgroundOpaque(false). | ||
| // RenderWidgetHostViewBase::SetBackgroundColor() will do this for us. | ||
| if (web_preferences->IsEnabled(options::kTransparent)) { |
3 tasks
|
Is this available on 16 already? If so still not fixing the intermittent loss of transparency there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
fixes #30759
The renderer in Blink now sets its own background color which is determined from the logic in
WebViewImpl::BaseBackgroundColor().To set this background color for the main frame, we must use
WebContents::SetPageBaseBackgroundColor(SkColor).In #30136, we had reverted using this API because it ended up breaking BrowserWindow transparency. To get this to work, we can see from
WebViewImpl::BaseBackgroundColor()that there's a property to enable transparency,override_base_background_color_to_transparent_.To override the base background color to be transparent, we must call
RenderWidgetHostOwnerDelegate::SetBackgroundOpaque(false)which we can do by invokingRenderWidgetHostViewBase::SetBackgroundColor(SK_ColorTRANSPARENT).cc @codebytere
Transparent window using https://gist.github.com/b52f026c763057f97f745fade82758fd from #30136

Background color using https://gist.github.com/4256f388d41ef0d974645a11ab72b1fe from #30759

Checklist
npm testpassesRelease Notes
Notes: Fixed BrowserWindow's backgroundColor option not having an effect.