Bug 584841 patch 5: Rename imgContainer class to mozilla::imagelib::RasterImage. r=bholley a=blocking
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 13 Aug 2010 21:09:49 -0700
changeset 50549 0c6319c0168808e928cde09156d151d942ec50b1
parent 50548 9ecc5f41e0aa4f5f0044555f3fbeb9c4c382a15c
child 50550 20adb37475a5815223e442b76736c648548ff0d2
push id15072
push userdholbert@mozilla.com
push dateSat, 14 Aug 2010 04:11:44 +0000
treeherdermozilla-central@eccba2835f01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, blocking
bugs584841
milestone2.0b4pre
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 584841 patch 5: Rename imgContainer class to mozilla::imagelib::RasterImage. r=bholley a=blocking
modules/libpr0n/build/nsImageModule.cpp
modules/libpr0n/src/DiscardTracker.h
modules/libpr0n/src/imgContainer.cpp
modules/libpr0n/src/imgContainer.h
modules/libpr0n/src/imgLoader.cpp
modules/libpr0n/src/imgRequest.cpp
modules/libpr0n/src/imgTools.cpp
--- a/modules/libpr0n/build/nsImageModule.cpp
+++ b/modules/libpr0n/build/nsImageModule.cpp
@@ -94,18 +94,23 @@
 #include "nsPNGEncoder.h"
 #endif
 #ifdef IMG_BUILD_ENCODER_jpeg
 // jpeg
 #include "nsJPEGEncoder.h"
 #endif
 
 // objects that just require generic constructors
+namespace mozilla {
+namespace imagelib {
+NS_GENERIC_FACTORY_CONSTRUCTOR(RasterImage)
+}
+}
+using namespace mozilla::imagelib;
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(imgContainer)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(imgLoader, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(imgRequestProxy)
 NS_GENERIC_FACTORY_CONSTRUCTOR(imgTools)
 
 #ifdef IMG_BUILD_DECODER_gif
 // gif
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIFDecoder2)
 #endif
@@ -131,19 +136,19 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsIconDec
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGDecoder)
 #endif
 #ifdef IMG_BUILD_ENCODER_png
 // png
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGEncoder)
 #endif
 
 NS_DEFINE_NAMED_CID(NS_IMGLOADER_CID);
-NS_DEFINE_NAMED_CID(NS_IMGCONTAINER_CID);
 NS_DEFINE_NAMED_CID(NS_IMGREQUESTPROXY_CID);
 NS_DEFINE_NAMED_CID(NS_IMGTOOLS_CID);
+NS_DEFINE_NAMED_CID(NS_RASTERIMAGE_CID);
 #ifdef IMG_BUILD_DECODER_gif
 NS_DEFINE_NAMED_CID(NS_GIFDECODER2_CID);
 #endif
 #ifdef IMG_BUILD_DECODER_jpeg
 NS_DEFINE_NAMED_CID(NS_JPEGDECODER_CID);
 #endif
 #ifdef IMG_BUILD_ENCODER_jpeg
 NS_DEFINE_NAMED_CID(NS_JPEGENCODER_CID);
