Bug 1224736: When image size lookup fails in nsTreeBodyFrame::PaintImage, only fall back to use the full destRect if we've got a VectorImage. r=tn a=ritu
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 11 Jan 2016 17:56:39 -0800
changeset 306017 94987e23aa720af290174d37d94e7bd2dc5c3dbb
parent 306014 40e457de9ce8b1a167caf74d9e464d1d51e4fda7
child 306018 6512ec26d8c1fe3c25dc9d4f1eee8687ce9b5110
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn, ritu
bugs1224736
milestone44.0
Bug 1224736: When image size lookup fails in nsTreeBodyFrame::PaintImage, only fall back to use the full destRect if we've got a VectorImage. r=tn a=ritu
layout/xul/tree/nsTreeBodyFrame.cpp
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -3628,18 +3628,27 @@ nsTreeBodyFrame::PaintImage(int32_t     
       // image by the cell width and height.
       nsSize rawImageSize(CSSPixel::ToAppUnits(rawImageCSSIntSize));
       wholeImageDest =
         nsLayoutUtils::GetWholeImageDestination(rawImageSize, sourceRect,
                                                 nsRect(destRect.TopLeft(),
                                                        imageDestSize));
     } else {
       // GetWidth/GetHeight failed, so we can't easily map a subregion of the
-      // source image onto the destination area. So, just draw the whole image.
-      wholeImageDest = destRect;
+      // source image onto the destination area.
+      // * If this happens with a RasterImage, it probably means the image is
+      // in an error state, and we shouldn't draw anything. Hence, we leave
+      // wholeImageDest as an empty rect (its initial state).
+      // * If this happens with a VectorImage, it probably means the image has
+      // no explicit width or height attribute -- but we can still proceed and
+      // just treat the destination area as our whole SVG image area. Hence, we
+      // set wholeImageDest to the full destRect.
+      if (image->GetType() == imgIContainer::TYPE_VECTOR) {
+        wholeImageDest = destRect;
+      }
     }
 
     gfxContext* ctx = aRenderingContext.ThebesContext();
     if (opacity != 1.0f) {
       ctx->PushGroup(gfxContentType::COLOR_ALPHA);
     }
 
     result &=