Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1866)

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_views.cc

Issue 4319003: Replace TabContentsViewGtk with TabContentsViewViews as part of the ongoing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address final comments from reviewers Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f5cdaeb2cb2ca8278487b1b39c28decae5db288a..82e68e0fb794718de7134434a86e0433eb19a330 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc
@@ -22,6 +22,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"
@@ -137,7 +138,7 @@ void RenderWidgetHostViewViews::SetSize(const gfx::Size& size) {
if (requested_size_.width() != width ||
requested_size_.height() != height) {
requested_size_ = gfx::Size(width, height);
- SetBounds(x(), y(), requested_size_.width(), requested_size_.height());
+ SetBounds(gfx::Rect(x(), y(), width, height));
host_->WasResized();
}
}
@@ -279,7 +280,9 @@ BackingStore* RenderWidgetHostViewViews::AllocBackingStore(
}
gfx::NativeView RenderWidgetHostViewViews::native_view() const {
- return GetWidget()->GetNativeView();
+ if (GetWidget())
+ return GetWidget()->GetNativeView();
+ return NULL;
}
void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) {
@@ -288,6 +291,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);
+
// Don't do any painting if the GPU process is rendering directly
// into the View.
RenderWidgetHost* render_widget_host = GetRenderWidgetHost();
@@ -301,6 +314,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));
@@ -318,7 +334,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()));
} else {
// If the grey blend is showing, we make two drawing calls. Use double
@@ -500,7 +516,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();
}
@@ -508,7 +524,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

Powered by Google App Engine
This is Rietveld 408576698