Bug 510856. Round out 'visible area of moving content' to device pixel edges to avoid stray subpixel rectangles needing to be repainted. r=dbaron
authorRobert O'Callahan <robert@ocallahan.org>
Mon, 07 Sep 2009 12:35:12 +1200
changeset 32895 275cb46bca421be746e71b305f99b3e6b0571701
parent 32894 7494a97275dc55de9c6c57f0cc32acc4e8f68d46
child 32896 2b23795830c8e42ee414b55c4079169b133b209f
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs510856
milestone1.9.3a1pre
Bug 510856. Round out 'visible area of moving content' to device pixel edges to avoid stray subpixel rectangles needing to be repainted. r=dbaron
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -359,18 +359,21 @@ nsDisplayList::OptimizeVisibility(nsDisp
 
     nsIFrame* f = item->GetUnderlyingFrame();
     if (f && aBuilder->IsMovingFrame(f)) {
       if (movingContentAccumulatedBounds.IsEmpty()) {
         // *aVisibleRegion can only shrink during this loop, so storing
         // the first one we see is a sound overapproximation
         movingContentVisibleRegion = *aVisibleRegion;
       }
+      nscoord appUnitsPerPixel = f->PresContext()->AppUnitsPerDevPixel();
+      nsRect bounds = item->GetBounds(aBuilder).
+          ToOutsidePixels(appUnitsPerPixel).ToAppUnits(appUnitsPerPixel);
       movingContentAccumulatedBounds.UnionRect(movingContentAccumulatedBounds,
-                                               item->GetBounds(aBuilder));
+                                               bounds);
     }
     if (item->OptimizeVisibility(aBuilder, aVisibleRegion)) {
       AppendToBottom(item);
     } else {
       item->~nsDisplayItem();
     }
   }