Bug 1192376: Make nsImageBoxFrame check whether image size is available before trying to paint an image. r=seth
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 29 Feb 2016 15:09:13 -0800
changeset 322516 25b27835c872681a8e97ba1ba27fd5e0acd398d8
parent 322515 be17cdb8e8e0b36e8433d9d14611f68444a337ab
child 322517 4ca277948a4200c5a49fac7563f1aee77caca071
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs1192376
milestone47.0a1
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 1192376: Make nsImageBoxFrame check whether image size is available before trying to paint an image. r=seth
layout/xul/nsImageBoxFrame.cpp
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -340,16 +340,23 @@ nsImageBoxFrame::PaintImage(nsRenderingC
 
   // don't draw if the image is not dirty
   // XXX(seth): Can this actually happen anymore?
   nsRect dirty;
   if (!dirty.IntersectRect(aDirtyRect, constraintRect)) {
     return DrawResult::TEMPORARY_ERROR;
   }
 
+  // Don't draw if the image's size isn't available.
+  uint32_t imgStatus;
+  if (!NS_SUCCEEDED(mImageRequest->GetImageStatus(&imgStatus)) ||
+      !(imgStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
+    return DrawResult::NOT_READY;
+  }
+
   nsCOMPtr<imgIContainer> imgCon;
   mImageRequest->GetImage(getter_AddRefs(imgCon));
 
   if (!imgCon) {
     return DrawResult::NOT_READY;
   }
 
   bool hasSubRect = !mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0);