Bug 1098958 - Call UpdateImageContainer whenever we send invalidations in RasterImage. r=tn
authorSeth Fowler <seth@mozilla.com>
Wed, 10 Dec 2014 19:35:15 -0800
changeset 219242 a5fcba591258d2e9d928d79dcfa7006d14b18275
parent 219241 bd3c5d90a40cf82afeb6dd08a8a3280b381da92a
child 219243 225f36741b2fc3aae6e63fc87a218b9eb60cdc93
push id10368
push userkwierso@gmail.com
push dateFri, 12 Dec 2014 01:38:39 +0000
treeherderfx-team@5288b15d22de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1098958
milestone37.0a1
Bug 1098958 - Call UpdateImageContainer whenever we send invalidations in RasterImage. r=tn
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -2674,23 +2674,25 @@ RasterImage::FinishedSomeDecoding(Shutdo
   mDecodingMonitor.AssertCurrentThreadIn();
 
   // Ensure that, if the decoder is the last reference to the image, we don't
   // destroy it by destroying the decoder.
   nsRefPtr<RasterImage> image(this);
 
   bool done = false;
   bool wasSize = false;
+  bool wasDefaultFlags = false;
   nsIntRect invalidRect;
   nsresult rv = NS_OK;
   Progress progress = aProgress;
 
   if (image->mDecoder) {
     invalidRect = image->mDecoder->TakeInvalidRect();
     progress |= image->mDecoder->TakeProgress();
+    wasDefaultFlags = image->mDecoder->GetDecodeFlags() == DECODE_FLAGS_DEFAULT;
 
     if (!image->mDecoder->IsSizeDecode() && image->mDecoder->ChunkCount()) {
       Telemetry::Accumulate(Telemetry::IMAGE_DECODE_CHUNKS,
                             image->mDecoder->ChunkCount());
     }
 
     if (!image->mHasSize && image->mDecoder->HasSize()) {
       image->mDecoder->SetSizeOnImage();
@@ -2739,16 +2741,20 @@ RasterImage::FinishedSomeDecoding(Shutdo
     // RequestRefresh take care of that.
     invalidRect = nsIntRect();
   }
   if (mHasBeenDecoded && !invalidRect.IsEmpty()) {
     // Don't send partial invalidations if we've been decoded before.
     invalidRect = mDecoded ? GetFirstFrameRect()
                            : nsIntRect();
   }
+  if (!invalidRect.IsEmpty() && wasDefaultFlags) {
+    // Update our image container since we're invalidating.
+    UpdateImageContainer();
+  }
 
   if (mNotifying) {
     // Accumulate the progress changes. We don't permit recursive notifications
     // because they cause subtle concurrency bugs, so we'll delay sending out
     // the notifications until we pop back to the lowest invocation of
     // FinishedSomeDecoding on the stack.
     mNotifyProgress |= progress;
     mNotifyInvalidRect.Union(invalidRect);