Bug 1103157 (Part 1) - Add HAS_TRANSPARENCY and IS_ANIMATED imgIRequest flags. r=tn
authorSeth Fowler <seth@mozilla.com>
Mon, 24 Nov 2014 23:42:43 -0800
changeset 241755 eba0d88ca0f51d53b3d5da4930c9759d7e193c6b
parent 241754 5ff89c5a8393ea4e63dd23e3d8db52dcefef7429
child 241756 5a5ae0ef5714d58b8f7b05e95d561a7ca39f2515
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
bugs1103157
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 1103157 (Part 1) - Add HAS_TRANSPARENCY and IS_ANIMATED imgIRequest flags. r=tn
image/public/imgIRequest.idl
image/src/ProgressTracker.cpp
image/src/ProgressTracker.h
--- a/image/public/imgIRequest.idl
+++ b/image/public/imgIRequest.idl
@@ -14,17 +14,17 @@ interface nsIPrincipal;
 
 /**
  * imgIRequest interface
  *
  * @author Stuart Parmenter <stuart@mozilla.com>
  * @version 0.1
  * @see imagelib2
  */
-[scriptable, builtinclass, uuid(dc61f0ea-4139-4c2a-ae69-cec82d33e089)]
+[scriptable, builtinclass, uuid(83a7708b-5c35-409f-bab3-7fc08be6a264)]
 interface imgIRequest : nsIRequest
 {
   /**
    * the image container...
    * @return the image object associated with the request.
    * @attention NEED DOCS
    */
   readonly attribute imgIContainer image;
@@ -49,25 +49,31 @@ interface imgIRequest : nsIRequest
    *
    * STATUS_DECODE_STARTED: The decoding process has begun, but not yet
    * finished.
    *
    * STATUS_FRAME_COMPLETE: The first frame has been
    * completely decoded.
    *
    * STATUS_DECODE_COMPLETE: The whole image has been decoded.
+   *
+   * STATUS_IS_ANIMATED: The image is animated.
+   *
+   * STATUS_HAS_TRANSPARENCY: The image is partially or completely transparent.
    */
   //@{
   const long STATUS_NONE             = 0x0;
   const long STATUS_SIZE_AVAILABLE   = 0x1;
   const long STATUS_LOAD_COMPLETE    = 0x2;
   const long STATUS_ERROR            = 0x4;
   const long STATUS_DECODE_STARTED   = 0x8;
   const long STATUS_FRAME_COMPLETE   = 0x10;
   const long STATUS_DECODE_COMPLETE  = 0x20;
+  const long STATUS_IS_ANIMATED      = 0x40;
+  const long STATUS_HAS_TRANSPARENCY = 0x80;
   //@}
 
   /**
    * Status flags of the STATUS_* variety.
    */
   readonly attribute unsigned long imageStatus;
 
   /*
--- a/image/src/ProgressTracker.cpp
+++ b/image/src/ProgressTracker.cpp
@@ -147,16 +147,22 @@ ProgressTracker::GetImageStatus() const
     status |= imgIRequest::STATUS_DECODE_COMPLETE;
   }
   if (mProgress & FLAG_FRAME_COMPLETE) {
     status |= imgIRequest::STATUS_FRAME_COMPLETE;
   }
   if (mProgress & FLAG_LOAD_COMPLETE) {
     status |= imgIRequest::STATUS_LOAD_COMPLETE;
   }
+  if (mProgress & FLAG_IS_ANIMATED) {
+    status |= imgIRequest::STATUS_IS_ANIMATED;
+  }
+  if (mProgress & FLAG_HAS_TRANSPARENCY) {
+    status |= imgIRequest::STATUS_HAS_TRANSPARENCY;
+  }
   if (mProgress & FLAG_HAS_ERROR) {
     status |= imgIRequest::STATUS_ERROR;
   }
 
   return status;
 }
 
 // A helper class to allow us to call SyncNotify asynchronously.
--- a/image/src/ProgressTracker.h
+++ b/image/src/ProgressTracker.h
@@ -29,18 +29,18 @@ class Image;
 enum {
   FLAG_SIZE_AVAILABLE     = 1u << 0,  // STATUS_SIZE_AVAILABLE
   FLAG_DECODE_STARTED     = 1u << 1,  // STATUS_DECODE_STARTED
   FLAG_DECODE_COMPLETE    = 1u << 2,  // STATUS_DECODE_COMPLETE
   FLAG_FRAME_COMPLETE     = 1u << 3,  // STATUS_FRAME_COMPLETE
   FLAG_LOAD_COMPLETE      = 1u << 4,  // STATUS_LOAD_COMPLETE
   FLAG_ONLOAD_BLOCKED     = 1u << 5,
   FLAG_ONLOAD_UNBLOCKED   = 1u << 6,
-  FLAG_IS_ANIMATED        = 1u << 7,
-  FLAG_HAS_TRANSPARENCY   = 1u << 8,
+  FLAG_IS_ANIMATED        = 1u << 7,  // STATUS_IS_ANIMATED
+  FLAG_HAS_TRANSPARENCY   = 1u << 8,  // STATUS_HAS_TRANSPARENCY
   FLAG_IS_MULTIPART       = 1u << 9,
   FLAG_LAST_PART_COMPLETE = 1u << 10,
   FLAG_HAS_ERROR          = 1u << 11  // STATUS_ERROR
 };
 
 typedef uint32_t Progress;
 
 const uint32_t NoProgress = 0;