From 83faf3da9b8ba721d34befd55368e69d0f398c80 Mon Sep 17 00:00:00 2001 From: "vangelis@chromium.org" Date: Fri, 25 Mar 2011 15:36:15 +0000 Subject: Defer hiding the compositor window until after the software view has repainted when switching from composited to non-composited mode to avoid flashing of stale content. R=jamesr@chromium.org, BUG=77126 Review URL: http://codereview.chromium.org/6676125 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79401 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/renderer_host/render_widget_host_view_win.cc | 8 +++++++- chrome/browser/renderer_host/render_widget_host_view_win.h | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'chrome') diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 21765a0..52ef7d2 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -217,6 +217,7 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) : render_widget_host_(widget), compositor_host_window_(NULL), + hide_compositor_window_at_next_paint_(false), track_mouse_leave_(false), ime_notification_(false), capture_enter_key_(false), @@ -851,6 +852,11 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { base::win::ScopedGDIObject damage_region(CreateRectRgn(0, 0, 0, 0)); GetUpdateRgn(damage_region, FALSE); + if (hide_compositor_window_at_next_paint_) { + ::ShowWindow(compositor_host_window_, SW_HIDE); + hide_compositor_window_at_next_paint_ = false; + } + CPaintDC paint_dc(m_hWnd); gfx::Rect damaged_rect(paint_dc.m_ps.rcPaint); @@ -1596,7 +1602,7 @@ void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) { SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); } } else { - ::ShowWindow(compositor_host_window_, SW_HIDE); + hide_compositor_window_at_next_paint_ = true; } } diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h index b441749..4399b8a 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.h +++ b/chrome/browser/renderer_host/render_widget_host_view_win.h @@ -278,6 +278,10 @@ class RenderWidgetHostViewWin // When we are doing accelerated compositing HWND compositor_host_window_; + // true if the compositor host window must be hidden after the + // software renderered view is updated. + bool hide_compositor_window_at_next_paint_; + // The cursor for the page. This is passed up from the renderer. WebCursor current_cursor_; -- cgit v1.1