@@ -158,19 +163,19 @@ NS_DEFINE_NAMED_CID(NS_PNGDECODER_CID);
 #endif
 #ifdef IMG_BUILD_ENCODER_png
 NS_DEFINE_NAMED_CID(NS_PNGENCODER_CID);
 #endif
 
 
 static const mozilla::Module::CIDEntry kImageCIDs[] = {
   { &kNS_IMGLOADER_CID, false, NULL, imgLoaderConstructor, },
-  { &kNS_IMGCONTAINER_CID, false, NULL, imgContainerConstructor, },
   { &kNS_IMGREQUESTPROXY_CID, false, NULL, imgRequestProxyConstructor, },
   { &kNS_IMGTOOLS_CID, false, NULL, imgToolsConstructor, },
+  { &kNS_RASTERIMAGE_CID, false, NULL, RasterImageConstructor, },
 #ifdef IMG_BUILD_DECODER_gif
   { &kNS_GIFDECODER2_CID, false, NULL, nsGIFDecoder2Constructor, },
 #endif
 #ifdef IMG_BUILD_DECODER_jpeg
   { &kNS_JPEGDECODER_CID, false, NULL, nsJPEGDecoderConstructor, },
 #endif
 #ifdef IMG_BUILD_ENCODER_jpeg
   { &kNS_JPEGENCODER_CID, false, NULL, nsJPEGEncoderConstructor, },
@@ -186,20 +191,20 @@ static const mozilla::Module::CIDEntry k
 #ifdef IMG_BUILD_ENCODER_png
   { &kNS_PNGENCODER_CID, false, NULL, nsPNGEncoderConstructor, },
 #endif
   { NULL }
 };
 
 static const mozilla::Module::ContractIDEntry kImageContracts[] = {
   { "@mozilla.org/image/cache;1", &kNS_IMGLOADER_CID },
-  { "@mozilla.org/image/container;3", &kNS_IMGCONTAINER_CID },
   { "@mozilla.org/image/loader;1", &kNS_IMGLOADER_CID },
   { "@mozilla.org/image/request;1", &kNS_IMGREQUESTPROXY_CID },
   { "@mozilla.org/image/tools;1", &kNS_IMGTOOLS_CID },
+  { "@mozilla.org/image/rasterimage;1", &kNS_RASTERIMAGE_CID },
 #ifdef IMG_BUILD_DECODER_gif
   { "@mozilla.org/image/decoder;3?type=image/gif", &kNS_GIFDECODER2_CID },
 #endif
 #ifdef IMG_BUILD_DECODER_jpeg
   { "@mozilla.org/image/decoder;3?type=image/jpeg", &kNS_JPEGDECODER_CID },
   { "@mozilla.org/image/decoder;3?type=image/pjpeg", &kNS_JPEGDECODER_CID },
   { "@mozilla.org/image/decoder;3?type=image/jpg", &kNS_JPEGDECODER_CID },
 #endif
--- a/modules/libpr0n/src/DiscardTracker.h
+++ b/modules/libpr0n/src/DiscardTracker.h
@@ -35,38 +35,38 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_imagelib_DiscardTracker_h_
 #define mozilla_imagelib_DiscardTracker_h_
 
 #define DISCARD_TIMEOUT_PREF "image.mem.min_discard_timeout_ms"
 
-class imgContainer;
 class nsITimer;
 
 namespace mozilla {
 namespace imagelib {
+class RasterImage;
 
-// Struct to make an imgContainer insertable into the tracker list. This
-// is embedded within each imgContainer object, and we do 'this->curr = this'
-// on imgContainer construction. Thus, an imgContainer must always call
+// Struct to make a RasterImage insertable into the tracker list. This
+// is embedded within each RasterImage object, and we do 'this->curr = this'
+// on RasterImage construction. Thus, a RasterImage must always call
 // DiscardTracker::Remove() in its destructor to avoid having the tracker
 // point to bogus memory.
 struct DiscardTrackerNode
 {
-  // Pointer to the imgContainer that this node tracks
-  imgContainer *curr;
+  // Pointer to the RasterImage that this node tracks
+  RasterImage *curr;
 
   // Pointers to the previous and next nodes in the list
   DiscardTrackerNode *prev, *next;
 };
 
 /**
- * This static class maintains a linked list of imgContainer nodes. When Reset()
+ * This static class maintains a linked list of RasterImage nodes. When Reset()
  * is called, the node is removed from its position in the list (if it was there
  * before) and appended to the end. When Remove() is called, the node is removed
  * from the list. The timer fires once every MIN_DISCARD_TIMEOUT_MS ms. When it
  * does, it calls Discard() on each container preceding it, and then appends
  * itself to the end of the list. Thus, the discard timeout varies between
  * MIN_DISCARD_TIMEOUT_MS and 2*MIN_DISCARD_TIMEOUT_MS.
  */
 class DiscardTracker
--- a/modules/libpr0n/src/imgContainer.cpp
+++ b/modules/libpr0n/src/imgContainer.cpp
@@ -77,22 +77,22 @@ static PRLogModuleInfo *gCompressedImage
  * with spurious messages about NS_ENSURE_SUCCESS failures.
  *
  * 2) We want to set the internal error flag, shutdown properly,
  * and end up in an error state.
  *
  * So this macro should be called when the desired failure behavior
  * is to put the container into an error state and return failure.
  * It goes without saying that macro won't compile outside of a
- * non-static imgContainer method.
+ * non-static RasterImage method.
  */
 #define LOG_CONTAINER_ERROR                      \
   PR_BEGIN_MACRO                                 \
   PR_LOG (gImgLog, PR_LOG_ERROR,                 \
-          ("ImgContainer: [this=%p] Error "      \
+          ("RasterImage: [this=%p] Error "      \
            "detected at line %u for image of "   \
            "type %s\n", this, __LINE__,          \
            mSourceDataMimeType.get()));          \
   PR_END_MACRO
 
 #define CONTAINER_ENSURE_SUCCESS(status)      \
   PR_BEGIN_MACRO                              \
   nsresult _status = status; /* eval once */  \
@@ -130,21 +130,24 @@ DiscardingEnabled()
     inited = PR_TRUE;
 
     enabled = (PR_GetEnv("MOZ_DISABLE_IMAGE_DISCARD") == nsnull);
   }
 
   return enabled;
 }
 
-NS_IMPL_ISUPPORTS4(imgContainer, imgIContainer, nsITimerCallback, nsIProperties,
+namespace mozilla {
+namespace imagelib {
+
+NS_IMPL_ISUPPORTS4(RasterImage, imgIContainer, nsITimerCallback, nsIProperties,
                    nsISupportsWeakReference)
 
 //******************************************************************************
-imgContainer::imgContainer() :
+RasterImage::RasterImage() :
   mSize(0,0),
   mAnim(nsnull),
   mAnimationMode(kNormalAnimMode),
   mLoopCount(-1),
   mObserver(nsnull),
   mLockCount(0),
   mDecoder(nsnull),
   mWorker(nsnull),
@@ -165,31 +168,31 @@ imgContainer::imgContainer() :
   mDiscardTrackerNode.curr = this;
   mDiscardTrackerNode.prev = mDiscardTrackerNode.next = nsnull;
 
   // Statistics
   num_containers++;
 }
 
 //******************************************************************************
-imgContainer::~imgContainer()
+RasterImage::~RasterImage()
 {
   if (mAnim)
     delete mAnim;
 
   for (unsigned int i = 0; i < mFrames.Length(); ++i)
     delete mFrames[i];
 
   // Discardable statistics
   if (mDiscardable) {
     num_discardable_containers--;
     discardable_source_bytes -= mSourceData.Length();
 
     PR_LOG (gCompressedImageAccountingLog, PR_LOG_DEBUG,
-            ("CompressedImageAccounting: destroying imgContainer %p.  "
+            ("CompressedImageAccounting: destroying RasterImage %p.  "
              "Total Containers: %d, Discardable containers: %d, "
              "Total source bytes: %lld, Source bytes for discardable containers %lld",
              this,
              num_containers,
              num_discardable_containers,
              total_source_bytes,
              discardable_source_bytes));
   }
@@ -206,17 +209,17 @@ imgContainer::~imgContainer()
   // Total statistics
   num_containers--;
   total_source_bytes -= mSourceData.Length();
 }
 
 //******************************************************************************
 /* void init(in imgIDecoderObserver aObserver, in string aMimeType,
              in PRUint32 aFlags); */
-NS_IMETHODIMP imgContainer::Init(imgIDecoderObserver *aObserver,
+NS_IMETHODIMP RasterImage::Init(imgIDecoderObserver *aObserver,
                                  const char* aMimeType,
                                  PRUint32 aFlags)
 {
   // We don't support re-initialization
   if (mInitialized)
     return NS_ERROR_ILLEGAL_VALUE;
 
   // Not sure an error can happen before init, but be safe
@@ -270,17 +273,17 @@ NS_IMETHODIMP imgContainer::Init(imgIDec
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* [noscript] imgIContainer extractFrame(PRUint32 aWhichFrame,
  *                                       [const] in nsIntRect aRegion,
  *                                       in PRUint32 aFlags); */
-NS_IMETHODIMP imgContainer::ExtractFrame(PRUint32 aWhichFrame,
+NS_IMETHODIMP RasterImage::ExtractFrame(PRUint32 aWhichFrame,
                                          const nsIntRect &aRegion,
                                          PRUint32 aFlags,
                                          imgIContainer **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
 
   nsresult rv;
 
@@ -290,17 +293,17 @@ NS_IMETHODIMP imgContainer::ExtractFrame
   if (mError)
     return NS_ERROR_FAILURE;
 
   // Disallowed in the API
   if (mInDecoder && (aFlags & imgIContainer::FLAG_SYNC_DECODE))
     return NS_ERROR_FAILURE;
 
   // Make a new container. This should switch to another class with bug 505959.
-  nsRefPtr<imgContainer> img(new imgContainer());
+  nsRefPtr<RasterImage> img(new RasterImage());
   NS_ENSURE_TRUE(img, NS_ERROR_OUT_OF_MEMORY);
 
   // We don't actually have a mimetype in this case. The empty string tells the
   // init routine not to try to instantiate a decoder. This should be fixed in
   // bug 505959.
   img->Init(nsnull, "", INIT_FLAG_NONE);
   img->SetSize(aRegion.width, aRegion.height);
   img->mDecoded = PR_TRUE; // Also, we need to mark the image as decoded
@@ -343,86 +346,86 @@ NS_IMETHODIMP imgContainer::ExtractFrame
 
   *_retval = img.forget().get();
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* readonly attribute PRInt32 width; */
-NS_IMETHODIMP imgContainer::GetWidth(PRInt32 *aWidth)
+NS_IMETHODIMP RasterImage::GetWidth(PRInt32 *aWidth)
 {
   NS_ENSURE_ARG_POINTER(aWidth);
 
   if (mError)
     return NS_ERROR_FAILURE;
 
   *aWidth = mSize.width;
   return NS_OK;
 }
 
 //******************************************************************************
 /* readonly attribute PRInt32 height; */
-NS_IMETHODIMP imgContainer::GetHeight(PRInt32 *aHeight)
+NS_IMETHODIMP RasterImage::GetHeight(PRInt32 *aHeight)
 {
   NS_ENSURE_ARG_POINTER(aHeight);
 
   if (mError)
     return NS_ERROR_FAILURE;
 
   *aHeight = mSize.height;
   return NS_OK;
 }
 
-imgFrame *imgContainer::GetImgFrame(PRUint32 framenum)
+imgFrame *RasterImage::GetImgFrame(PRUint32 framenum)
 {
   nsresult rv = WantDecodedFrames();
   CONTAINER_ENSURE_TRUE(NS_SUCCEEDED(rv), nsnull);
 
   if (!mAnim) {
     NS_ASSERTION(framenum == 0, "Don't ask for a frame > 0 if we're not animated!");
     return mFrames.SafeElementAt(0, nsnull);
   }
   if (mAnim->lastCompositedFrameIndex == PRInt32(framenum))
     return mAnim->compositingFrame;
   return mFrames.SafeElementAt(framenum, nsnull);
 }
 
-imgFrame *imgContainer::GetDrawableImgFrame(PRUint32 framenum)
+imgFrame *RasterImage::GetDrawableImgFrame(PRUint32 framenum)
 {
   imgFrame *frame = GetImgFrame(framenum);
 
   // We will return a paletted frame if it's not marked as compositing failed
   // so we can catch crashes for reasons we haven't investigated.
   if (frame && frame->GetCompositingFailed())
     return nsnull;
   return frame;
 }
 
-PRUint32 imgContainer::GetCurrentImgFrameIndex() const
+PRUint32 RasterImage::GetCurrentImgFrameIndex() const
 {
   if (mAnim)
     return mAnim->currentAnimationFrameIndex;
 
   return 0;
 }
 
-imgFrame *imgContainer::GetCurrentImgFrame()
+imgFrame *RasterImage::GetCurrentImgFrame()
 {
   return GetImgFrame(GetCurrentImgFrameIndex());
 }
 
-imgFrame *imgContainer::GetCurrentDrawableImgFrame()
+imgFrame *RasterImage::GetCurrentDrawableImgFrame()
 {
   return GetDrawableImgFrame(GetCurrentImgFrameIndex());
 }
 
 //******************************************************************************
 /* readonly attribute boolean currentFrameIsOpaque; */
-NS_IMETHODIMP imgContainer::GetCurrentFrameIsOpaque(PRBool *aIsOpaque)
+NS_IMETHODIMP RasterImage::GetCurrentFrameIsOpaque(PRBool *aIsOpaque)
 {
   NS_ENSURE_ARG_POINTER(aIsOpaque);
 
   if (mError)
     return NS_ERROR_FAILURE;
 
   // See if we can get an image frame
   imgFrame *curframe = GetCurrentImgFrame();
@@ -441,17 +444,17 @@ NS_IMETHODIMP imgContainer::GetCurrentFr
     *aIsOpaque = *aIsOpaque && (framerect != nsIntRect(0, 0, mSize.width, mSize.height));
   }
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* [noscript] void getCurrentFrameRect(nsIntRect rect); */
-NS_IMETHODIMP imgContainer::GetCurrentFrameRect(nsIntRect &aRect)
+NS_IMETHODIMP RasterImage::GetCurrentFrameRect(nsIntRect &aRect)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // Get the current frame
   imgFrame *curframe = GetCurrentImgFrame();
 
   // If we have the frame, use that rectangle
@@ -468,45 +471,45 @@ NS_IMETHODIMP imgContainer::GetCurrentFr
     aRect.SizeTo(0, 0);
   }
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* readonly attribute unsigned long currentFrameIndex; */
-NS_IMETHODIMP imgContainer::GetCurrentFrameIndex(PRUint32 *aCurrentFrameIdx)
+NS_IMETHODIMP RasterImage::GetCurrentFrameIndex(PRUint32 *aCurrentFrameIdx)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aCurrentFrameIdx);
   
   *aCurrentFrameIdx = GetCurrentImgFrameIndex();
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* readonly attribute unsigned long numFrames; */
-NS_IMETHODIMP imgContainer::GetNumFrames(PRUint32 *aNumFrames)
+NS_IMETHODIMP RasterImage::GetNumFrames(PRUint32 *aNumFrames)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aNumFrames);
 
   *aNumFrames = mFrames.Length();
   
   return NS_OK;
 }
 
 //******************************************************************************
 /* readonly attribute boolean animated; */
-NS_IMETHODIMP imgContainer::GetAnimated(PRBool *aAnimated)
+NS_IMETHODIMP RasterImage::GetAnimated(PRBool *aAnimated)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aAnimated);
 
   // If we have mAnim, we can know for sure
   if (mAnim) {
@@ -524,17 +527,17 @@ NS_IMETHODIMP imgContainer::GetAnimated(
 
   return NS_OK;
 }
 
 
 //******************************************************************************
 /* [noscript] gfxImageSurface copyFrame(in PRUint32 aWhichFrame,
  *                                      in PRUint32 aFlags); */
-NS_IMETHODIMP imgContainer::CopyFrame(PRUint32 aWhichFrame,
+NS_IMETHODIMP RasterImage::CopyFrame(PRUint32 aWhichFrame,
                                       PRUint32 aFlags,
                                       gfxImageSurface **_retval)
 {
   if (aWhichFrame > FRAME_MAX_VALUE)
     return NS_ERROR_INVALID_ARG;
 
   if (mError)
     return NS_ERROR_FAILURE;
@@ -581,17 +584,17 @@ NS_IMETHODIMP imgContainer::CopyFrame(PR
 
   *_retval = imgsurface.forget().get();
   return NS_OK;
 }
 
 //******************************************************************************
 /* [noscript] gfxASurface getFrame(in PRUint32 aWhichFrame,
  *                                 in PRUint32 aFlags); */
-NS_IMETHODIMP imgContainer::GetFrame(PRUint32 aWhichFrame,
+NS_IMETHODIMP RasterImage::GetFrame(PRUint32 aWhichFrame,
                                      PRUint32 aFlags,
                                      gfxASurface **_retval)
 {
   if (aWhichFrame > FRAME_MAX_VALUE)
     return NS_ERROR_INVALID_ARG;
 
   if (mError)
     return NS_ERROR_FAILURE;
@@ -639,17 +642,17 @@ NS_IMETHODIMP imgContainer::GetFrame(PRU
 
   *_retval = framesurf.forget().get();
 
   return rv;
 }
 
 //******************************************************************************
 /* readonly attribute unsigned long dataSize; */
-NS_IMETHODIMP imgContainer::GetDataSize(PRUint32 *_retval)
+NS_IMETHODIMP RasterImage::GetDataSize(PRUint32 *_retval)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(_retval);
 
   // Start with 0
   *_retval = 0;
@@ -659,42 +662,42 @@ NS_IMETHODIMP imgContainer::GetDataSize(
   NS_ABORT_IF_FALSE(StoringSourceData() || (*_retval == 0),
                     "Non-zero source data size when we aren't storing it?");
 
   // Account for any uncompressed frames
   *_retval += GetDecodedDataSize();
   return NS_OK;
 }
 
-PRUint32 imgContainer::GetDecodedDataSize()
+PRUint32 RasterImage::GetDecodedDataSize()
 {
   PRUint32 val = 0;
   for (PRUint32 i = 0; i < mFrames.Length(); ++i) {
     imgFrame *frame = mFrames.SafeElementAt(i, nsnull);
     NS_ABORT_IF_FALSE(frame, "Null frame in frame array!");
     val += frame->EstimateMemoryUsed();
   }
 
   return val;
 }
 
-PRUint32 imgContainer::GetSourceDataSize()
+PRUint32 RasterImage::GetSourceDataSize()
 {
   return mSourceData.Length();
 }
 
-void imgContainer::DeleteImgFrame(PRUint32 framenum)
+void RasterImage::DeleteImgFrame(PRUint32 framenum)
 {
   NS_ABORT_IF_FALSE(framenum < mFrames.Length(), "Deleting invalid frame!");
 
   delete mFrames[framenum];
   mFrames[framenum] = nsnull;
 }
 
-nsresult imgContainer::InternalAddFrameHelper(PRUint32 framenum, imgFrame *aFrame,
+nsresult RasterImage::InternalAddFrameHelper(PRUint32 framenum, imgFrame *aFrame,
                                               PRUint8 **imageData, PRUint32 *imageLength,
                                               PRUint32 **paletteData, PRUint32 *paletteLength)
 {
   NS_ABORT_IF_FALSE(framenum <= mFrames.Length(), "Invalid frame index!");
   if (framenum > mFrames.Length())
     return NS_ERROR_INVALID_ARG;
 
   nsAutoPtr<imgFrame> frame(aFrame);
@@ -708,17 +711,17 @@ nsresult imgContainer::InternalAddFrameH
   // decoder->Write() call.
   frame->LockImageData();
 
   mFrames.InsertElementAt(framenum, frame.forget());
 
   return NS_OK;
 }
                                   
-nsresult imgContainer::InternalAddFrame(PRUint32 framenum,
+nsresult RasterImage::InternalAddFrame(PRUint32 framenum,
                                         PRInt32 aX, PRInt32 aY,
                                         PRInt32 aWidth, PRInt32 aHeight,
                                         gfxASurface::gfxImageFormat aFormat,
                                         PRUint8 aPaletteDepth,
                                         PRUint8 **imageData,
                                         PRUint32 *imageLength,
                                         PRUint32 **paletteData,
                                         PRUint32 *paletteLength)
@@ -779,17 +782,17 @@ nsresult imgContainer::InternalAddFrame(
   // because StartAnimation checks for > 1 frames
   if (mFrames.Length() == 2)
     StartAnimation();
   
   return rv;
 }
 
 /* [noscript] void appendFrame (in PRInt32 aX, in PRInt32 aY, in PRInt32 aWidth, in PRInt32 aHeight, in gfxImageFormat aFormat, [array, size_is (imageLength)] out PRUint8 imageData, out unsigned long imageLength); */
-NS_IMETHODIMP imgContainer::AppendFrame(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
+NS_IMETHODIMP RasterImage::AppendFrame(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
                                         PRInt32 aHeight, 
                                         gfxASurface::gfxImageFormat aFormat,
                                         PRUint8 **imageData,
                                         PRUint32 *imageLength)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
@@ -798,17 +801,17 @@ NS_IMETHODIMP imgContainer::AppendFrame(
 
   return InternalAddFrame(mFrames.Length(), aX, aY, aWidth, aHeight, aFormat, 
                           /* aPaletteDepth = */ 0, imageData, imageLength,
                           /* aPaletteData = */ nsnull, 
                           /* aPaletteLength = */ nsnull);
 }
 
 /* [noscript] void appendPalettedFrame (in PRInt32 aX, in PRInt32 aY, in PRInt32 aWidth, in PRInt32 aHeight, in gfxImageFormat aFormat, in PRUint8 aPaletteDepth, [array, size_is (imageLength)] out PRUint8 imageData, out unsigned long imageLength, [array, size_is (paletteLength)] out PRUint32 paletteData, out unsigned long paletteLength); */
-NS_IMETHODIMP imgContainer::AppendPalettedFrame(PRInt32 aX, PRInt32 aY,
+NS_IMETHODIMP RasterImage::AppendPalettedFrame(PRInt32 aX, PRInt32 aY,
                                                 PRInt32 aWidth, PRInt32 aHeight,
                                                 gfxASurface::gfxImageFormat aFormat,
                                                 PRUint8 aPaletteDepth,
                                                 PRUint8 **imageData,
                                                 PRUint32 *imageLength,
                                                 PRUint32 **paletteData,
                                                 PRUint32 *paletteLength)
 {
@@ -821,17 +824,17 @@ NS_IMETHODIMP imgContainer::AppendPalett
   NS_ENSURE_ARG_POINTER(paletteLength);
 
   return InternalAddFrame(mFrames.Length(), aX, aY, aWidth, aHeight, aFormat, 
                           aPaletteDepth, imageData, imageLength,
                           paletteData, paletteLength);
 }
 
 /*  [noscript] void setSize(in long aWidth, in long aHeight); */
-NS_IMETHODIMP imgContainer::SetSize(PRInt32 aWidth, PRInt32 aHeight)
+NS_IMETHODIMP RasterImage::SetSize(PRInt32 aWidth, PRInt32 aHeight)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // Ensure that we have positive values
   // XXX - Why isn't the size unsigned? Should this be changed?
   if ((aWidth < 0) || (aHeight < 0))
     return NS_ERROR_INVALID_ARG;
@@ -858,17 +861,17 @@ NS_IMETHODIMP imgContainer::SetSize(PRIn
 }
 
 /*  [noscript] void ensureCleanFrame(in unsigned long aFramenum, in PRInt32 aX, 
                                      in PRInt32 aY, in PRInt32 aWidth, 
                                      in PRInt32 aHeight, in gfxImageFormat aFormat, 
                                      [array, size_is(imageLength)]
                                        out PRUint8 imageData,
                                      out unsigned long imageLength); */
-NS_IMETHODIMP imgContainer::EnsureCleanFrame(PRUint32 aFrameNum, PRInt32 aX, PRInt32 aY,
+NS_IMETHODIMP RasterImage::EnsureCleanFrame(PRUint32 aFrameNum, PRInt32 aX, PRInt32 aY,
                                              PRInt32 aWidth, PRInt32 aHeight, 
                                              gfxASurface::gfxImageFormat aFormat,
                                              PRUint8 **imageData, PRUint32 *imageLength)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(imageData);
@@ -906,34 +909,34 @@ NS_IMETHODIMP imgContainer::EnsureCleanF
   frame->GetImageData(imageData, imageLength);
 
   return NS_OK;
 }
 
 
 //******************************************************************************
 /* void frameUpdated (in unsigned long framenumber, in nsIntRect rect); */
-NS_IMETHODIMP imgContainer::FrameUpdated(PRUint32 aFrameNum, nsIntRect &aUpdatedRect)
+NS_IMETHODIMP RasterImage::FrameUpdated(PRUint32 aFrameNum, nsIntRect &aUpdatedRect)
 {
   NS_ASSERTION(aFrameNum < mFrames.Length(), "Invalid frame index!");
   if (aFrameNum >= mFrames.Length())
     return NS_ERROR_INVALID_ARG;
 
   imgFrame *frame = GetImgFrame(aFrameNum);
   NS_ABORT_IF_FALSE(frame, "Calling FrameUpdated on frame that doesn't exist!");
   NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
 
   frame->ImageUpdated(aUpdatedRect);
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void setFrameDisposalMethod (in unsigned long framenumber, in PRInt32 aDisposalMethod); */
-NS_IMETHODIMP imgContainer::SetFrameDisposalMethod(PRUint32 aFrameNum, PRInt32 aDisposalMethod)
+NS_IMETHODIMP RasterImage::SetFrameDisposalMethod(PRUint32 aFrameNum, PRInt32 aDisposalMethod)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ABORT_IF_FALSE(aFrameNum < mFrames.Length(), "Invalid frame index!");
   if (aFrameNum >= mFrames.Length())
     return NS_ERROR_INVALID_ARG;
 
@@ -944,17 +947,17 @@ NS_IMETHODIMP imgContainer::SetFrameDisp
 
   frame->SetFrameDisposalMethod(aDisposalMethod);
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void setFrameTimeout (in unsigned long framenumber, in PRInt32 aTimeout); */
-NS_IMETHODIMP imgContainer::SetFrameTimeout(PRUint32 aFrameNum, PRInt32 aTimeout)
+NS_IMETHODIMP RasterImage::SetFrameTimeout(PRUint32 aFrameNum, PRInt32 aTimeout)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ABORT_IF_FALSE(aFrameNum < mFrames.Length(), "Invalid frame index!");
   if (aFrameNum >= mFrames.Length())
     return NS_ERROR_INVALID_ARG;
 
@@ -964,17 +967,17 @@ NS_IMETHODIMP imgContainer::SetFrameTime
 
   frame->SetTimeout(aTimeout);
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void setFrameBlendMethod (in unsigned long framenumber, in PRInt32 aBlendMethod); */
-NS_IMETHODIMP imgContainer::SetFrameBlendMethod(PRUint32 aFrameNum, PRInt32 aBlendMethod)
+NS_IMETHODIMP RasterImage::SetFrameBlendMethod(PRUint32 aFrameNum, PRInt32 aBlendMethod)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ABORT_IF_FALSE(aFrameNum < mFrames.Length(), "Invalid frame index!");
   if (aFrameNum >= mFrames.Length())
     return NS_ERROR_INVALID_ARG;
 
@@ -985,17 +988,17 @@ NS_IMETHODIMP imgContainer::SetFrameBlen
   frame->SetBlendMethod(aBlendMethod);
 
   return NS_OK;
 }
 
 
 //******************************************************************************
 /* void setFrameHasNoAlpha (in unsigned long framenumber); */
-NS_IMETHODIMP imgContainer::SetFrameHasNoAlpha(PRUint32 aFrameNum)
+NS_IMETHODIMP RasterImage::SetFrameHasNoAlpha(PRUint32 aFrameNum)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ABORT_IF_FALSE(aFrameNum < mFrames.Length(), "Invalid frame index!");
   if (aFrameNum >= mFrames.Length())
     return NS_ERROR_INVALID_ARG;
 
@@ -1005,32 +1008,32 @@ NS_IMETHODIMP imgContainer::SetFrameHasN
 
   frame->SetHasNoAlpha();
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void endFrameDecode (in unsigned long framenumber); */
-NS_IMETHODIMP imgContainer::EndFrameDecode(PRUint32 aFrameNum)
+NS_IMETHODIMP RasterImage::EndFrameDecode(PRUint32 aFrameNum)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // Assume there's another frame.
   // currentDecodingFrameIndex is 0 based, aFrameNum is 1 based
   if (mAnim)
     mAnim->currentDecodingFrameIndex = aFrameNum;
   
   return NS_OK;
 }
 
 //******************************************************************************
 /* void decodingComplete (); */
-NS_IMETHODIMP imgContainer::DecodingComplete(void)
+NS_IMETHODIMP RasterImage::DecodingComplete()
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // Flag that we're done decoding.
   // XXX - these should probably be combined when we fix animated image
   // discarding with bug 500402.
   mDecoded = PR_TRUE;
@@ -1058,30 +1061,30 @@ NS_IMETHODIMP imgContainer::DecodingComp
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* attribute unsigned short animationMode; */
-NS_IMETHODIMP imgContainer::GetAnimationMode(PRUint16 *aAnimationMode)
+NS_IMETHODIMP RasterImage::GetAnimationMode(PRUint16 *aAnimationMode)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aAnimationMode);
   
   *aAnimationMode = mAnimationMode;
   return NS_OK;
 }
 
 //******************************************************************************
 /* attribute unsigned short animationMode; */
-NS_IMETHODIMP imgContainer::SetAnimationMode(PRUint16 aAnimationMode)
+NS_IMETHODIMP RasterImage::SetAnimationMode(PRUint16 aAnimationMode)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ASSERTION(aAnimationMode == imgIContainer::kNormalAnimMode ||
                aAnimationMode == imgIContainer::kDontAnimMode ||
                aAnimationMode == imgIContainer::kLoopOnceAnimMode,
                "Wrong Animation Mode is being set!");
@@ -1101,17 +1104,17 @@ NS_IMETHODIMP imgContainer::SetAnimation
       break;
   }
   
   return NS_OK;
 }
 
 //******************************************************************************
 /* void startAnimation () */
-NS_IMETHODIMP imgContainer::StartAnimation()
+NS_IMETHODIMP RasterImage::StartAnimation()
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   if (mAnimationMode == kDontAnimMode || 
       (mAnim && (mAnim->timer || mAnim->animating)))
     return NS_OK;
   
@@ -1138,17 +1141,17 @@ NS_IMETHODIMP imgContainer::StartAnimati
                                    timeout, nsITimer::TYPE_REPEATING_SLACK);
   }
   
   return NS_OK;
 }
 
 //******************************************************************************
 /* void stopAnimation (); */
-NS_IMETHODIMP imgContainer::StopAnimation()
+NS_IMETHODIMP RasterImage::StopAnimation()
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   if (mAnim) {
     mAnim->animating = PR_FALSE;
 
     if (!mAnim->timer)
@@ -1158,17 +1161,17 @@ NS_IMETHODIMP imgContainer::StopAnimatio
     mAnim->timer = nsnull;
   }
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void resetAnimation (); */
-NS_IMETHODIMP imgContainer::ResetAnimation()
+NS_IMETHODIMP RasterImage::ResetAnimation()
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   if (mAnimationMode == kDontAnimMode || 
       !mAnim || mAnim->currentAnimationFrameIndex == 0)
     return NS_OK;
 
@@ -1192,57 +1195,57 @@ NS_IMETHODIMP imgContainer::ResetAnimati
 
   if (oldAnimating)
     return StartAnimation();
   return NS_OK;
 }
 
 //******************************************************************************
 /* attribute long loopCount; */
-NS_IMETHODIMP imgContainer::GetLoopCount(PRInt32 *aLoopCount)
+NS_IMETHODIMP RasterImage::GetLoopCount(PRInt32 *aLoopCount)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aLoopCount);
   
   *aLoopCount = mLoopCount;
   
   return NS_OK;
 }
 
 //******************************************************************************
 /* attribute long loopCount; */
-NS_IMETHODIMP imgContainer::SetLoopCount(PRInt32 aLoopCount)
+NS_IMETHODIMP RasterImage::SetLoopCount(PRInt32 aLoopCount)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // -1  infinite
   //  0  no looping, one iteration
   //  1  one loop, two iterations
   //  ...
   mLoopCount = aLoopCount;
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void addSourceData(in nsIInputStream aInputStream, in unsigned long aCount); */
-NS_IMETHODIMP imgContainer::AddSourceData(const char *aBuffer, PRUint32 aCount)
+NS_IMETHODIMP RasterImage::AddSourceData(const char *aBuffer, PRUint32 aCount)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aBuffer);
   nsresult rv = NS_OK;
 
   // We should not call this if we're not initialized
   NS_ABORT_IF_FALSE(mInitialized, "Calling AddSourceData() on uninitialized "
-                                  "imgContainer!");
+                                  "RasterImage!");
 
   // We should not call this if we're already finished adding source data
   NS_ABORT_IF_FALSE(!mHasSourceData, "Calling AddSourceData() after calling "
                                      "sourceDataComplete()!");
 
   // This call should come straight from necko - no reentrancy allowed
   NS_ABORT_IF_FALSE(!mInDecoder, "Re-entrant call to AddSourceData!");
 
