diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index d7c63976b689..f9f51713621b 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -2020,6 +2020,20 @@ void nsWindow::SetTransparencyMode(nsTransparencyMode aMode) GetTopLevelWindow(PR_TRUE)->SetWindowTranslucencyInner(aMode); } +namespace { + BOOL CALLBACK AddClientAreaToRegion(HWND hWnd, LPARAM lParam) { + nsIntRegion *region = reinterpret_cast(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 @@ -2029,13 +2043,25 @@ void nsWindow::UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion, HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE); nsWindow* topWindow = GetNSWindowPtr(hWnd); + if (!mIsTopWidgetWindow) + return; + mPossiblyTransparentRegion.Sub(mPossiblyTransparentRegion, aDirtyRegion); mPossiblyTransparentRegion.Or(mPossiblyTransparentRegion, aPossiblyTransparentRegion); + nsIntRegion childWindowRegion; + + ::EnumChildWindows(mWnd, AddClientAreaToRegion, reinterpret_cast(&childWindowRegion)); + 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); MARGINS margins = { 0, 0, 0, 0 }; DWORD_PTR dwStyle = ::GetWindowLongPtrW(hWnd, GWL_STYLE); // If there is no opaque region or hidechrome=true then full glass