Skip to content

Commit a2ff4ba

Browse files
committed
Update to reflect feedback specs/CoreWebView2ControllerOptions.DefaultBackgroundColor.md
1 parent 9e780e0 commit a2ff4ba

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

specs/CoreWebView2ControllerOptions.DefaultBackgroundColor.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ applies the color too late.
4747

4848
m_environment->CreateCoreWebView2ControllerWithOptions(
4949
m_mainWindow,
50-
SUCCEEDED(result) ? options4.Get() : options.Get(),
50+
options.Get(),
5151
Callback<ICoreWebView2CreateCoreWebView2ControllerCompletedHandler>(
5252
this, &AppWindow::OnCreateCoreWebView2ControllerCompleted).Get());
5353

@@ -66,12 +66,14 @@ public MainWindow()
6666
SetDefaultBackgroundColor();
6767
}
6868

69-
private void SetDefaultBackgroundColor()
69+
private async Task
70+
SetDefaultBackgroundColor()
7071
{
71-
CoreWebView2Environment environment = CoreWebView2Environment.CreateAsync();
72+
CoreWebView2Environment environment = await
73+
CoreWebView2Environment.CreateAsync();
7274
CoreWebView2ControllerOptions options = environment.CreateCoreWebView2ControllerOptions();
7375
options.DefaultBackgroundColor = Color.FromArgb(255, 85, 0, 255);
74-
WebView2.EnsureCoreWebView2Async(environment, options);
76+
await WebView2.EnsureCoreWebView2Async(environment, options);
7577
}
7678

7779
```
@@ -82,29 +84,30 @@ private void SetDefaultBackgroundColor()
8284

8385
## Win32 C++
8486
```cpp
85-
/// This interface extends the ICoreWebView2ControllerOptions interface to expose the DefaultBackgroundColor property.
86-
/// It is encouraged to transition away from the environment variable and use this API solution to apply the property.
87+
/// This interface extends the ICoreWebView2ControllerOptions interface to expose
88+
/// DefaultBackgroundColor property. It is encouraged to transition away from the
89+
/// environment variable and use this API solution to apply the property.
8790

8891
[uuid(df9cb70b-8d87-5bca-ae4b-6f23285e8d94), object, pointer_default(unique)]
8992
interface ICoreWebView2ControllerOptions4 : ICoreWebView2ControllerOptions3 {
9093

9194
/// This API allows users to initialize the `DefaultBackgroundColor` early,
92-
/// preventing a white flash that can happen while WebView2 is loading when
95+
/// preventing a white flash that can occur while WebView2 is loading when
9396
/// the background color is set to something other than white. With early
9497
/// initialization, the color remains consistent from the start. After
9598
/// initialization, `ICoreWebView2Controller2::get_DefaultBackgroundColor`
96-
/// will return the value set using this API.
99+
/// will return the value set using this API.
97100
///
98101
/// The `DefaultBackgroundColor` is the color that renders underneath all web
99102
/// content. This means WebView renders this color when there is no web
100103
/// content loaded. When no background color is defined in WebView2, it uses
101104
/// the `DefaultBackgroundColor` property to render the background.
102105
/// By default, this color is set to white.
103106
///
104-
/// Currently this API only supports opaque colors and transparency. It will
105-
/// fail for colors with alpha values that don't equal 0 or 255 ie. translucent
106-
/// colors are not supported. When WebView2 is set to have a transparent background,
107-
/// it renders the content of the parent window behind it.
107+
/// This API only supports opaque colors and full transparency. It will
108+
/// fail for colors with alpha values that don't equal 0 or 255.
109+
/// When WebView2 is set to be fully transparent, it does not render a background,
110+
/// allowing the content from windows behind it to be visible.
108111

109112
[propget] HRESULT DefaultBackgroundColor([out, retval] COREWEBVIEW2_COLOR* value);
110113
[propput] HRESULT DefaultBackgroundColor([in] COREWEBVIEW2_COLOR value);

0 commit comments

Comments
 (0)