@@ -1269,17 +1272,17 @@ NS_IMETHODIMP imgContainer::AddSourceDat
     }
   }
 
   // Statistics
   total_source_bytes += aCount;
   if (mDiscardable)
     discardable_source_bytes += aCount;
   PR_LOG (gCompressedImageAccountingLog, PR_LOG_DEBUG,
-          ("CompressedImageAccounting: Added compressed data to imgContainer %p (%s). "
+          ("CompressedImageAccounting: Added compressed data to RasterImage %p (%s). "
            "Total Containers: %d, Discardable containers: %d, "
            "Total source bytes: %lld, Source bytes for discardable containers %lld",
            this,
            mSourceDataMimeType.get(),
            num_containers,
            num_discardable_containers,
            total_source_bytes,
            discardable_source_bytes));
@@ -1303,17 +1306,17 @@ get_header_str (char *buf, char *data, P
     buf[i * 2 + 1] = hex[data[i] & 0x0f];
   }
 
   buf[i * 2] = 0;
 }
 
 //******************************************************************************
 /* void sourceDataComplete(); */
-NS_IMETHODIMP imgContainer::SourceDataComplete()
+NS_IMETHODIMP RasterImage::SourceDataComplete()
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // If we've been called before, ignore. Otherwise, flag that we have everything
   if (mHasSourceData)
     return NS_OK;
   mHasSourceData = PR_TRUE;
