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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 7068029: Fix residue left over from find bar when using accelerated compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 827
828 CleanupCompositorWindow(); 828 CleanupCompositorWindow();
829 829
830 ResetTooltip(); 830 ResetTooltip();
831 TrackMouseLeave(false); 831 TrackMouseLeave(false);
832 } 832 }
833 833
834 void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { 834 void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) {
835 DCHECK(render_widget_host_->process()->HasConnection()); 835 DCHECK(render_widget_host_->process()->HasConnection());
836 836
837 // If the GPU process is rendering directly into the View, 837 // If the GPU process is rendering directly into the View, compositing is
838 // call the compositor directly. 838 // already triggered by damage to compositor_host_window_, so all we need to
839 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); 839 // do here is clear borders during resize.
840 if (render_widget_host->is_accelerated_compositing_active()) { 840 if (render_widget_host_ &&
841 render_widget_host_->is_accelerated_compositing_active()) {
841 // We initialize paint_dc here so that BeginPaint()/EndPaint() 842 // We initialize paint_dc here so that BeginPaint()/EndPaint()
842 // get called to validate the region. 843 // get called to validate the region.
843 CPaintDC paint_dc(m_hWnd); 844 CPaintDC paint_dc(m_hWnd);
844 render_widget_host_->ScheduleComposite(); 845 RECT host_rect, child_rect;
846 GetClientRect(&host_rect);
847 if (::GetClientRect(compositor_host_window_, &child_rect) &&
848 (child_rect.right < host_rect.right ||
849 child_rect.bottom < host_rect.bottom)) {
850 paint_dc.FillRect(&host_rect,
851 reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
852 }
845 return; 853 return;
846 } 854 }
847 855
848 about_to_validate_and_paint_ = true; 856 about_to_validate_and_paint_ = true;
849 BackingStoreWin* backing_store = static_cast<BackingStoreWin*>( 857 BackingStoreWin* backing_store = static_cast<BackingStoreWin*>(
850 render_widget_host_->GetBackingStore(true)); 858 render_widget_host_->GetBackingStore(true));
851 859
852 // We initialize |paint_dc| (and thus call BeginPaint()) after calling 860 // We initialize |paint_dc| (and thus call BeginPaint()) after calling
853 // GetBackingStore(), so that if it updates the invalid rect we'll catch the 861 // GetBackingStore(), so that if it updates the invalid rect we'll catch the
854 // changes and repaint them. 862 // changes and repaint them.
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 // If it was our RenderProcessHost that posted the notification, 1480 // If it was our RenderProcessHost that posted the notification,
1473 // clear the BrowserAccessibilityManager, because the renderer is 1481 // clear the BrowserAccessibilityManager, because the renderer is
1474 // dead and any accessibility information we have is now stale. 1482 // dead and any accessibility information we have is now stale.
1475 browser_accessibility_manager_.reset(NULL); 1483 browser_accessibility_manager_.reset(NULL);
1476 } 1484 }
1477 1485
1478 static void PaintCompositorHostWindow(HWND hWnd) { 1486 static void PaintCompositorHostWindow(HWND hWnd) {
1479 PAINTSTRUCT paint; 1487 PAINTSTRUCT paint;
1480 BeginPaint(hWnd, &paint); 1488 BeginPaint(hWnd, &paint);
1481 1489
1490 RenderWidgetHostViewWin* win = static_cast<RenderWidgetHostViewWin*>(
1491 ui::GetWindowUserData(hWnd));
1492 // Trigger composite to rerender window.
1493 if (win)
1494 win->ScheduleComposite();
1495
1482 EndPaint(hWnd, &paint); 1496 EndPaint(hWnd, &paint);
1483 } 1497 }
1484 1498
1485 // WndProc for the compositor host window. We use this instead of Default so 1499 // WndProc for the compositor host window. We use this instead of Default so
1486 // we can drop WM_PAINT and WM_ERASEBKGD messages on the floor. 1500 // we can drop WM_PAINT and WM_ERASEBKGD messages on the floor.
1487 static LRESULT CALLBACK CompositorHostWindowProc(HWND hWnd, UINT message, 1501 static LRESULT CALLBACK CompositorHostWindowProc(HWND hWnd, UINT message,
1488 WPARAM wParam, LPARAM lParam) { 1502 WPARAM wParam, LPARAM lParam) {
1489 switch (message) { 1503 switch (message) {
1490 case WM_ERASEBKGND: 1504 case WM_ERASEBKGND:
1491 return 0; 1505 return 0;
1492 case WM_DESTROY: 1506 case WM_DESTROY:
1507 ui::SetWindowUserData(hWnd, NULL);
1493 return 0; 1508 return 0;
1494 case WM_PAINT: 1509 case WM_PAINT:
1495 PaintCompositorHostWindow(hWnd); 1510 PaintCompositorHostWindow(hWnd);
1496 return 0; 1511 return 0;
1497 default: 1512 default:
1498 return DefWindowProc(hWnd, message, wParam, lParam); 1513 return DefWindowProc(hWnd, message, wParam, lParam);
1499 } 1514 }
1500 } 1515 }
1501 1516
1517 void RenderWidgetHostViewWin::ScheduleComposite() {
1518 if (render_widget_host_)
1519 render_widget_host_->ScheduleComposite();
1520 }
1521
1502 // Creates a HWND within the RenderWidgetHostView that will serve as a host 1522 // Creates a HWND within the RenderWidgetHostView that will serve as a host
1503 // for a HWND that the GPU process will create. The host window is used 1523 // for a HWND that the GPU process will create. The host window is used
1504 // to Z-position the GPU's window relative to other plugin windows. 1524 // to Z-position the GPU's window relative to other plugin windows.
1505 gfx::PluginWindowHandle RenderWidgetHostViewWin::GetCompositingSurface() { 1525 gfx::PluginWindowHandle RenderWidgetHostViewWin::GetCompositingSurface() {
1506 // If the window has been created, don't recreate it a second time 1526 // If the window has been created, don't recreate it a second time
1507 if (compositor_host_window_) 1527 if (compositor_host_window_)
1508 return compositor_host_window_; 1528 return compositor_host_window_;
1509 1529
1510 static ATOM window_class = 0; 1530 static ATOM window_class = 0;
1511 if (!window_class) { 1531 if (!window_class) {
(...skipping 20 matching lines...) Expand all
1532 int width = currentRect.right - currentRect.left; 1552 int width = currentRect.right - currentRect.left;
1533 int height = currentRect.bottom - currentRect.top; 1553 int height = currentRect.bottom - currentRect.top;
1534 1554
1535 compositor_host_window_ = CreateWindowEx( 1555 compositor_host_window_ = CreateWindowEx(
1536 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, 1556 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
1537 MAKEINTATOM(window_class), 0, 1557 MAKEINTATOM(window_class), 0,
1538 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED, 1558 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED,
1539 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0); 1559 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0);
1540 ui::CheckWindowCreated(compositor_host_window_); 1560 ui::CheckWindowCreated(compositor_host_window_);
1541 1561
1562 ui::SetWindowUserData(compositor_host_window_, this);
1563
1542 return static_cast<gfx::PluginWindowHandle>(compositor_host_window_); 1564 return static_cast<gfx::PluginWindowHandle>(compositor_host_window_);
1543 } 1565 }
1544 1566
1545 void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) { 1567 void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) {
1546 // When we first create the compositor, we will get a show request from 1568 // When we first create the compositor, we will get a show request from
1547 // the renderer before we have gotten the create request from the GPU. In this 1569 // the renderer before we have gotten the create request from the GPU. In this
1548 // case, simply ignore the show request. 1570 // case, simply ignore the show request.
1549 if (compositor_host_window_ == NULL) 1571 if (compositor_host_window_ == NULL)
1550 return; 1572 return;
1551 1573
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 } 1798 }
1777 1799
1778 // static 1800 // static
1779 RenderWidgetHostView* 1801 RenderWidgetHostView*
1780 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1802 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1781 gfx::NativeView native_view) { 1803 gfx::NativeView native_view) {
1782 return ::IsWindow(native_view) ? 1804 return ::IsWindow(native_view) ?
1783 reinterpret_cast<RenderWidgetHostView*>( 1805 reinterpret_cast<RenderWidgetHostView*>(
1784 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; 1806 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL;
1785 } 1807 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_win.h ('k') | content/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698