blob: f6d3fa7b52e8a12d07a58c375bc530dee33727cd [file] [log] [blame]
diff --git ui/views/controls/native/native_view_host.cc ui/views/controls/native/native_view_host.cc
index b29553ae8f7b..c31233db9ab2 100644
--- ui/views/controls/native/native_view_host.cc
+++ ui/views/controls/native/native_view_host.cc
@@ -154,7 +154,7 @@ void NativeViewHost::OnPaint(gfx::Canvas* canvas) {
// 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
index f92961e9f79b..f1ff80b244ef 100644
--- ui/views/controls/native/native_view_host.h
+++ ui/views/controls/native/native_view_host.h
@@ -86,6 +86,12 @@ class VIEWS_EXPORT NativeViewHost : public View {
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;
+ }
+
gfx::NativeView native_view() const { return native_view_; }
void NativeViewDestroyed();
@@ -132,6 +138,9 @@ class VIEWS_EXPORT NativeViewHost : public View {
// in the setter/accessor above.
bool fast_resize_ = false;
+ // 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
index 7bef84b8c9ea..9b9f0a789fe9 100644
--- ui/views/controls/webview/webview.cc
+++ ui/views/controls/webview/webview.cc
@@ -127,6 +127,10 @@ void WebView::EnableSizingFromWebContents(const gfx::Size& min_size,
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
index 84d5cd520f7a..c7a2c7644c4f 100644
--- ui/views/controls/webview/webview.h
+++ ui/views/controls/webview/webview.h
@@ -82,6 +82,10 @@ class WEBVIEW_EXPORT WebView : public View,
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.