Bug 564991. Part 43: Fix coordinates for invalidating fixed-attachment backgrounds. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 16 Jul 2010 09:08:12 +1200
changeset 47776 5b371eb4fa531d76a9348ed738e2a516423b7fce
parent 47775 aceb5233289a12223ccc27b3f4007512fd54fee6
child 47777 e1d7fd5255fdb9fe6fc6371c06f27b072ab23c15
push id14413
push userrocallahan@mozilla.com
push dateThu, 15 Jul 2010 21:12:02 +0000
treeherderautoland@e1d7fd5255fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs564991
milestone2.0b2pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 564991. Part 43: Fix coordinates for invalidating fixed-attachment backgrounds. r=tnikkel
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1549,22 +1549,24 @@ CanScrollWithBlitting(nsIFrame* aFrame, 
 static void
 InvalidateFixedBackgroundFramesFromList(nsDisplayListBuilder* aBuilder,
                                         const nsDisplayList& aList)
 {
   for (nsDisplayItem* item = aList.GetBottom(); item; item = item->GetAbove()) {
     nsDisplayList* sublist = item->GetList();
     if (sublist) {
       InvalidateFixedBackgroundFramesFromList(aBuilder, *sublist);
-    } else if (item->IsVaryingRelativeToMovingFrame(aBuilder)) {
+      continue;
+    }
+    nsIFrame* f = item->GetUnderlyingFrame();
+    if (f && aBuilder->IsMovingFrame(f) &&
+        item->IsVaryingRelativeToMovingFrame(aBuilder)) {
       if (item->IsFixedAndCoveringViewport(aBuilder)) {
         // FrameLayerBuilder takes care of scrolling these
       } else {
-        nsIFrame* f = item->GetUnderlyingFrame();
-        NS_ASSERTION(f, "No underlying frame for varying item?");
         f->Invalidate(item->GetVisibleRect() - aBuilder->ToReferenceFrame(f));
       }
     }
   }
 }
 
 static void
 InvalidateFixedBackgroundFrames(nsIFrame* aRootFrame,
@@ -1587,16 +1589,17 @@ InvalidateFixedBackgroundFrames(nsIFrame
   builder.LeavePresShell(aRootFrame, aUpdateRect);
   if (NS_FAILED(rv))
     return;
 
   nsRegion visibleRegion(aUpdateRect);
   list.ComputeVisibility(&builder, &visibleRegion, nsnull);
 
   InvalidateFixedBackgroundFramesFromList(&builder, list);
+  list.DeleteAll();
 }
 
 PRBool nsGfxScrollFrameInner::IsAlwaysActive() const
 {
   // The root scrollframe for a non-chrome document which is the direct
   // child of a chrome document is always treated as "active".
   // XXX maybe we should extend this so that IFRAMEs which are fill the
   // entire viewport (like GMail!) are always active
@@ -1643,17 +1646,17 @@ void nsGfxScrollFrameInner::ScrollVisual
     flags |= nsIFrame::INVALIDATE_NO_THEBES_LAYERS;
   }
   MarkActive();
   mOuter->InvalidateWithFlags(mScrollPort, flags);
 
   if (flags & nsIFrame::INVALIDATE_NO_THEBES_LAYERS) {
     // XXX fix this to transform rectangle properly
     InvalidateFixedBackgroundFrames(displayRoot, mScrolledFrame,
-                                    mScrolledFrame->GetRect() + mOuter->GetOffsetTo(displayRoot));
+      GetScrollPortRect() + mOuter->GetOffsetTo(displayRoot));
   }
 }
 
 static PRInt32
 ClampInt(nscoord aLower, nscoord aVal, nscoord aUpper, nscoord aAppUnitsPerPixel)
 {
   PRInt32 low = NSToIntCeil(float(aLower)/aAppUnitsPerPixel);
   PRInt32 high = NSToIntFloor(float(aUpper)/aAppUnitsPerPixel);