Bug 550716. Snap layer bounds to nearest bpixels instead of outside pixels, to accurately reflect what we draw. r=mats
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 10 Mar 2010 13:15:22 +1300
changeset 39433 20a2dea77cd367a40a88412de9a1e55878219949
parent 39432 def0545f8384f175c938a5216b713cf3e50e0966
child 39434 723cdd01c7d6c41941928bc5fa9571a457884c16
push idunknown
push userunknown
push dateunknown
reviewersmats
bugs550716
milestone1.9.3a3pre
Bug 550716. Snap layer bounds to nearest bpixels instead of outside pixels, to accurately reflect what we draw. r=mats
layout/base/nsDisplayList.cpp
layout/reftests/bugs/550716-1-ref.html
layout/reftests/bugs/550716-1.html
layout/reftests/bugs/reftest.list
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -670,17 +670,17 @@ void nsDisplayList::BuildLayers(nsDispla
     }
 
     if (layerItems) {
       // Update the visible region of the layer to account for the new
       // item
       nscoord appUnitsPerDevPixel =
         item->GetUnderlyingFrame()->PresContext()->AppUnitsPerDevPixel();
       layerItems->mVisibleRect.UnionRect(layerItems->mVisibleRect,
-        item->mVisibleRect.ToOutsidePixels(appUnitsPerDevPixel));
+        item->mVisibleRect.ToNearestPixels(appUnitsPerDevPixel));
       layerItems->mLayer->SetVisibleRegion(nsIntRegion(layerItems->mVisibleRect));
     }
   }
 
   if (!firstThebesLayerItems->mStartItem) {
     // The first Thebes layer has nothing in it. Delete the layer.
     aLayers->RemoveElementAt(0);
   }
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/550716-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+  <div style="opacity:0.5; margin-top:101px; width:200px; height:100px; background:yellow;"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/550716-1.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+  <div style="opacity:0.5; margin-top:100.5px; width:200px; height:100px; background:yellow;"></div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1398,10 +1398,11 @@ fails HTTP(..) == 518172-2b.html 518172-
 == 539226-1.html about:blank
 == 539323-1.html 539323-1-ref.html
 == 539323-2.html 539323-2-ref.html
 == 539323-3.html 539323-3-ref.html
 == 542620-1.html 542620-1-ref.html
 == 541382-1.html 541382-1-ref.html
 == 541406-1.html 541406-1-ref.html
 == 546033-1.html 546033-1-ref.html
+== 550716-1.html 550716-1-ref.html
 == 549184-1.html 549184-1-ref.html
 == 546071-1.html 546071-1-ref.html