Bug 505743. Fix nsHTMLScrollFrame::InvalidateInternal to not take the 'invalidation in scrollbar' path when there is no scrollbar. r=dbaron

--HG--
extra : rebase_source : 8709cdba8ea6f9776b61ff935c1c850573caff3a
This commit is contained in:
Robert O'Callahan 2009-07-27 09:29:01 +12:00
Родитель df568d1074
Коммит 96958ecaea
3 изменённых файлов: 59 добавлений и 31 удалений

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

@ -229,38 +229,40 @@ nsHTMLScrollFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
PRUint32 aFlags)
{
if (aForChild == mInner.mScrolledFrame) {
// restrict aDamageRect to the scrollable view's bounds
nsRect damage = aDamageRect + nsPoint(aX, aY);
nsRect r;
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;
} else if (aForChild == mInner.mHScrollbarBox) {
if (!mInner.mHasHorizontalScrollbar) {
// 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;
}
} else if (aForChild == mInner.mVScrollbarBox) {
if (!mInner.mHasVerticalScrollbar) {
// 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.
if (aForChild) {
if (aForChild == mInner.mScrolledFrame) {
// restrict aDamageRect to the scrollable view's bounds
nsRect damage = aDamageRect + nsPoint(aX, aY);
nsRect r;
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;
} else if (aForChild == mInner.mHScrollbarBox) {
if (!mInner.mHasHorizontalScrollbar) {
// 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;
}
} else if (aForChild == mInner.mVScrollbarBox) {
if (!mInner.mHasVerticalScrollbar) {
// 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;
}
}
}

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

@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<style>
#a {
display: block;
opacity:1;
overflow:hidden;
width: 100px;
height: 100px;
background-color: lime;
}
</style>
</head>
<body>
<span id="a"></span>
<script>
function doe() {
document.getElementById('a').style.opacity = '0';
document.documentElement.removeAttribute("class");
}
document.addEventListener("MozReftestInvalidate", doe, false);
</script>
</body>
</html>

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

@ -1282,3 +1282,4 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs
== 503364-1a.html 503364-1-ref.html
== 503364-1b.html 503364-1-ref.html
== 504032-1.html 504032-1-ref.html
== 505743-1.html about:blank