Bug 803949: Do not draw anything for zero size images. r=roc
authorBas Schouten <bschouten@mozilla.com>
Tue, 23 Oct 2012 00:37:08 +0200
changeset 111218 c78126b314878b17affc0d25f4c152860a3f0149
parent 111217 f2686a2cd826699d16eef33fa11f810dfc4a08cb
child 111219 ccfda593ba944de08ce8224373e5b0c6e30b6d82
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersroc
bugs803949
milestone19.0a1
Bug 803949: Do not draw anything for zero size images. r=roc
layout/base/nsLayoutUtils.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3684,17 +3684,17 @@ ComputeSnappedImageDrawingParameters(gfx
                                      int32_t         aAppUnitsPerDevPixel,
                                      const nsRect    aDest,
                                      const nsRect    aFill,
                                      const nsPoint   aAnchor,
                                      const nsRect    aDirty,
                                      const nsIntSize aImageSize)
 
 {
-  if (aDest.IsEmpty() || aFill.IsEmpty())
+  if (aDest.IsEmpty() || aFill.IsEmpty() || !aImageSize.width || !aImageSize.height)
     return SnappedImageDrawingParameters();
 
   gfxRect devPixelDest =
     nsLayoutUtils::RectToGfxRect(aDest, aAppUnitsPerDevPixel);
   gfxRect devPixelFill =
     nsLayoutUtils::RectToGfxRect(aFill, aAppUnitsPerDevPixel);
   gfxRect devPixelDirty =
     nsLayoutUtils::RectToGfxRect(aDirty, aAppUnitsPerDevPixel);