Bug 617152. Part 11: Invalidate the ThebesLayers for an active-scroll-root using the scroll position at the last layer tree update, and do the rest of the invalidation using the current scroll position. r=tnikkel

This commit is contained in:
Robert O'Callahan 2010-12-20 14:37:43 +13:00
Родитель 5bd46f9928
Коммит 51861bf57a
1 изменённых файлов: 35 добавлений и 18 удалений

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

@ -190,26 +190,43 @@ nsHTMLScrollFrame::InvalidateInternal(const nsRect& aDamageRect,
{
if (aForChild) {
if (aForChild == mInner.mScrolledFrame) {
// restrict aDamageRect to the scrollable view's bounds
nsRect damage = aDamageRect + nsPoint(aX, aY);
// damage is now in our coordinate system, which means it was
// translated using the current scroll position. Adjust it to
// reflect the scroll position at last paint, since that's what
// the layer system wants us to invalidate.
damage += GetScrollPosition() - mInner.mScrollPosAtLastPaint;
nsRect r;
r.IntersectRect(damage, mInner.mScrollPort);
PRBool seperateThebes = IsScrollingActive() &&
!(aFlags & INVALIDATE_NO_THEBES_LAYERS) && r != damage;
if (seperateThebes) {
nsHTMLContainerFrame::InvalidateInternal(damage, 0, 0, aForChild,
aFlags | INVALIDATE_ONLY_THEBES_LAYERS);
// This is the damage rect that we're going to pass up to our parent.
nsRect parentDamage;
parentDamage.IntersectRect(damage, mInner.mScrollPort);
if (IsScrollingActive()) {
// This is the damage rect that we're going to pass up and
// only request invalidation of ThebesLayers for.
// damage is now in our coordinate system, which means it was
// translated using the current scroll position. Adjust it to
// reflect the scroll position at last paint, since that's what
// the ThebesLayers are currently set up for.
// This should not be clipped to the scrollport since ThebesLayers
// can contain content outside the scrollport that may need to be
// invalidated.
nsRect thebesLayerDamage = damage + GetScrollPosition() - mInner.mScrollPosAtLastPaint;
if (parentDamage == thebesLayerDamage) {
// This single call will take care of both rects
nsHTMLContainerFrame::InvalidateInternal(parentDamage, 0, 0, aForChild, aFlags);
} else {
// Invalidate rects separately
if (!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
nsHTMLContainerFrame::InvalidateInternal(thebesLayerDamage, 0, 0, aForChild,
aFlags | INVALIDATE_ONLY_THEBES_LAYERS);
}
if (!(aFlags & INVALIDATE_ONLY_THEBES_LAYERS) && !parentDamage.IsEmpty()) {
nsHTMLContainerFrame::InvalidateInternal(parentDamage, 0, 0, aForChild,
aFlags | INVALIDATE_NO_THEBES_LAYERS);
}
}
} else {
if (!parentDamage.IsEmpty()) {
nsHTMLContainerFrame::InvalidateInternal(parentDamage, 0, 0, aForChild, aFlags);
}
}
if (!r.IsEmpty()) {
nsHTMLContainerFrame::InvalidateInternal(r, 0, 0, aForChild,
aFlags | (seperateThebes ? INVALIDATE_NO_THEBES_LAYERS : 0));
}
if (mInner.mIsRoot && r != damage) {
if (mInner.mIsRoot && parentDamage != damage) {
// Make sure we notify our prescontext about invalidations outside
// viewport clipping.
// This is important for things that are snapshotting the viewport,