Bug 458407 - Content is blended when on top of a glass region of a window [r=roc]

This commit is contained in:
Rob Arnold 2010-03-25 20:30:00 -07:00
parent 810e83da79
commit 2d1f0ba03a

View file

@ -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<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
@ -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<LPARAM>(&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