Index: chrome/browser/renderer_host/render_widget_host_view_views.cc |
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc |
index c9e53da874bfb9a50cdd3fd8c3e6c4b4c76a4425..069c5e6dc8fb19745d077be021fab87c1c31a5d0 100644 |
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc |
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc |
@@ -24,6 +24,7 @@ |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/native_web_keyboard_event.h" |
#include "chrome/common/render_messages.h" |
+#include "gfx/canvas.h" |
#include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
#include "views/event.h" |
@@ -131,7 +132,7 @@ void RenderWidgetHostViewViews::SetSize(const gfx::Size& size) { |
if (requested_size_.width() != width || |
requested_size_.height() != height) { |
requested_size_ = gfx::Size(width, height); |
- SetBounds(GetViewBounds()); |
+ SetBounds(gfx::Rect(x(), y(), width, height)); |
host_->WasResized(); |
} |
} |
@@ -286,7 +287,9 @@ BackingStore* RenderWidgetHostViewViews::AllocBackingStore( |
} |
gfx::NativeView RenderWidgetHostViewViews::native_view() const { |
- return GetWidget()->GetNativeView(); |
+ if (GetWidget()) |
+ return GetWidget()->GetNativeView(); |
+ return NULL; |
} |
VideoLayer* RenderWidgetHostViewViews::AllocVideoLayer(const gfx::Size& size) { |
@@ -309,6 +312,16 @@ void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) { |
} |
void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) { |
+ if (is_hidden_) { |
+ return; |
+ } |
+ |
+ // Paint a "hole" in the canvas so that the render of the web page is on |
+ // top of whatever else has already been painted in the views hierarchy. |
+ // Later views might still get to paint on top. |
+ canvas->FillRectInt(SK_ColorBLACK, 0, 0, kMaxWindowWidth, kMaxWindowHeight, |
+ SkXfermode::kClear_Mode); |
+ |
if (enable_gpu_rendering_) { |
// When we're proxying painting, we don't actually display the web page |
// ourselves. |
@@ -333,6 +346,9 @@ void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) { |
// TODO(anicolao): get the damage somehow |
// invalid_rect_ = damage_rect; |
invalid_rect_ = bounds(); |
+ gfx::Point origin; |
+ ConvertPointToWidget(this, &origin); |
+ |
about_to_validate_and_paint_ = true; |
BackingStoreX* backing_store = static_cast<BackingStoreX*>( |
host_->GetBackingStore(true)); |
@@ -350,7 +366,7 @@ void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) { |
if (!visually_deemphasized_) { |
// In the common case, use XCopyArea. We don't draw more than once, so |
// we don't need to double buffer. |
- backing_store->XShowRect( |
+ backing_store->XShowRect(origin, |
paint_rect, x11_util::GetX11WindowFromGtkWidget(native_view())); |
// Paint the video layer using XCopyArea. |
@@ -530,7 +546,7 @@ void RenderWidgetHostViewViews::DidGainFocus() { |
void RenderWidgetHostViewViews::WillLoseFocus() { |
// If we are showing a context menu, maintain the illusion that webkit has |
// focus. |
- if (!is_showing_context_menu_) |
+ if (!is_showing_context_menu_ && !is_hidden_) |
GetRenderWidgetHost()->Blur(); |
} |
@@ -538,7 +554,7 @@ void RenderWidgetHostViewViews::WillLoseFocus() { |
void RenderWidgetHostViewViews::ShowCurrentCursor() { |
// The widget may not have a window. If that's the case, abort mission. This |
// is the same issue as that explained above in Paint(). |
- if (!native_view()->window) |
+ if (!native_view() || !native_view()->window) |
return; |
// TODO(anicolao): change to set cursors without GTK |