Bug 1103328 (Part 1) - Fire HAS_TRANSPARENCY for clear disposal methods. r=tn
authorSeth Fowler <seth@mozilla.com>
Mon, 24 Nov 2014 23:42:43 -0800
changeset 241749 9e4f24936bbac8d16af587d44e0ebb8daff8f970
parent 241640 4631a7474d8a15d4f645861660b0c61579e2a37a
child 241750 bec65d2426771c26658d7d2841d3b57d14b6e7bb
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1103328
milestone36.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 1103328 (Part 1) - Fire HAS_TRANSPARENCY for clear disposal methods. r=tn
image/decoders/nsGIFDecoder2.cpp
image/decoders/nsPNGDecoder.cpp
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -823,16 +823,28 @@ nsGIFDecoder2::WriteInternal(const char*
       mGIFStruct.is_transparent = *q & 0x1;
       mGIFStruct.tpixel = q[3];
       mGIFStruct.disposal_method = ((*q) >> 2) & 0x7;
       // Some specs say 3rd bit (value 4), other specs say value 3
       // Let's choose 3 (the more popular)
       if (mGIFStruct.disposal_method == 4) {
         mGIFStruct.disposal_method = 3;
       }
+
+      {
+        int32_t method =
+          FrameBlender::FrameDisposalMethod(mGIFStruct.disposal_method);
+        if (method == FrameBlender::kDisposeClearAll ||
+            method == FrameBlender::kDisposeClear) {
+          // We may have to display the background under this image during
+          // animation playback, so we regard it as transparent.
+          PostHasTransparency();
+        }
+      }
+
       mGIFStruct.delay_time = GETINT16(q + 1) * 10;
       GETN(1, gif_consume_block);
       break;
 
     case gif_comment_extension:
       if (*q) {
         GETN(*q, gif_consume_comment);
       } else {
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -171,16 +171,22 @@ void nsPNGDecoder::CreateFrame(png_uint_
          ("PNGDecoderAccounting: nsPNGDecoder::CreateFrame -- created "
           "image frame with %dx%d pixels in container %p",
           width, height,
           &mImage));
 
 #ifdef PNG_APNG_SUPPORTED
   if (png_get_valid(mPNG, mInfo, PNG_INFO_acTL)) {
     mAnimInfo = AnimFrameInfo(mPNG, mInfo);
+
+    if (mAnimInfo.mDispose == FrameBlender::kDisposeClear) {
+      // We may have to display the background under this image during
+      // animation playback, so we regard it as transparent.
+      PostHasTransparency();
+    }
   }
 #endif
 }
 
 // set timeout and frame disposal method for the current frame
 void
 nsPNGDecoder::EndImageFrame()
 {