Bug 591558: Don't consider child windows in opaque area. r=roc a=blocking-beta5
authorBas Schouten <bschouten@mozilla.com>
Sat, 28 Aug 2010 07:51:17 +0000
changeset 51673 6e3f6d18c1243a33b336670088883585c93c5561
parent 51672 82e5ae3dc59b34fa943ec5e88a7dc44e2e2812a5
child 51674 4496d883d11333f8f149cc6a86ff44791de9369e
push idunknown
push userunknown
push dateunknown
reviewersroc, blocking-beta5
bugs591558
milestone2.0b5pre
first release with
nightly linux32
6e3f6d18c124 / 4.0b5pre / 20100828025638 / files
nightly linux64
6e3f6d18c124 / 4.0b5pre / 20100828030732 / files
nightly mac
6e3f6d18c124 / 4.0b5pre / 20100828030601 / files
nightly win32
6e3f6d18c124 / 4.0b5pre / 20100828040640 / files
nightly win64
6e3f6d18c124 / 4.0b5pre / 20100828040530 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 591558: Don't consider child windows in opaque area. r=roc a=blocking-beta5
widget/src/windows/nsWindow.cpp
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -2436,63 +2436,35 @@ nsTransparencyMode nsWindow::GetTranspar
   return GetTopLevelWindow(PR_TRUE)->GetWindowTranslucencyInner();
 }
 
 void nsWindow::SetTransparencyMode(nsTransparencyMode aMode)
 {
   GetTopLevelWindow(PR_TRUE)->SetWindowTranslucencyInner(aMode);
 }
 
-namespace {
-  BOOL CALLBACK AddClientAreaToRegion(HWND hWnd, LPARAM lParam) {
-    nsIntRegion *region = reinterpret_cast<nsIntRegion*>(lParam);
-
-    RECT clientRect;
-    ::GetWindowRect(hWnd, &clientRect);
-    nsIntRect clientArea(clientRect.left, clientRect.top,
-                         clientRect.right - clientRect.left,
-                         clientRect.bottom - clientRect.top);
-    region->Or(*region, clientArea);
-    return TRUE;
-  }
-}
-
 void nsWindow::UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion,
                                                const nsIntRegion &aPossiblyTransparentRegion) {
 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   if (!HasGlass())
     return;
 
   HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
   nsWindow* topWindow = GetNSWindowPtr(hWnd);
 
   if (GetParent())
     return;
 
   mPossiblyTransparentRegion.Sub(mPossiblyTransparentRegion, aDirtyRegion);
   mPossiblyTransparentRegion.Or(mPossiblyTransparentRegion, aPossiblyTransparentRegion);
 
-  nsIntRegion childWindowRegion;
-
-  ::EnumChildWindows(mWnd, AddClientAreaToRegion, reinterpret_cast<LPARAM>(&childWindowRegion));
-
-  nsIntPoint clientOffset = GetClientOffset();
-  childWindowRegion.MoveBy(-clientOffset);
-
-  RECT r;
-  ::GetWindowRect(mWnd, &r);
-  childWindowRegion.MoveBy(-r.left, -r.top);
-
   nsIntRect clientBounds;
   topWindow->GetClientBounds(clientBounds);
   nsIntRegion opaqueRegion;
   opaqueRegion.Sub(clientBounds, mPossiblyTransparentRegion);
-  opaqueRegion.Or(opaqueRegion, childWindowRegion);
-  // Sometimes child windows overlap our bounds
-  opaqueRegion.And(opaqueRegion, clientBounds);
  
   MARGINS margins = { 0, 0, 0, 0 };
   DWORD_PTR dwStyle = ::GetWindowLongPtrW(hWnd, GWL_STYLE);
 
   // If there is no opaque region or hidechrome=true, set margins
   // to support a full sheet of glass.
   if (opaqueRegion.IsEmpty() || mHideChrome) {
     // Comments in MSDN indicate all values must be set to -1