Bug 558627: Make sure areas hidden by the system clipping region and scrolled into view get invalidated. r=robarnold

This commit is contained in:
Bas Schouten 2010-06-17 21:08:32 +02:00
parent d7a8b09690
commit 6cbb15516e

View File

@ -2477,22 +2477,33 @@ nsWindow::Scroll(const nsIntPoint& aDelta,
w->Invalidate(PR_FALSE);
}
// Get the system clip twice, offset one by the delta. This will make
// systemClip contain the area of the systemClip, and movedSystemClip
// contain the area after scrolling that was covered by the systemClip.
HRGN systemClip = ::CreateRectRgn(0, 0, 0, 0);
HRGN movedSystemClip = ::CreateRectRgn(0, 0, 0, 0);
HDC dc = ::GetDC(mWnd);
::GetRandomRgn(dc, systemClip, SYSRGN);
::GetRandomRgn(dc, movedSystemClip, SYSRGN);
::OffsetRgn(movedSystemClip, aDelta.x, aDelta.y);
// RGN_DIFF will return the parts inside 'systemClip' but -not- inside
// movedSystemClip. This is the area that was clipped (and possibly not
// properly updated) before.
::CombineRgn(systemClip, systemClip, movedSystemClip, RGN_DIFF);
// The systemClip is in screen coordinates, we need client coordinates.
POINT p = { 0, 0 };
::ClientToScreen(mWnd, &p);
::OffsetRgn(systemClip, -p.x, -p.y);
::GetUpdateRgn(mWnd, updateRgn, FALSE);
::OffsetRgn(updateRgn, aDelta.x, aDelta.y);
::CombineRgn(updateRgn, updateRgn, systemClip, RGN_OR);
if (gfxPlatform::GetDPI() != 96 &&
aDelta.y < 0 &&
clip.bottom == (mBounds.y + mBounds.height)) {
// XXX - bug 548935 - we can at high DPI settings scroll an undrawn
// row of pixels into view. This row should be invalidated to make
// sure it contains the correct content.
HRGN scrollRgn = ::CreateRectRgn(clip.left,
clip.bottom + aDelta.y - 1,
clip.right,
clip.bottom + aDelta.y);
::CombineRgn(updateRgn, updateRgn, scrollRgn, RGN_OR);
::DeleteObject((HGDIOBJ)scrollRgn);
}
::DeleteObject((HGDIOBJ)systemClip);
::DeleteObject((HGDIOBJ)movedSystemClip);
::ReleaseDC(mWnd, dc);
} else {
#endif
::ScrollWindowEx(mWnd, aDelta.x, aDelta.y, &clip, &clip, updateRgn, NULL, flags);