2019-04-16 16:38:48 +02:00
|
|
|
diff --git ui/views/controls/native/native_view_host.cc ui/views/controls/native/native_view_host.cc
|
2019-10-01 15:55:16 +02:00
|
|
|
index bc1cb3a9e6fc..f68bdeb8786c 100644
|
2019-04-16 16:38:48 +02:00
|
|
|
--- ui/views/controls/native/native_view_host.cc
|
|
|
|
+++ ui/views/controls/native/native_view_host.cc
|
2019-10-01 15:55:16 +02:00
|
|
|
@@ -151,7 +151,7 @@ void NativeViewHost::OnPaint(gfx::Canvas* canvas) {
|
2019-04-16 16:38:48 +02:00
|
|
|
// It would be nice if this used some approximation of the page's
|
|
|
|
// current background color.
|
|
|
|
if (native_wrapper_->HasInstalledClip())
|
|
|
|
- canvas->FillRect(GetLocalBounds(), SK_ColorWHITE);
|
|
|
|
+ canvas->FillRect(GetLocalBounds(), resize_background_color_);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeViewHost::VisibilityChanged(View* starting_from, bool is_visible) {
|
|
|
|
diff --git ui/views/controls/native/native_view_host.h ui/views/controls/native/native_view_host.h
|
2019-09-04 17:13:32 +02:00
|
|
|
index 2a6cfc54d866..48623ab5d672 100644
|
2019-04-16 16:38:48 +02:00
|
|
|
--- ui/views/controls/native/native_view_host.h
|
|
|
|
+++ ui/views/controls/native/native_view_host.h
|
2019-09-04 17:13:32 +02:00
|
|
|
@@ -85,6 +85,12 @@ class VIEWS_EXPORT NativeViewHost : public View {
|
2019-04-16 16:38:48 +02:00
|
|
|
void set_fast_resize(bool fast_resize) { fast_resize_ = fast_resize; }
|
|
|
|
bool fast_resize() const { return fast_resize_; }
|
|
|
|
|
|
|
|
+ // Sets the color to paint the background during a resize that involves a
|
|
|
|
+ // clip. This is white by default.
|
|
|
|
+ void set_resize_background_color(SkColor resize_background_color) {
|
|
|
|
+ resize_background_color_ = resize_background_color;
|
|
|
|
+ }
|
|
|
|
+
|
2019-07-16 19:59:21 +02:00
|
|
|
gfx::NativeView native_view() const { return native_view_; }
|
|
|
|
|
|
|
|
void NativeViewDestroyed();
|
2019-09-04 17:13:32 +02:00
|
|
|
@@ -131,6 +137,9 @@ class VIEWS_EXPORT NativeViewHost : public View {
|
2019-07-16 19:59:21 +02:00
|
|
|
// in the setter/accessor above.
|
|
|
|
bool fast_resize_ = false;
|
2019-04-16 16:38:48 +02:00
|
|
|
|
|
|
|
+ // Color to paint in the background while resizing.
|
|
|
|
+ SkColor resize_background_color_ = SK_ColorWHITE;
|
|
|
|
+
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(NativeViewHost);
|
|
|
|
};
|
|
|
|
|
|
|
|
diff --git ui/views/controls/webview/webview.cc ui/views/controls/webview/webview.cc
|
2019-10-01 15:55:16 +02:00
|
|
|
index 982ab4872532..e24c59e4e363 100644
|
2019-04-16 16:38:48 +02:00
|
|
|
--- ui/views/controls/webview/webview.cc
|
|
|
|
+++ ui/views/controls/webview/webview.cc
|
2019-09-04 17:13:32 +02:00
|
|
|
@@ -112,6 +112,10 @@ void WebView::EnableSizingFromWebContents(const gfx::Size& min_size,
|
2019-04-16 16:38:48 +02:00
|
|
|
MaybeEnableAutoResize();
|
|
|
|
}
|
|
|
|
|
|
|
|
+void WebView::SetResizeBackgroundColor(SkColor resize_background_color) {
|
|
|
|
+ holder_->set_resize_background_color(resize_background_color);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void WebView::SetCrashedOverlayView(View* crashed_overlay_view) {
|
|
|
|
if (crashed_overlay_view_ == crashed_overlay_view)
|
|
|
|
return;
|
|
|
|
diff --git ui/views/controls/webview/webview.h ui/views/controls/webview/webview.h
|
2019-09-04 17:13:32 +02:00
|
|
|
index 9872ad3c2f42..d71c546d1a38 100644
|
2019-04-16 16:38:48 +02:00
|
|
|
--- ui/views/controls/webview/webview.h
|
|
|
|
+++ ui/views/controls/webview/webview.h
|
2019-09-04 17:13:32 +02:00
|
|
|
@@ -80,6 +80,10 @@ class WEBVIEW_EXPORT WebView : public View,
|
2019-04-16 16:38:48 +02:00
|
|
|
void EnableSizingFromWebContents(const gfx::Size& min_size,
|
|
|
|
const gfx::Size& max_size);
|
|
|
|
|
|
|
|
+ // Set the background color to use while resizing with a clip. This is white
|
|
|
|
+ // by default.
|
|
|
|
+ void SetResizeBackgroundColor(SkColor resize_background_color);
|
|
|
|
+
|
|
|
|
// If provided, this View will be shown in place of the web contents
|
|
|
|
// when the web contents is in a crashed state. This is cleared automatically
|
|
|
|
// if the web contents is changed.
|