Bug 1098958 - Call UpdateImageContainer whenever we send invalidations in RasterImage. r=tn, a=sledru
authorSeth Fowler <seth@mozilla.com>
Wed, 10 Dec 2014 19:35:15 -0800
changeset 234312 1a0667f25ad2adb5bb91801989702e7f998e4a5b
parent 234311 5a92d53c1f10d7140e37d18cdc82335284ffec90
child 234313 6f4775cbadf11b277db466ff46464dd96289863a
push id7359
push userryanvm@gmail.com
push dateMon, 15 Dec 2014 17:06:30 +0000
treeherdermozilla-aurora@6f4775cbadf1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn, sledru
bugs1098958
milestone36.0a2
Bug 1098958 - Call UpdateImageContainer whenever we send invalidations in RasterImage. r=tn, a=sledru
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);