From 9575e3b7b506cfc453b0e08ed8339549331142b3 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sun, 5 Dec 2010 15:02:17 +0000 Subject: [PATCH] Bug 590368. Pass SWP_NOCOPYBITS when moving a clipped plugin window with D3D9, to work around a Windows/driver bug. r=jmathies a=blocking --- widget/src/windows/nsWindow.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 6d8e0caa130..2fd8e108138 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -233,6 +233,7 @@ #include "nsIXULRuntime.h" using namespace mozilla::widget; +using namespace mozilla::layers; /************************************************************** ************************************************************** @@ -1392,8 +1393,19 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) } #endif ClearThemeRegion(); - VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0, - SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE)); + + UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE; + // Workaround SetWindowPos bug with D3D9. If our window has a clip + // region, some drivers or OSes may incorrectly copy into the clipped-out + // area. + if (mWindowType == eWindowType_plugin && + (!mLayerManager || mLayerManager->GetBackendType() == LayerManager::LAYERS_D3D9) && + mClipRects && + (mClipRectCount != 1 || mClipRects[0] != nsIntRect(0, 0, mBounds.width, mBounds.height))) { + flags |= SWP_NOCOPYBITS; + } + VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0, flags)); + SetThemeRegion(); } return NS_OK;