Chromium Code Reviews| Index: chrome/browser/renderer_host/render_widget_host_view_win.cc |
| 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 b8e12cf21d4bfb9c370c028ce619827c27d0f2cc..331080438c196e5c826ed282be267ca76cced963 100644 |
| --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc |
| +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc |
| @@ -70,6 +70,8 @@ const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND"; |
| namespace { |
| +const TCHAR* kRenderWidgetHVWPropStr = _T("RWHVW_P"); |
| + |
| // Tooltips will wrap after this width. Yes, wrap. Imagine that! |
| const int kTooltipMaxWidthPixels = 300; |
| @@ -834,14 +836,22 @@ void RenderWidgetHostViewWin::OnDestroy() { |
| void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { |
| DCHECK(render_widget_host_->process()->HasConnection()); |
| - // If the GPU process is rendering directly into the View, |
| - // call the compositor directly. |
| - RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); |
| - if (render_widget_host->is_accelerated_compositing_active()) { |
| + // If the GPU process is rendering directly into the View, compositing is |
| + // already triggered by damage to compositor_host_window_, so all we need to |
| + // do here is clear borders during resize. |
| + if (render_widget_host_ && |
| + render_widget_host_->is_accelerated_compositing_active()) { |
| // We initialize paint_dc here so that BeginPaint()/EndPaint() |
| // get called to validate the region. |
| CPaintDC paint_dc(m_hWnd); |
| - render_widget_host_->ScheduleComposite(); |
| + RECT host_rect, child_rect; |
| + GetClientRect(&host_rect); |
| + if (::GetClientRect(compositor_host_window_, &child_rect) && |
| + (child_rect.right < host_rect.right || |
| + child_rect.bottom < host_rect.bottom)) { |
| + paint_dc.FillRect(&host_rect, |
| + reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH))); |
| + } |
| return; |
| } |
| @@ -1479,6 +1489,11 @@ static void PaintCompositorHostWindow(HWND hWnd) { |
| PAINTSTRUCT paint; |
| BeginPaint(hWnd, &paint); |
| + RenderWidgetHostViewWin* win = static_cast<RenderWidgetHostViewWin*>( |
| + GetProp(hWnd, kRenderWidgetHVWPropStr)); |
| + // Trigger composite to rerender window. |
| + win->ScheduleComposite(); |
| + |
| EndPaint(hWnd, &paint); |
| } |
| @@ -1490,6 +1505,7 @@ static LRESULT CALLBACK CompositorHostWindowProc(HWND hWnd, UINT message, |
| case WM_ERASEBKGND: |
| return 0; |
| case WM_DESTROY: |
| + RemoveProp(hWnd, kRenderWidgetHVWPropStr); |
| return 0; |
| case WM_PAINT: |
| PaintCompositorHostWindow(hWnd); |
| @@ -1499,6 +1515,11 @@ static LRESULT CALLBACK CompositorHostWindowProc(HWND hWnd, UINT message, |
| } |
| } |
| +void RenderWidgetHostViewWin::ScheduleComposite() { |
| + if (render_widget_host_) |
| + render_widget_host_->ScheduleComposite(); |
| +} |
| + |
| // Creates a HWND within the RenderWidgetHostView that will serve as a host |
| // for a HWND that the GPU process will create. The host window is used |
| // to Z-position the GPU's window relative to other plugin windows. |
| @@ -1539,6 +1560,8 @@ gfx::PluginWindowHandle RenderWidgetHostViewWin::GetCompositingSurface() { |
| 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0); |
| ui::CheckWindowCreated(compositor_host_window_); |
| + SetProp(compositor_host_window_, kRenderWidgetHVWPropStr, this); |
|
Ben Goodger (Google)
2011/05/27 17:56:18
SetProp() can be problematic, and can lead to stra
jbates
2011/05/27 18:18:55
User data sounds good to me. You mean SetWindowLon
Ben Goodger (Google)
2011/05/27 18:20:15
Yes. There should be a win_util in base somewhere
jbates
2011/05/27 18:27:33
I don't see anything like that in win_util or base
Ben Goodger (Google)
2011/05/27 18:44:17
Ah it got migrated to src/ui. But you're in src/ch
jbates
2011/05/27 19:10:37
Done.
|
| + |
| return static_cast<gfx::PluginWindowHandle>(compositor_host_window_); |
| } |