Bug 500632. Suppress invalidation caused by parts inside collapsed scrollbars. r=dbaron

This commit is contained in:
Robert O'Callahan 2009-07-22 12:44:49 +12:00
Родитель 78c5a292a0
Коммит 309225cfa5
2 изменённых файлов: 38 добавлений и 18 удалений

Просмотреть файл

@ -229,27 +229,43 @@ nsHTMLScrollFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild, nscoord aX, nscoord aY, nsIFrame* aForChild,
PRUint32 aFlags) PRUint32 aFlags)
{ {
if (aForChild == mInner.mScrolledFrame && !(aFlags & INVALIDATE_NOTIFY_ONLY)) { if (aForChild == mInner.mScrolledFrame) {
// restrict aDamageRect to the scrollable view's bounds if (!(aFlags & INVALIDATE_NOTIFY_ONLY)) {
nsRect damage = aDamageRect + nsPoint(aX, aY); // restrict aDamageRect to the scrollable view's bounds
nsRect r; nsRect damage = aDamageRect + nsPoint(aX, aY);
if (r.IntersectRect(damage, mInner.mScrollableView->View()->GetBounds())) { nsRect r;
nsHTMLContainerFrame::InvalidateInternal(r, 0, 0, aForChild, aFlags); if (r.IntersectRect(damage, mInner.mScrollableView->View()->GetBounds())) {
nsHTMLContainerFrame::InvalidateInternal(r, 0, 0, aForChild, aFlags);
}
if (mInner.mIsRoot && r != damage) {
// Make sure we notify our prescontext about invalidations outside
// viewport clipping.
// This is important for things that are snapshotting the viewport,
// possibly outside the scrolled bounds.
// We don't need to propagate this any further up, though. Anyone who
// cares about scrolled-out-of-view invalidates had better be listening
// to our window directly.
PresContext()->NotifyInvalidation(damage,
(aFlags & INVALIDATE_CROSS_DOC) != 0);
}
return;
} }
if (mInner.mIsRoot && r != damage) { } else if (aForChild == mInner.mHScrollbarBox) {
// Make sure we notify our prescontext about invalidations outside if (!mInner.mHasHorizontalScrollbar) {
// viewport clipping. // Our scrollbars may send up invalidations even when they're collapsed,
// This is important for things that are snapshotting the viewport, // because we just size a collapsed scrollbar to empty and some
// possibly outside the scrolled bounds. // descendants may be non-empty. Suppress that invalidation here.
// We don't need to propagate this any further up, though. Anyone who return;
// cares about scrolled-out-of-view invalidates had better be listening }
// to our window directly. } else if (aForChild == mInner.mVScrollbarBox) {
PresContext()->NotifyInvalidation(damage, if (!mInner.mHasVerticalScrollbar) {
(aFlags & INVALIDATE_CROSS_DOC) != 0); // Our scrollbars may send up invalidations even when they're collapsed,
// because we just size a collapsed scrollbar to empty and some
// descendants may be non-empty. Suppress that invalidation here.
return;
} }
return;
} }
nsHTMLContainerFrame::InvalidateInternal(aDamageRect, aX, aY, aForChild, aFlags); nsHTMLContainerFrame::InvalidateInternal(aDamageRect, aX, aY, aForChild, aFlags);
} }

Просмотреть файл

@ -1757,6 +1757,10 @@ public:
* could cause frames to be deleted (including |this|). * could cause frames to be deleted (including |this|).
* @param aFlags INVALIDATE_CROSS_DOC: true if the invalidation * @param aFlags INVALIDATE_CROSS_DOC: true if the invalidation
* originated in a subdocument * originated in a subdocument
* @param aFlags INVALIDATE_NOTIFY_ONLY: set when this invalidation should
* cause MozAfterPaint listeners to be notified, but should not actually
* invalidate anything. This is used to notify about scrolling, where the
* screen has already been updated.
*/ */
enum { enum {
INVALIDATE_IMMEDIATE = 0x1, INVALIDATE_IMMEDIATE = 0x1,