@@ -1345,17 +1348,17 @@ NS_IMETHODIMP imgContainer::SourceDataCo
   // Free up any extra space in the backing buffer
   mSourceData.Compact();
 
   // Log header information
   if (PR_LOG_TEST(gCompressedImageAccountingLog, PR_LOG_DEBUG)) {
     char buf[9];
     get_header_str(buf, mSourceData.Elements(), mSourceData.Length());
     PR_LOG (gCompressedImageAccountingLog, PR_LOG_DEBUG,
-            ("CompressedImageAccounting: imgContainer::SourceDataComplete() - data "
+            ("CompressedImageAccounting: RasterImage::SourceDataComplete() - data "
              "is done for container %p (%s) - header %p is 0x%s (length %d)",
              this,
              mSourceDataMimeType.get(),
              mSourceData.Elements(),
              buf,
              mSourceData.Length()));
   }
 
@@ -1364,17 +1367,17 @@ NS_IMETHODIMP imgContainer::SourceDataCo
     nsresult rv = DiscardTracker::Reset(&mDiscardTrackerNode);
     CONTAINER_ENSURE_SUCCESS(rv);
   }
   return NS_OK;
 }
 
 //******************************************************************************
 /* void newSourceData(); */
-NS_IMETHODIMP imgContainer::NewSourceData()
+NS_IMETHODIMP RasterImage::NewSourceData()
 {
   nsresult rv;
 
   if (mError)
     return NS_ERROR_FAILURE;
 
   // The source data should be complete before calling this
   NS_ABORT_IF_FALSE(mHasSourceData,
@@ -1409,32 +1412,32 @@ NS_IMETHODIMP imgContainer::NewSourceDat
   rv = InitDecoder(imgIDecoder::DECODER_FLAG_NONE);
   CONTAINER_ENSURE_SUCCESS(rv);
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void setSourceSizeHint(in unsigned long sizeHint); */
-NS_IMETHODIMP imgContainer::SetSourceSizeHint(PRUint32 sizeHint)
+NS_IMETHODIMP RasterImage::SetSourceSizeHint(PRUint32 sizeHint)
 {
   if (sizeHint && StoringSourceData())
     mSourceData.SetCapacity(sizeHint);
   return NS_OK;
 }
 
 //******************************************************************************
 /* void notify(in nsITimer timer); */
-NS_IMETHODIMP imgContainer::Notify(nsITimer *timer)
+NS_IMETHODIMP RasterImage::Notify(nsITimer *timer)
 {
   // This should never happen since the timer is only set up in StartAnimation()
   // after mAnim is checked to exist.
   NS_ENSURE_TRUE(mAnim, NS_ERROR_UNEXPECTED);
   NS_ASSERTION(mAnim->timer == timer,
-               "imgContainer::Notify() called with incorrect timer");
+               "RasterImage::Notify() called with incorrect timer");
 
   if (!mAnim->animating || !mAnim->timer)
     return NS_OK;
 
   nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
   if (!observer) {
     // the imgRequest that owns us is dead, we should die now too.
     StopAnimation();
@@ -1485,17 +1488,17 @@ NS_IMETHODIMP imgContainer::Notify(nsITi
   } else if (nextFrameIndex == mAnim->currentDecodingFrameIndex) {
     // Uh oh, the frame we want to show is currently being decoded (partial)
     // Wait a bit and try again
     mAnim->timer->SetDelay(100);
     return NS_OK;
   } else { //  (nextFrameIndex > currentDecodingFrameIndex)
     // We shouldn't get here. However, if we are requesting a frame
     // that hasn't been decoded yet, go back to the last frame decoded
-    NS_WARNING("imgContainer::Notify()  Frame is passed decoded frame");
+    NS_WARNING("RasterImage::Notify()  Frame is passed decoded frame");
     nextFrameIndex = mAnim->currentDecodingFrameIndex;
     if (!(nextFrame = mFrames[nextFrameIndex])) {
       // something wrong with the next frame, skip it
       mAnim->currentAnimationFrameIndex = nextFrameIndex;
       mAnim->timer->SetDelay(100);
       return NS_OK;
     }
     timeout = nextFrame->GetTimeout();
@@ -1516,17 +1519,17 @@ NS_IMETHODIMP imgContainer::Notify(nsITi
     imgFrame *prevFrame = mFrames[previousFrameIndex];
     if (!prevFrame)
       return NS_OK;
 
     // Change frame and announce it
     if (NS_FAILED(DoComposite(&frameToUse, &dirtyRect, prevFrame,
                               nextFrame, nextFrameIndex))) {
       // something went wrong, move on to next
-      NS_WARNING("imgContainer::Notify(): Composing Frame Failed\n");
+      NS_WARNING("RasterImage::Notify(): Composing Frame Failed\n");
       nextFrame->SetCompositingFailed(PR_TRUE);
       mAnim->currentAnimationFrameIndex = nextFrameIndex;
       return NS_OK;
     } else {
       nextFrame->SetCompositingFailed(PR_FALSE);
     }
   }
   // Set currentAnimationFrameIndex at the last possible moment
@@ -1535,17 +1538,17 @@ NS_IMETHODIMP imgContainer::Notify(nsITi
   observer->FrameChanged(this, &dirtyRect);
   
   return NS_OK;
 }
 
 //******************************************************************************
 // DoComposite gets called when the timer for animation get fired and we have to
 // update the composited frame of the animation.
-nsresult imgContainer::DoComposite(imgFrame** aFrameToUse,
+nsresult RasterImage::DoComposite(imgFrame** aFrameToUse,
                                    nsIntRect* aDirtyRect,
                                    imgFrame* aPrevFrame,
                                    imgFrame* aNextFrame,
                                    PRInt32 aNextFrameIndex)
 {
   NS_ENSURE_ARG_POINTER(aDirtyRect);
   NS_ENSURE_ARG_POINTER(aPrevFrame);
   NS_ENSURE_ARG_POINTER(aNextFrame);
@@ -1794,17 +1797,17 @@ nsresult imgContainer::DoComposite(imgFr
   mAnim->lastCompositedFrameIndex = aNextFrameIndex;
   *aFrameToUse = mAnim->compositingFrame;
 
   return NS_OK;
 }
 
 //******************************************************************************
 // Fill aFrame with black. Does also clears the mask.
-void imgContainer::ClearFrame(imgFrame *aFrame)
+void RasterImage::ClearFrame(imgFrame *aFrame)
 {
   if (!aFrame)
     return;
 
   nsresult rv = aFrame->LockImageData();
   if (NS_FAILED(rv))
     return;
 
@@ -1815,17 +1818,17 @@ void imgContainer::ClearFrame(imgFrame *
   gfxContext ctx(surf);
   ctx.SetOperator(gfxContext::OPERATOR_CLEAR);
   ctx.Paint();
 
   aFrame->UnlockImageData();
 }
 
 //******************************************************************************
-void imgContainer::ClearFrame(imgFrame *aFrame, nsIntRect &aRect)
+void RasterImage::ClearFrame(imgFrame *aFrame, nsIntRect &aRect)
 {
   if (!aFrame || aRect.width <= 0 || aRect.height <= 0)
     return;
 
   nsresult rv = aFrame->LockImageData();
   if (NS_FAILED(rv))
     return;
 
@@ -1840,17 +1843,17 @@ void imgContainer::ClearFrame(imgFrame *
 
   aFrame->UnlockImageData();
 }
 
 
 //******************************************************************************
 // Whether we succeed or fail will not cause a crash, and there's not much
 // we can do about a failure, so there we don't return a nsresult
-PRBool imgContainer::CopyFrameImage(imgFrame *aSrcFrame,
+PRBool RasterImage::CopyFrameImage(imgFrame *aSrcFrame,
                                     imgFrame *aDstFrame)
 {
   PRUint8* aDataSrc;
   PRUint8* aDataDest;
   PRUint32 aDataLengthSrc;
   PRUint32 aDataLengthDest;
 
   if (!aSrcFrame || !aDstFrame)
@@ -1874,49 +1877,49 @@ PRBool imgContainer::CopyFrameImage(imgF
 
 //******************************************************************************
 /* 
  * aSrc is the current frame being drawn,
  * aDst is the composition frame where the current frame is drawn into.
  * aSrcRect is the size of the current frame, and the position of that frame
  *          in the composition frame.
  */
-nsresult imgContainer::DrawFrameTo(imgFrame *aSrc,
+nsresult RasterImage::DrawFrameTo(imgFrame *aSrc,
                                    imgFrame *aDst, 
                                    nsIntRect& aSrcRect)
 {
   NS_ENSURE_ARG_POINTER(aSrc);
   NS_ENSURE_ARG_POINTER(aDst);
 
   nsIntRect dstRect = aDst->GetRect();
 
   // According to both AGIF and APNG specs, offsets are unsigned
   if (aSrcRect.x < 0 || aSrcRect.y < 0) {
-    NS_WARNING("imgContainer::DrawFrameTo: negative offsets not allowed");
+    NS_WARNING("RasterImage::DrawFrameTo: negative offsets not allowed");
     return NS_ERROR_FAILURE;
   }
   // Outside the destination frame, skip it
   if ((aSrcRect.x > dstRect.width) || (aSrcRect.y > dstRect.height)) {
     return NS_OK;
   }
 
   if (aSrc->GetIsPaletted()) {
     // Larger than the destination frame, clip it
     PRInt32 width = PR_MIN(aSrcRect.width, dstRect.width - aSrcRect.x);
     PRInt32 height = PR_MIN(aSrcRect.height, dstRect.height - aSrcRect.y);
 
     // The clipped image must now fully fit within destination image frame
     NS_ASSERTION((aSrcRect.x >= 0) && (aSrcRect.y >= 0) &&
                  (aSrcRect.x + width <= dstRect.width) &&
                  (aSrcRect.y + height <= dstRect.height),
-                "imgContainer::DrawFrameTo: Invalid aSrcRect");
+                "RasterImage::DrawFrameTo: Invalid aSrcRect");
 
     // clipped image size may be smaller than source, but not larger
     NS_ASSERTION((width <= aSrcRect.width) && (height <= aSrcRect.height),
-                 "imgContainer::DrawFrameTo: source must be smaller than dest");
+                 "RasterImage::DrawFrameTo: source must be smaller than dest");
 
     if (NS_FAILED(aDst->LockImageData()))
       return NS_ERROR_FAILURE;
 
     // Get pointers to image data
     PRUint32 size;
     PRUint8 *srcPixels;
     PRUint32 *colormap;
@@ -1982,61 +1985,61 @@ nsresult imgContainer::DrawFrameTo(imgFr
 
   aDst->UnlockImageData();
 
   return NS_OK;
 }
 
 
 /********* Methods to implement lazy allocation of nsIProperties object *************/
-NS_IMETHODIMP imgContainer::Get(const char *prop, const nsIID & iid, void * *result)
+NS_IMETHODIMP RasterImage::Get(const char *prop, const nsIID & iid, void * *result)
 {
   if (!mProperties)
     return NS_ERROR_FAILURE;
   return mProperties->Get(prop, iid, result);
 }
 
-NS_IMETHODIMP imgContainer::Set(const char *prop, nsISupports *value)
+NS_IMETHODIMP RasterImage::Set(const char *prop, nsISupports *value)
 {
   if (!mProperties)
     mProperties = do_CreateInstance("@mozilla.org/properties;1");
   if (!mProperties)
     return NS_ERROR_OUT_OF_MEMORY;
   return mProperties->Set(prop, value);
 }
 
-NS_IMETHODIMP imgContainer::Has(const char *prop, PRBool *_retval)
+NS_IMETHODIMP RasterImage::Has(const char *prop, PRBool *_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
   if (!mProperties) {
     *_retval = PR_FALSE;
     return NS_OK;
   }
   return mProperties->Has(prop, _retval);
 }
 
-NS_IMETHODIMP imgContainer::Undefine(const char *prop)
+NS_IMETHODIMP RasterImage::Undefine(const char *prop)
 {
   if (!mProperties)
     return NS_ERROR_FAILURE;
   return mProperties->Undefine(prop);
 }
 
-NS_IMETHODIMP imgContainer::GetKeys(PRUint32 *count, char ***keys)
+NS_IMETHODIMP RasterImage::GetKeys(PRUint32 *count, char ***keys)
 {
   if (!mProperties) {
     *count = 0;
     *keys = nsnull;
     return NS_OK;
   }
   return mProperties->GetKeys(count, keys);
 }
 
 void
-imgContainer::Discard()
+RasterImage::Discard()
 {
   // We should be ok for discard
   NS_ABORT_IF_FALSE(CanDiscard(), "Asked to discard but can't!");
 
   // We should never discard when we have an active decoder
   NS_ABORT_IF_FALSE(!mDecoder, "Asked to discard with open decoder!");
 
   // As soon as an image becomes animated, it becomes non-discardable and any
@@ -2057,58 +2060,58 @@ imgContainer::Discard()
   // Notify that we discarded
   nsCOMPtr<imgIDecoderObserver> observer(do_QueryReferent(mObserver));
   if (observer)
     observer->OnDiscard(nsnull);
 
   // Log
   PR_LOG(gCompressedImageAccountingLog, PR_LOG_DEBUG,
          ("CompressedImageAccounting: discarded uncompressed image "
-          "data from imgContainer %p (%s) - %d frames (cached count: %d); "
+          "data from RasterImage %p (%s) - %d frames (cached count: %d); "
           "Total Containers: %d, Discardable containers: %d, "
           "Total source bytes: %lld, Source bytes for discardable containers %lld",
           this,
           mSourceDataMimeType.get(),
           old_frame_count,
           mFrames.Length(),
           num_containers,
           num_discardable_containers,
           total_source_bytes,
           discardable_source_bytes));
 }
 
 // Helper method to determine if we can discard an image
 PRBool
-imgContainer::CanDiscard() {
+RasterImage::CanDiscard() {
   return (DiscardingEnabled() && // Globally enabled...
           mDiscardable &&        // ...Enabled at creation time...
           (mLockCount == 0) &&   // ...not temporarily disabled...
           mHasSourceData &&      // ...have the source data...
           mDecoded);             // ...and have something to discard.
 }
 
 // Helper method to tell us whether the clock is currently running for
 // discarding this image. Mainly for assertions.
 PRBool
-imgContainer::DiscardingActive() {
+RasterImage::DiscardingActive() {
   return !!(mDiscardTrackerNode.prev || mDiscardTrackerNode.next);
 }
 
 // Helper method to determine if we're storing the source data in a buffer
 // or just writing it directly to the decoder
 PRBool
-imgContainer::StoringSourceData() {
+RasterImage::StoringSourceData() {
   return (mDecodeOnDraw || mDiscardable);
 }
 
 
 // Sets up a decoder for this image. It is an error to call this function
 // when decoding is already in process (ie - when mDecoder is non-null).
 nsresult
-imgContainer::InitDecoder (PRUint32 dFlags)
+RasterImage::InitDecoder (PRUint32 dFlags)
 {
   // Ensure that the decoder is not already initialized
   NS_ABORT_IF_FALSE(!mDecoder, "Calling InitDecoder() while already decoding!");
   
   // We shouldn't be firing up a decoder if we already have the frames decoded
   NS_ABORT_IF_FALSE(!mDecoded, "Calling InitDecoder() but already decoded!");
 
   // Since we're not decoded, we should not have a discard timer active
@@ -2139,17 +2142,17 @@ imgContainer::InitDecoder (PRUint32 dFla
 // state. It is an error to call this function when there is no initialized
 // decoder.
 // 
 // aIntent specifies the intent of the shutdown. If aIntent is
 // eShutdownIntent_Done, an error is flagged if we didn't get what we should
 // have out of the decode. If aIntent is eShutdownIntent_Interrupted, we don't
 // check this. If aIntent is eShutdownIntent_Error, we shut down in error mode.
 nsresult
-imgContainer::ShutdownDecoder(eShutdownIntent aIntent)
+RasterImage::ShutdownDecoder(eShutdownIntent aIntent)
 {
   // Ensure that our intent is valid
   NS_ABORT_IF_FALSE((aIntent >= 0) || (aIntent < eShutdownIntent_AllCount),
                     "Invalid shutdown intent");
 
   // Ensure that the decoder is initialized
   NS_ABORT_IF_FALSE(mDecoder, "Calling ShutdownDecoder() with no active decoder!");
 
@@ -2207,17 +2210,17 @@ imgContainer::ShutdownDecoder(eShutdownI
   // Reset number of decoded bytes
   mBytesDecoded = 0;
 
   return NS_OK;
 }
 
 // Writes the data to the decoder, updating the total number of bytes written.
 nsresult
-imgContainer::WriteToDecoder(const char *aBuffer, PRUint32 aCount)
+RasterImage::WriteToDecoder(const char *aBuffer, PRUint32 aCount)
 {
   // We should have a decoder
   NS_ABORT_IF_FALSE(mDecoder, "Trying to write to null decoder!");
 
   // The decoder will start decoding into the current frame (if we have one).
   // When it needs to add another frame, we will unlock this frame and lock the
   // new frame.
   // Our invariant is that, while in the decoder, the last frame is always
@@ -2250,17 +2253,17 @@ imgContainer::WriteToDecoder(const char 
 
 // This function is called in situations where it's clear that we want the
 // frames in decoded form (Draw, GetFrame, CopyFrame, ExtractFrame, etc).
 // If we're completely decoded, this method resets the discard timer (if
 // we're discardable), since wanting the frames now is a good indicator of
 // wanting them again soon. If we're not decoded, this method kicks off
 // asynchronous decoding to generate the frames.
 nsresult
-imgContainer::WantDecodedFrames()
+RasterImage::WantDecodedFrames()
 {
   nsresult rv;
 
   // If we can discard, the clock should be running. Reset it.
   if (CanDiscard()) {
     NS_ABORT_IF_FALSE(DiscardingActive(),
                       "Decoded and discardable but discarding not activated!");
     rv = DiscardTracker::Reset(&mDiscardTrackerNode);
@@ -2269,17 +2272,17 @@ imgContainer::WantDecodedFrames()
 
   // Request a decode (no-op if we're decoded)
   return RequestDecode();
 }
 
 //******************************************************************************
 /* void requestDecode() */
 NS_IMETHODIMP
-imgContainer::RequestDecode()
+RasterImage::RequestDecode()
 {
   nsresult rv;
 
   if (mError)
     return NS_ERROR_FAILURE;
 
   // If we're not storing source data, we have nothing to do
   if (!StoringSourceData())
@@ -2331,17 +2334,17 @@ imgContainer::RequestDecode()
   // If we get this far, dispatch the worker. We do this instead of starting
   // any immediate decoding to guarantee that all our decode notifications are
   // dispatched asynchronously, and to ensure we stay responsive.
   return mWorker->Dispatch();
 }
 
 // Synchronously decodes as much data as possible
 nsresult
-imgContainer::SyncDecode()
+RasterImage::SyncDecode()
 {
   nsresult rv;
 
   // If we're decoded already, no worries
   if (mDecoded)
     return NS_OK;
 
   // If we're not storing source data, there isn't much to do here
@@ -2384,17 +2387,17 @@ imgContainer::SyncDecode()
 
 //******************************************************************************
 /* [noscript] void draw(in gfxContext aContext,
  *                      in gfxGraphicsFilter aFilter,
  *                      [const] in gfxMatrix aUserSpaceToImageSpace,
  *                      [const] in gfxRect aFill,
  *                      [const] in nsIntRect aSubimage,
  *                      in PRUint32 aFlags); */
-NS_IMETHODIMP imgContainer::Draw(gfxContext *aContext,
+NS_IMETHODIMP RasterImage::Draw(gfxContext *aContext,
                                  gfxPattern::GraphicsFilter aFilter,
                                  const gfxMatrix &aUserSpaceToImageSpace,
                                  const gfxRect &aFill,
                                  const nsIntRect &aSubimage,
                                  PRUint32 aFlags)
 {
   if (mError)
     return NS_ERROR_FAILURE;
@@ -2424,34 +2427,34 @@ NS_IMETHODIMP imgContainer::Draw(gfxCont
   frame->Draw(aContext, aFilter, aUserSpaceToImageSpace, aFill, padding, aSubimage);
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void lockImage() */
 NS_IMETHODIMP
-imgContainer::LockImage()
+RasterImage::LockImage()
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // Cancel the discard timer if it's there
   DiscardTracker::Remove(&mDiscardTrackerNode);
 
   // Increment the lock count
   mLockCount++;
 
   return NS_OK;
 }
 
 //******************************************************************************
 /* void unlockImage() */
 NS_IMETHODIMP
-imgContainer::UnlockImage()
+RasterImage::UnlockImage()
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   // It's an error to call this function if the lock count is 0
   NS_ABORT_IF_FALSE(mLockCount > 0,
                     "Calling UnlockImage with mLockCount == 0!");
   if (mLockCount == 0)
@@ -2469,17 +2472,17 @@ imgContainer::UnlockImage()
     CONTAINER_ENSURE_SUCCESS(rv);
   }
 
   return NS_OK;
 }
 
 // Flushes up to aMaxBytes to the decoder.
 nsresult
-imgContainer::DecodeSomeData (PRUint32 aMaxBytes)
+RasterImage::DecodeSomeData (PRUint32 aMaxBytes)
 {
   // We should have a decoder if we get here
   NS_ABORT_IF_FALSE(mDecoder, "trying to decode without decoder!");
 
   // If we have nothing to decode, return
   if (mBytesDecoded == mSourceData.Length())
     return NS_OK;
 
@@ -2490,17 +2493,17 @@ imgContainer::DecodeSomeData (PRUint32 a
   nsresult rv = WriteToDecoder(mSourceData.Elements() + mBytesDecoded,
                                bytesToDecode);
 
   return rv;
 }
 
 // There are various indicators that tell us we're finished with the decode
 // task at hand and can shut down the decoder.
-PRBool imgContainer::IsDecodeFinished()
+PRBool RasterImage::IsDecodeFinished()
 {
   // Assume it's not finished
   PRBool decodeFinished = PR_FALSE;
 
   // There shouldn't be any reason to call this if we're not storing
   // source data
   NS_ABORT_IF_FALSE(StoringSourceData(),
                     "just shut down on SourceDataComplete!");
@@ -2523,17 +2526,17 @@ PRBool imgContainer::IsDecodeFinished()
   if (mHasSourceData && (mBytesDecoded == mSourceData.Length()))
     decodeFinished = PR_TRUE;
 
   return decodeFinished;
 }
 
 // Indempotent error flagging routine. If a decoder is open,
 // sends OnStopContainer and OnStopDecode and shuts down the decoder
-void imgContainer::DoError()
+void RasterImage::DoError()
 {
   // If we've flagged an error before, we have nothing to do
   if (mError)
     return;
 
   // If we're mid-decode
   if (mDecoder) {
 
@@ -2568,17 +2571,17 @@ NS_IMETHODIMP imgDecodeWorker::Run()
 
   // If we shutdown the decoder in this function, we could lose ourselves
   nsCOMPtr<nsIRunnable> kungFuDeathGrip(this);
 
   // The container holds a strong reference to us. Cycles are bad.
   nsCOMPtr<imgIContainer> iContainer(do_QueryReferent(mContainer));
   if (!iContainer)
     return NS_OK;
-  imgContainer* container = static_cast<imgContainer*>(iContainer.get());
+  RasterImage* container = static_cast<RasterImage*>(iContainer.get());
 
   NS_ABORT_IF_FALSE(container->mInitialized,
                     "Worker active for uninitialized container!");
 
   // If we were pending, we're not anymore
   container->mWorkerPending = PR_FALSE;
 
   // If an error is flagged, it probably happened while we were waiting
@@ -2619,17 +2622,17 @@ NS_IMETHODIMP imgDecodeWorker::Run()
 
     // Figure out if we still have more data
     haveMoreData =
       container->mSourceData.Length() > container->mBytesDecoded;
   }
 
   // If the decode finished, shutdown the decoder
   if (container->IsDecodeFinished()) {
-    rv = container->ShutdownDecoder(imgContainer::eShutdownIntent_Done);
+    rv = container->ShutdownDecoder(RasterImage::eShutdownIntent_Done);
     if (NS_FAILED(rv)) {
       container->DoError();
       return rv;
     }
   }
 
   // If Conditions 1 & 2 are still true, then the only reason we bailed was
   // because we hit the deadline. Repost ourselves to the end of the event
@@ -2643,42 +2646,45 @@ NS_IMETHODIMP imgDecodeWorker::Run()
 
 // Queues the worker up at the end of the event queue
 NS_METHOD imgDecodeWorker::Dispatch()
 {
   // The container holds a strong reference to us. Cycles are bad.
   nsCOMPtr<imgIContainer> iContainer(do_QueryReferent(mContainer));
   if (!iContainer)
     return NS_OK;
-  imgContainer* container = static_cast<imgContainer*>(iContainer.get());
+  RasterImage* container = static_cast<RasterImage*>(iContainer.get());
 
   // We should not be called if there's already a pending worker
   NS_ABORT_IF_FALSE(!container->mWorkerPending,
                     "Trying to queue up worker with one already pending!");
 
   // Flag that we're pending
   container->mWorkerPending = PR_TRUE;
 
   // Dispatch
   return NS_DispatchToCurrentThread(this);
 }
 
 // nsIInputStream callback to copy the incoming image data directly to the 
-// container without processing. The imgContainer is passed as the closure.
+// container without processing. The RasterImage is passed as the closure.
 // Always reads everything it gets, even if the data is erroneous.
 NS_METHOD
-imgContainer::WriteToContainer(nsIInputStream* in, void* closure,
+RasterImage::WriteToContainer(nsIInputStream* in, void* closure,
                                const char* fromRawSegment, PRUint32 toOffset,
                                PRUint32 count, PRUint32 *writeCount)
 {
-  // Retrieve the imgContainer
-  imgIContainer *container = static_cast<imgIContainer*>(closure);
+  // Retrieve the RasterImage
+  RasterImage* container = static_cast<RasterImage*>(closure);
 
   // Copy the source data. We squelch the return value here, because returning
   // an error means that ReadSegments stops reading data, violating our
   // invariant that we read everything we get.
   (void) container->AddSourceData(fromRawSegment, count);
 
   // We wrote everything we got
   *writeCount = count;
 
   return NS_OK;
 }
+
+} // namespace imagelib
+} // namespace mozilla
--- a/modules/libpr0n/src/imgContainer.h
+++ b/modules/libpr0n/src/imgContainer.h
@@ -36,58 +36,58 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /** @file
- * This file declares the imgContainer class, which
- * handles static and animated image containers.
+ * This file declares the RasterImage class, which
+ * handles static and animated rasterized images.
  *
  * @author  Stuart Parmenter <pavlov@netscape.com>
  * @author  Chris Saari <saari@netscape.com>
  * @author  Arron Mogge <paper@animecity.nu>
  * @author  Andrew Smith <asmith15@learn.senecac.on.ca>
  */
 
-#ifndef __imgContainer_h__
-#define __imgContainer_h__
+#ifndef mozilla_imagelib_RasterImage_h_
+#define mozilla_imagelib_RasterImage_h_
 
 #include "Image.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "imgIContainer.h"
 #include "nsIProperties.h"
 #include "nsITimer.h"
 #include "nsWeakReference.h"
 #include "nsTArray.h"
 #include "imgFrame.h"
 #include "nsThreadUtils.h"
 #include "DiscardTracker.h"
 
 class imgIDecoder;
 class nsIInputStream;
 
-#define NS_IMGCONTAINER_CID \
+#define NS_RASTERIMAGE_CID \
 { /* 376ff2c1-9bf6-418a-b143-3340c00112f7 */         \
      0x376ff2c1,                                     \
      0x9bf6,                                         \
      0x418a,                                         \
     {0xb1, 0x43, 0x33, 0x40, 0xc0, 0x01, 0x12, 0xf7} \
 }
 
 /**
  * Handles static and animated image containers.
  *
  *
  * @par A Quick Walk Through
  * The decoder initializes this class and calls AppendFrame() to add a frame.
- * Once imgContainer detects more than one frame, it starts the animation
+ * Once RasterImage detects more than one frame, it starts the animation
  * with StartAnimation().
  *
  * @par
  * StartAnimation() checks if animating is allowed, and creates a timer.  The
  * timer calls Notify when the specified frame delay time is up.
  *
  * @par
  * Notify() moves on to the next frame, sets up the new timer delay, destroys
@@ -102,22 +102,22 @@ class nsIInputStream;
  * The basic path through DoComposite() is:
  * 1) Calculate Area that needs updating, which is at least the area of
  *    aNextFrame.
  * 2) Dispose of previous frame.
  * 3) Draw new image onto compositingFrame.
  * See comments in DoComposite() for more information and optimizations.
  *
  * @par
- * The rest of the imgContainer specific functions are used by DoComposite to
+ * The rest of the RasterImage specific functions are used by DoComposite to
  * destroy the old frame and build the new one.
  *
  * @note
  * <li> "Mask", "Alpha", and "Alpha Level" are interchangeable phrases in
- * respects to imgContainer.
+ * respects to RasterImage.
  *
  * @par
  * <li> GIFs never have more than a 1 bit alpha.
  * <li> APNGs may have a full alpha channel.
  *
  * @par
  * <li> Background color specified in GIF is ignored by web browsers.
  *
@@ -133,30 +133,35 @@ class nsIInputStream;
  * The mAnim structure has members only needed for animated images, so
  * it's not allocated until the second frame is added.
  *
  * @note
  * mAnimationMode, mLoopCount and mObserver are not in the mAnim structure
  * because the first two have public setters and the observer we only get
  * in Init().
  */
+
+namespace mozilla {
+namespace imagelib {
+
 class imgDecodeWorker;
-class imgContainer : public mozilla::imagelib::Image,
+
+class RasterImage : public mozilla::imagelib::Image,
                      public nsITimerCallback,
                      public nsIProperties,
                      public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_IMGICONTAINER
   NS_DECL_NSITIMERCALLBACK
   NS_DECL_NSIPROPERTIES
 
-  imgContainer();
-  virtual ~imgContainer();
+  RasterImage();
+  virtual ~RasterImage();
 
   static NS_METHOD WriteToContainer(nsIInputStream* in, void* closure,
                                     const char* fromRawSegment,
                                     PRUint32 toOffset, PRUint32 count,
                                     PRUint32 *writeCount);
 
   PRUint32 GetDecodedDataSize();
   PRUint32 GetSourceDataSize();
@@ -310,37 +315,37 @@ private: // data
   // memory, or we may be decoding on draw).
   nsTArray<imgFrame *>       mFrames;
   
   nsCOMPtr<nsIProperties>    mProperties;
 
   // IMPORTANT: if you use mAnim in a method, call EnsureImageIsDecoded() first to ensure
   // that the frames actually exist (they may have been discarded to save memory, or
   // we maybe decoding on draw).
-  imgContainer::Anim*        mAnim;
+  RasterImage::Anim*        mAnim;
   
   //! See imgIContainer for mode constants
   PRUint16                   mAnimationMode;
   
   //! # loops remaining before animation stops (-1 no stop)
   PRInt32                    mLoopCount;
   
   //! imgIDecoderObserver
   nsWeakPtr                  mObserver;
 
   // Discard members
   PRUint32                   mLockCount;
-  mozilla::imagelib::DiscardTrackerNode    mDiscardTrackerNode;
+  DiscardTrackerNode         mDiscardTrackerNode;
 
   // Source data members
   nsTArray<char>             mSourceData;
   nsCString                  mSourceDataMimeType;
 
   friend class imgDecodeWorker;
-  friend class mozilla::imagelib::DiscardTracker;
+  friend class DiscardTracker;
 
   // Decoder and friends
   nsCOMPtr<imgIDecoder>          mDecoder;
   nsRefPtr<imgDecodeWorker>      mWorker;
   PRUint32                       mBytesDecoded;
   PRUint32                       mDecoderFlags;
 
   // Boolean flags (clustered together to conserve space):
@@ -380,16 +385,18 @@ private: // data
   // Helpers
   void DoError();
   PRBool CanDiscard();
   PRBool DiscardingActive();
   PRBool StoringSourceData();
 
 };
 
+// XXXdholbert These helper classes should move to be inside the
+// scope of the RasterImage class.
 // Decoding Helper Class
 //
 // We use this class to mimic the interactivity benefits of threading
 // in a single-threaded event loop. We want to progressively decode
 // and keep a responsive UI while we're at it, so we have a runnable
 // class that does a bit of decoding, and then "yields" by dispatching
 // itself to the end of the event queue.
 class imgDecodeWorker : public nsRunnable
@@ -423,11 +430,12 @@ class imgDecodeRequestor : public nsRunn
         con->RequestDecode();
       return NS_OK;
     }
 
   private:
     nsWeakPtr mContainer;
 };
 
-
+} // namespace imagelib
+} // namespace mozilla
 
-#endif /* __imgContainer_h__ */
+#endif /* mozilla_imagelib_RasterImage_h_ */
--- a/modules/libpr0n/src/imgLoader.cpp
+++ b/modules/libpr0n/src/imgLoader.cpp
@@ -85,23 +85,26 @@
 // so we can associate the document URI with the load group.
 // until this point, we have an evil hack:
 #include "nsIHttpChannelInternal.h"  
 #include "nsIContentSecurityPolicy.h"
 #include "nsIChannelPolicy.h"
 
 #include "mozilla/FunctionTimer.h"
 
+using namespace mozilla::imagelib;
+
 #if defined(DEBUG_pavlov) || defined(DEBUG_timeless)
 #include "nsISimpleEnumerator.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsXPIDLString.h"
 #include "nsComponentManagerUtils.h"
 
+
 static void PrintImageDecoders()
 {
   nsCOMPtr<nsIComponentRegistrar> compMgr;
   if (NS_FAILED(NS_GetComponentRegistrar(getter_AddRefs(compMgr))) || !compMgr)
     return;
   nsCOMPtr<nsISimpleEnumerator> enumer;
   if (NS_FAILED(compMgr->EnumerateContractIDs(getter_AddRefs(enumer))) || !enumer)
     return;
@@ -217,24 +220,24 @@ public:
       if (entry->HasNoProxies())
         return PL_DHASH_NEXT;
     } else {
       if (!entry->HasNoProxies())
         return PL_DHASH_NEXT;
     }
 
     nsRefPtr<imgRequest> req = entry->GetRequest();
-    imgContainer *container = (imgContainer*) req->mImage.get();
-    if (!container)
+    RasterImage *image = static_cast<RasterImage*>(req->mImage.get());
+    if (!image)
       return PL_DHASH_NEXT;
 
     if (rtype & RAW_BIT) {
-      arg->value += container->GetSourceDataSize();
+      arg->value += image->GetSourceDataSize();
     } else {
-      arg->value += container->GetDecodedDataSize();
+      arg->value += image->GetDecodedDataSize();
     }
 
     return PL_DHASH_NEXT;
   }
 
   NS_IMETHOD GetMemoryUsed(PRInt64 *memoryUsed)
   {
     EnumArg arg(mType);
--- a/modules/libpr0n/src/imgRequest.cpp
+++ b/modules/libpr0n/src/imgRequest.cpp
@@ -197,17 +197,17 @@ nsresult imgRequest::Init(nsIURI *aURI,
 
   NS_ABORT_IF_FALSE(!mImage, "Multiple calls to init");
   NS_ABORT_IF_FALSE(aURI, "No uri");
   NS_ABORT_IF_FALSE(aKeyURI, "No key uri");
   NS_ABORT_IF_FALSE(aRequest, "No request");
   NS_ABORT_IF_FALSE(aChannel, "No channel");
 
   mProperties = do_CreateInstance("@mozilla.org/properties;1");
-  nsCOMPtr<imgIContainer> comImg = do_CreateInstance("@mozilla.org/image/container;3");
+  nsCOMPtr<imgIContainer> comImg = do_CreateInstance("@mozilla.org/image/rasterimage;1");
   mImage = static_cast<Image*>(comImg.get());
 
   mURI = aURI;
   mKeyURI = aKeyURI;
   mRequest = aRequest;
   mChannel = aChannel;
   mChannel->GetNotificationCallbacks(getter_AddRefs(mPrevChannelSink));
 
@@ -1047,17 +1047,17 @@ NS_IMETHODIMP imgRequest::OnDataAvailabl
     // If we were waiting on the image to do something, now's our chance.
     if (mDecodeRequested) {
       mImage->RequestDecode();
     }
   }
 
   // WriteToContainer always consumes everything it gets
   PRUint32 bytesRead;
-  rv = inStr->ReadSegments(imgContainer::WriteToContainer,
+  rv = inStr->ReadSegments(RasterImage::WriteToContainer,
                            static_cast<void*>(mImage),
                            count, &bytesRead);
   if (NS_FAILED(rv)) {
     PR_LOG(gImgLog, PR_LOG_WARNING,
            ("[this=%p] imgRequest::OnDataAvailable -- "
             "copy to container failed\n", this));
     this->Cancel(NS_IMAGELIB_ERROR_FAILURE);
     return NS_BINDING_ABORTED;
--- a/modules/libpr0n/src/imgTools.cpp
+++ b/modules/libpr0n/src/imgTools.cpp
@@ -49,16 +49,18 @@
 #include "nsStringStream.h"
 #include "nsComponentManagerUtils.h"
 #include "nsWeakReference.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsStreamUtils.h"
 #include "nsNetUtil.h"
 #include "imgContainer.h"
 
+using namespace mozilla::imagelib;
+
 /* ========== imgITools implementation ========== */
 
 
 
 NS_IMPL_ISUPPORTS1(imgTools, imgITools)
 
 imgTools::imgTools()
 {
@@ -75,17 +77,17 @@ NS_IMETHODIMP imgTools::DecodeImageData(
                                         const nsACString& aMimeType,
                                         imgIContainer **aContainer)
 {
   nsresult rv;
 
   NS_ENSURE_ARG_POINTER(aInStr);
   // If the caller didn't provide a container, create one
   if (!*aContainer) {
-    *aContainer = new imgContainer();
+    *aContainer = new RasterImage();
     if (!*aContainer)
       return NS_ERROR_OUT_OF_MEMORY;
     NS_ADDREF(*aContainer);
   }
 
   // Initialize the container. If we're using the one from the caller, we
   // require that it not be initialized
   nsCString mimeType(aMimeType);
@@ -103,17 +105,17 @@ NS_IMETHODIMP imgTools::DecodeImageData(
   // Figure out how much data we've been passed
   PRUint32 length;
   rv = inStream->Available(&length);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Send the source data to the container. WriteToContainer always
   // consumes everything it gets.
   PRUint32 bytesRead;
-  rv = inStream->ReadSegments(imgContainer::WriteToContainer,
+  rv = inStream->ReadSegments(RasterImage::WriteToContainer,
                               static_cast<void*>(*aContainer),
                               length, &bytesRead);
   NS_ENSURE_SUCCESS(rv, rv);
 
 
   // Let the container know we've sent all the data
   rv = (*aContainer)->SourceDataComplete();
   NS_ENSURE_SUCCESS(rv, rv);