diff --git ui/views/controls/native/native_view_host.cc ui/views/controls/native/native_view_host.cc index bc1cb3a9e6fc..f68bdeb8786c 100644 --- ui/views/controls/native/native_view_host.cc +++ ui/views/controls/native/native_view_host.cc @@ -151,7 +151,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 2a6cfc54d866..48623ab5d672 100644 --- ui/views/controls/native/native_view_host.h +++ ui/views/controls/native/native_view_host.h @@ -85,6 +85,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(); @@ -131,6 +137,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 982ab4872532..e24c59e4e363 100644 --- ui/views/controls/webview/webview.cc +++ ui/views/controls/webview/webview.cc @@ -112,6 +112,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 9872ad3c2f42..d71c546d1a38 100644 --- ui/views/controls/webview/webview.h +++ ui/views/controls/webview/webview.h @@ -80,6 +80,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.