Bug 532404. If SW_SCROLLCHILDREN was used, invalidate the region in all descendant windows as well. r=jmathies

This commit is contained in:
Robert O'Callahan 2009-12-12 10:50:35 -08:00
parent 5c87a2d633
commit d949a0c5f6

View file

@ -2227,6 +2227,29 @@ HasDescendantWindowOutsideRect(DWORD aThisThreadID, HWND aWnd,
return PR_FALSE;
}
static void
InvalidateRgnInWindowSubtree(HWND aWnd, HRGN aRgn, HRGN aTmpRgn)
{
RECT clientRect;
::GetClientRect(aWnd, &clientRect);
::SetRectRgn(aTmpRgn, clientRect.left, clientRect.top,
clientRect.right, clientRect.bottom);
if (::CombineRgn(aTmpRgn, aTmpRgn, aRgn, RGN_AND) == NULLREGION) {
return;
}
::InvalidateRgn(aWnd, aTmpRgn, FALSE);
for (HWND child = ::GetWindow(aWnd, GW_CHILD); child;
child = ::GetWindow(child, GW_HWNDNEXT)) {
POINT pt = { 0, 0 };
::MapWindowPoints(child, aWnd, &pt, 1);
::OffsetRgn(aRgn, -pt.x, -pt.y);
InvalidateRgnInWindowSubtree(child, aRgn, aTmpRgn);
::OffsetRgn(aRgn, pt.x, pt.y);
}
}
void
nsWindow::Scroll(const nsIntPoint& aDelta,
const nsTArray<nsIntRect>& aDestRects,
@ -2362,7 +2385,11 @@ nsWindow::Scroll(const nsIntPoint& aDelta,
// it.
::SetRectRgn(destRgn, destRect.x, destRect.y, destRect.XMost(), destRect.YMost());
::CombineRgn(updateRgn, updateRgn, destRgn, RGN_AND);
::InvalidateRgn(mWnd, updateRgn, FALSE);
if (flags & SW_SCROLLCHILDREN) {
InvalidateRgnInWindowSubtree(mWnd, updateRgn, destRgn);
} else {
::InvalidateRgn(mWnd, updateRgn, FALSE);
}
}
::DeleteObject((HGDIOBJ)updateRgn);