add stub for custom SVG imgIContainer implementation.
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 10 May 2010 16:26:09 -0700
changeset 1565 666b312593ec40fa36be974dd5108de6314388df
parent 1564 5e6ad66a2f960a196f7e33da34ee5d4f90b246d5
child 1566 cb78dd9fdfbac6edfc5c55869d3817518a7c9b06
push id1262
push userdholbert@mozilla.com
push dateMon, 10 May 2010 23:26:12 +0000
add stub for custom SVG imgIContainer implementation.
svg_images
--- a/svg_images
+++ b/svg_images
@@ -22,17 +22,35 @@ diff --git a/configure.in b/configure.in
  dnl SMIL
  dnl ========================================================
  MOZ_SMIL=1
  MOZ_ARG_DISABLE_BOOL(smil,
  [  --disable-smil           Disable SMIL animation support],
 diff --git a/modules/libpr0n/build/nsImageModule.cpp b/modules/libpr0n/build/nsImageModule.cpp
 --- a/modules/libpr0n/build/nsImageModule.cpp
 +++ b/modules/libpr0n/build/nsImageModule.cpp
-@@ -75,16 +75,21 @@
+@@ -49,16 +49,17 @@
+ #include "nsIDeviceContext.h"
+ #include "nsIGenericFactory.h"
+ #include "nsIModule.h"
+ #include "nsICategoryManager.h"
+ #include "nsXPCOMCID.h"
+ #include "nsServiceManagerUtils.h"
+ 
+ #include "imgContainer.h"
++#include "imgContainerSVG.h"
+ #include "imgLoader.h"
+ #include "imgRequest.h"
+ #include "imgRequestProxy.h"
+ #include "imgTools.h"
+ 
+ #ifdef IMG_BUILD_DECODER_gif
+ // gif
+ #include "nsGIFDecoder2.h"
+@@ -75,29 +76,35 @@
  #include "nsPNGDecoder.h"
  #endif
  
  #ifdef IMG_BUILD_DECODER_jpeg
  // jpeg
  #include "nsJPEGDecoder.h"
  #endif
  
@@ -44,17 +62,31 @@ diff --git a/modules/libpr0n/build/nsIma
  #ifdef IMG_BUILD_ENCODER_png
  // png
  #include "nsPNGEncoder.h"
  #endif
  #ifdef IMG_BUILD_ENCODER_jpeg
  // jpeg
  #include "nsJPEGEncoder.h"
  #endif
-@@ -120,16 +125,20 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBMPDeco
+ 
+ 
+ // objects that just require generic constructors
+ 
+ NS_GENERIC_FACTORY_CONSTRUCTOR(imgContainer)
++NS_GENERIC_FACTORY_CONSTRUCTOR(imgContainerSVG)
+ 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
+@@ -120,16 +127,20 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBMPDeco
  #ifdef IMG_BUILD_DECODER_png
  // png
  NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGDecoder)
  #endif
  #ifdef IMG_BUILD_ENCODER_png
  // png
  NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGEncoder)
  #endif
@@ -65,17 +97,17 @@ diff --git a/modules/libpr0n/build/nsIma
  
  static const char* gImageMimeTypes[] = {
  #ifdef IMG_BUILD_DECODER_gif
    "image/gif",
  #endif
  #ifdef IMG_BUILD_DECODER_jpeg
    "image/jpeg",
    "image/pjpeg",
-@@ -140,16 +149,19 @@ static const char* gImageMimeTypes[] = {
+@@ -140,16 +151,19 @@ static const char* gImageMimeTypes[] = {
    "image/vnd.microsoft.icon",
    "image/bmp",
    "image/x-ms-bmp",
  #endif
  #ifdef IMG_BUILD_DECODER_png
    "image/png",
    "image/x-png",
  #endif
@@ -85,17 +117,38 @@ diff --git a/modules/libpr0n/build/nsIma
  };
  
  static NS_METHOD ImageRegisterProc(nsIComponentManager *aCompMgr,
                                     nsIFile *aPath,
                                     const char *registryLocation,
                                     const char *componentType,
                                     const nsModuleComponentInfo *info) {
    nsresult rv;
-@@ -271,16 +283,23 @@ static const nsModuleComponentInfo compo
+@@ -187,16 +201,20 @@ static const nsModuleComponentInfo compo
+   { "image cache",
+     NS_IMGLOADER_CID,
+     "@mozilla.org/image/cache;1",
+     imgLoaderConstructor, },
+   { "image container",
+     NS_IMGCONTAINER_CID,
+     "@mozilla.org/image/container;3",
+     imgContainerConstructor, },
++  { "SVG image container",
++    NS_IMGCONTAINERSVG_CID,
++    "@mozilla.org/image/svgcontainer;1",
++    imgContainerSVGConstructor, },
+   { "image loader",
+     NS_IMGLOADER_CID,
+     "@mozilla.org/image/loader;1",
+     imgLoaderConstructor,
+     ImageRegisterProc, /* register the decoder mime types here */
+     ImageUnregisterProc, },
+   { "image request proxy",
+     NS_IMGREQUESTPROXY_CID,
+@@ -271,16 +289,23 @@ static const nsModuleComponentInfo compo
  #endif
  #ifdef IMG_BUILD_ENCODER_png
    // png
    { "PNG Encoder",
      NS_PNGENCODER_CID,
      "@mozilla.org/image/encoder;2?type=image/png",
      nsPNGEncoderConstructor, },
  #endif
@@ -413,8 +466,713 @@ new file mode 100644
 +  nsCOMPtr<imgIContainer> mImage;
 +  nsCOMPtr<imgIDecoderObserver> mObserver;
 +  PRUint32 mFlags;
 +
 +  PRBool mHaveWrittenData; // XXXdholbert DEBUG
 +};
 +
 +#endif //  NS_SVGDECODER_H_
+diff --git a/modules/libpr0n/src/Makefile.in b/modules/libpr0n/src/Makefile.in
+--- a/modules/libpr0n/src/Makefile.in
++++ b/modules/libpr0n/src/Makefile.in
+@@ -47,16 +47,17 @@ LIBRARY_NAME	= imglib2_s
+ FORCE_STATIC_LIB = 1
+ MODULE_NAME	= nsImageLib2Module
+ GRE_MODULE	= 1
+ LIBXUL_LIBRARY  = 1
+ 
+ 
+ CPPSRCS		= \
+ 			imgContainer.cpp \
++			imgContainerSVG.cpp \
+ 			imgFrame.cpp \
+ 			imgLoader.cpp    \
+ 			imgRequest.cpp   \
+ 			imgRequestProxy.cpp \
+ 			imgTools.cpp \
+ 			imgContainerRequest.cpp \
+ 			$(NULL)
+ 
+diff --git a/modules/libpr0n/src/imgContainerSVG.cpp b/modules/libpr0n/src/imgContainerSVG.cpp
+new file mode 100644
+--- /dev/null
++++ b/modules/libpr0n/src/imgContainerSVG.cpp
+@@ -0,0 +1,473 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* ***** BEGIN LICENSE BLOCK *****
++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
++ *
++ * The contents of this file are subject to the Mozilla Public License Version
++ * 1.1 (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS IS" basis,
++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++ * for the specific language governing rights and limitations under the
++ * License.
++ *
++ * The Original Code is the Mozilla SVG Module.
++ *
++ * The Initial Developer of the Original Code is
++ * the Mozilla Foundation.
++ * Portions created by the Initial Developer are Copyright (C) 2010
++ * the Initial Developer. All Rights Reserved.
++ *
++ * Contributor(s):
++ *
++ * Alternatively, the contents of this file may be used under the terms of
++ * either the GNU General Public License Version 2 or later (the "GPL"), or
++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++ * in which case the provisions of the GPL or the LGPL are applicable instead
++ * of those above. If you wish to allow use of your version of this file only
++ * under the terms of either the GPL or the LGPL, and not to allow others to
++ * use your version of this file under the terms of the MPL, indicate your
++ * 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 ***** */
++
++#include "imgContainerSVG.h"
++#include "gfxContext.h"
++
++NS_IMPL_ISUPPORTS1(imgContainerSVG, imgIContainer)
++
++imgContainerSVG::imgContainerSVG() :
++  mError(PR_FALSE)
++{
++}
++
++imgContainerSVG::~imgContainerSVG()
++{
++}
++
++//******************************************************************************
++/* void init(in imgIDecoderObserver aObserver, in string aMimeType,
++             in PRUint32 aFlags); */
++NS_IMETHODIMP imgContainerSVG::Init(imgIDecoderObserver *aObserver,
++                                    const char* aMimeType,
++                                    PRUint32 aFlags)
++{
++  // XXXdholbert Assert that mimetype == "image/svg+xml"
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* [noscript] imgIContainer extractFrame(PRUint32 aWhichFrame,
++ *                                       [const] in nsIntRect aRegion,
++ *                                       in PRUint32 aFlags); */
++NS_IMETHODIMP imgContainerSVG::ExtractFrame(PRUint32 aWhichFrame,
++                                            const nsIntRect &aRegion,
++                                            PRUint32 aFlags,
++                                            imgIContainer **_retval)
++{
++  NS_ENSURE_ARG_POINTER(_retval);
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* readonly attribute PRInt32 width; */
++NS_IMETHODIMP imgContainerSVG::GetWidth(PRInt32 *aWidth)
++{
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* readonly attribute PRInt32 height; */
++NS_IMETHODIMP imgContainerSVG::GetHeight(PRInt32 *aHeight)
++{
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* readonly attribute boolean currentFrameIsOpaque; */
++NS_IMETHODIMP imgContainerSVG::GetCurrentFrameIsOpaque(PRBool *aIsOpaque)
++{
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* [noscript] void getCurrentFrameRect(nsIntRect rect); */
++NS_IMETHODIMP imgContainerSVG::GetCurrentFrameRect(nsIntRect &aRect)
++{
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* readonly attribute unsigned long currentFrameIndex; */
++NS_IMETHODIMP imgContainerSVG::GetCurrentFrameIndex(PRUint32 *aCurrentFrameIdx)
++{
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* readonly attribute unsigned long numFrames; */
++NS_IMETHODIMP imgContainerSVG::GetNumFrames(PRUint32 *aNumFrames)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* readonly attribute boolean animated; */
++NS_IMETHODIMP imgContainerSVG::GetAnimated(PRBool *aAnimated)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++
++//******************************************************************************
++/* [noscript] gfxImageSurface copyFrame(in PRUint32 aWhichFrame,
++ *                                      in PRUint32 aFlags); */
++NS_IMETHODIMP imgContainerSVG::CopyFrame(PRUint32 aWhichFrame,
++                                         PRUint32 aFlags,
++                                         gfxImageSurface **_retval)
++{
++  if (aWhichFrame > FRAME_MAX_VALUE)
++    return NS_ERROR_INVALID_ARG;
++
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* [noscript] gfxASurface getFrame(in PRUint32 aWhichFrame,
++ *                                 in PRUint32 aFlags); */
++NS_IMETHODIMP imgContainerSVG::GetFrame(PRUint32 aWhichFrame,
++                                        PRUint32 aFlags,
++                                        gfxASurface **_retval)
++{
++  if (aWhichFrame > FRAME_MAX_VALUE)
++    return NS_ERROR_INVALID_ARG;
++
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* readonly attribute unsigned long dataSize; */
++NS_IMETHODIMP imgContainerSVG::GetDataSize(PRUint32 *_retval)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  NS_ENSURE_ARG_POINTER(_retval);
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++/* [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 imgContainerSVG::AppendFrame(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);
++  NS_ENSURE_ARG_POINTER(imageLength);
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++/* [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 imgContainerSVG::AppendPalettedFrame(PRInt32 aX, PRInt32 aY,
++                                                PRInt32 aWidth, PRInt32 aHeight,
++                                                gfxASurface::gfxImageFormat aFormat,
++                                                PRUint8 aPaletteDepth,
++                                                PRUint8 **imageData,
++                                                PRUint32 *imageLength,
++                                                PRUint32 **paletteData,
++                                                PRUint32 *paletteLength)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  NS_ENSURE_ARG_POINTER(imageData);
++  NS_ENSURE_ARG_POINTER(imageLength);
++  NS_ENSURE_ARG_POINTER(paletteData);
++  NS_ENSURE_ARG_POINTER(paletteLength);
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++/*  [noscript] void setSize(in long aWidth, in long aHeight); */
++NS_IMETHODIMP imgContainerSVG::SetSize(PRInt32 aWidth, PRInt32 aHeight)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++/*  [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 imgContainerSVG::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);
++  NS_ENSURE_ARG_POINTER(imageLength);
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++
++//******************************************************************************
++/* void frameUpdated (in unsigned long framenumber, in nsIntRect rect); */
++NS_IMETHODIMP imgContainerSVG::FrameUpdated(PRUint32 aFrameNum, nsIntRect &aUpdatedRect)
++{
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void setFrameDisposalMethod (in unsigned long framenumber, in PRInt32 aDisposalMethod); */
++NS_IMETHODIMP imgContainerSVG::SetFrameDisposalMethod(PRUint32 aFrameNum, PRInt32 aDisposalMethod)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void setFrameTimeout (in unsigned long framenumber, in PRInt32 aTimeout); */
++NS_IMETHODIMP imgContainerSVG::SetFrameTimeout(PRUint32 aFrameNum, PRInt32 aTimeout)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void setFrameBlendMethod (in unsigned long framenumber, in PRInt32 aBlendMethod); */
++NS_IMETHODIMP imgContainerSVG::SetFrameBlendMethod(PRUint32 aFrameNum, PRInt32 aBlendMethod)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++
++//******************************************************************************
++/* void setFrameHasNoAlpha (in unsigned long framenumber); */
++NS_IMETHODIMP imgContainerSVG::SetFrameHasNoAlpha(PRUint32 aFrameNum)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void endFrameDecode (in unsigned long framenumber); */
++NS_IMETHODIMP imgContainerSVG::EndFrameDecode(PRUint32 aFrameNum)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void decodingComplete (); */
++NS_IMETHODIMP imgContainerSVG::DecodingComplete(void)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* attribute unsigned short animationMode; */
++NS_IMETHODIMP imgContainerSVG::GetAnimationMode(PRUint16 *aAnimationMode)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  NS_ENSURE_ARG_POINTER(aAnimationMode);
++  
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* attribute unsigned short animationMode; */
++NS_IMETHODIMP imgContainerSVG::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!");
++  
++  /*
++  switch (mAnimationMode = aAnimationMode) {
++  }
++  */
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void startAnimation () */
++NS_IMETHODIMP imgContainerSVG::StartAnimation()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void stopAnimation (); */
++NS_IMETHODIMP imgContainerSVG::StopAnimation()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void resetAnimation (); */
++NS_IMETHODIMP imgContainerSVG::ResetAnimation()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* attribute long loopCount; */
++NS_IMETHODIMP imgContainerSVG::GetLoopCount(PRInt32 *aLoopCount)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  NS_ENSURE_ARG_POINTER(aLoopCount);
++  
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* attribute long loopCount; */
++NS_IMETHODIMP imgContainerSVG::SetLoopCount(PRInt32 aLoopCount)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void addSourceData(in nsIInputStream aInputStream, in unsigned long aCount); */
++NS_IMETHODIMP imgContainerSVG::AddSourceData(const char *aBuffer, PRUint32 aCount)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  NS_ENSURE_ARG_POINTER(aBuffer);
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void sourceDataComplete(); */
++NS_IMETHODIMP imgContainerSVG::SourceDataComplete()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void newSourceData(); */
++NS_IMETHODIMP imgContainerSVG::NewSourceData()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void requestDecode() */
++NS_IMETHODIMP
++imgContainerSVG::RequestDecode()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* [noscript] void draw(in gfxContext aContext, in gfxGraphicsFilter aFilter,
++ * in gfxMatrix aUserSpaceToImageSpace, in gfxRect aFill, in nsIntRect aSubimage,
++ * in PRUint32 aFlags); */ 
++NS_IMETHODIMP imgContainerSVG::Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, 
++                                 gfxMatrix &aUserSpaceToImageSpace, gfxRect &aFill,
++                                 nsIntRect &aSubimage, PRUint32 aFlags)
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  NS_ENSURE_ARG_POINTER(aContext);
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void lockImage() */
++NS_IMETHODIMP
++imgContainerSVG::LockImage()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
++
++//******************************************************************************
++/* void unlockImage() */
++NS_IMETHODIMP
++imgContainerSVG::UnlockImage()
++{
++  if (mError)
++    return NS_ERROR_FAILURE;
++
++  return NS_ERROR_NOT_IMPLEMENTED;
++}
+diff --git a/modules/libpr0n/src/imgContainerSVG.h b/modules/libpr0n/src/imgContainerSVG.h
+new file mode 100644
+--- /dev/null
++++ b/modules/libpr0n/src/imgContainerSVG.h
+@@ -0,0 +1,69 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* ***** BEGIN LICENSE BLOCK *****
++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
++ *
++ * The contents of this file are subject to the Mozilla Public License Version
++ * 1.1 (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS IS" basis,
++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++ * for the specific language governing rights and limitations under the
++ * License.
++ *
++ * The Original Code is the Mozilla SVG Module.
++ *
++ * The Initial Developer of the Original Code is
++ * the Mozilla Foundation.
++ * Portions created by the Initial Developer are Copyright (C) 2010
++ * the Initial Developer. All Rights Reserved.
++ *
++ * Contributor(s):
++ *
++ * Alternatively, the contents of this file may be used under the terms of
++ * either the GNU General Public License Version 2 or later (the "GPL"), or
++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++ * in which case the provisions of the GPL or the LGPL are applicable instead
++ * of those above. If you wish to allow use of your version of this file only
++ * under the terms of either the GPL or the LGPL, and not to allow others to
++ * use your version of this file under the terms of the MPL, indicate your
++ * 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 ***** */
++
++#ifndef imgContainerSVG_H_
++#define imgContainerSVG_H_
++
++#include "imgIContainer.h"
++
++#define NS_IMGCONTAINERSVG_CID \
++{ 0x74bedb60,                                      \
++  0xc188,                                          \
++  0x4e05,                                          \
++  {0x9b, 0x21, 0x24, 0xe0, 0xc0, 0x5e, 0xc9, 0xa3} \
++}
++
++class imgContainerSVG : public imgIContainer
++/*
++// XXXdholbert Do I need these other interfaces?
++                        public nsITimerCallback,
++                        public nsIProperties,
++                        public nsSupportsWeakReference
++*/
++{
++public:
++  imgContainerSVG();
++  virtual ~imgContainerSVG();
++
++  NS_DECL_ISUPPORTS
++  NS_DECL_IMGICONTAINER
++
++private:
++  PRPackedBool mError;
++};
++
++#endif // imgContainerSVG_H_
+diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp
+--- a/modules/libpr0n/src/imgRequest.cpp
++++ b/modules/libpr0n/src/imgRequest.cpp
+@@ -963,16 +963,18 @@ NS_IMETHODIMP imgRequest::OnDataAvailabl
+ {
+   LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::OnDataAvailable", "count", count);
+ 
+   NS_ASSERTION(aRequest, "imgRequest::OnDataAvailable -- no request!");
+ 
+   mGotData = PR_TRUE;
+   nsresult rv;
+ 
++  PRBool isSVG = PR_FALSE;
++
+   if (!mImage) {
+     LOG_SCOPE(gImgLog, "imgRequest::OnDataAvailable |First time through... finding mimetype|");
+ 
+     /* look at the first few bytes and see if we can tell what the data is from that
+      * since servers tend to lie. :(
+      */
+     PRUint32 out;
+     inStr->ReadSegments(sniff_mimetype_callback, this, count, &out);
+@@ -1063,63 +1065,77 @@ NS_IMETHODIMP imgRequest::OnDataAvailabl
+     PRUint32 containerFlags = imgIContainer::INIT_FLAG_NONE;
+     if (isDiscardable)
+       containerFlags |= imgIContainer::INIT_FLAG_DISCARDABLE;
+     if (doDecodeOnDraw)
+       containerFlags |= imgIContainer::INIT_FLAG_DECODE_ON_DRAW;
+     if (mIsMultiPartChannel)
+       containerFlags |= imgIContainer::INIT_FLAG_MULTIPART;
+ 
+-    // Create and initialize the imgContainer. This instantiates a decoder behind
+-    // the scenes, so if we don't have a decoder for this mimetype we'll find out
+-    // about it here.
+-    mImage = do_CreateInstance("@mozilla.org/image/container;3");
+-    if (!mImage) {
+-      this->Cancel(NS_ERROR_OUT_OF_MEMORY);
+-      return NS_ERROR_OUT_OF_MEMORY;
+-    }
+-    rv = mImage->Init(this, mContentType.get(), containerFlags);
+-    if (NS_FAILED(rv)) { // Probably bad mimetype
++    isSVG = mContentType.EqualsLiteral("image/svg+xml");
++    if (isSVG) {
++      // XXXdholbert Instantiate custom imgContainer
++      NS_WARNING("***********dholbert Instantiating SVG custom imgIContainer");
++      mImage = do_CreateInstance("@mozilla.org/image/svgcontainer;1");
++      if (!mImage) {
++        return NS_ERROR_FAILURE;
++      }
++      NS_NOTREACHED("****dholbert Oops, we created an image but didn't do stuff with it yet");
++    } else {
++      // Create and initialize the imgContainer. This instantiates a decoder behind
++      // the scenes, so if we don't have a decoder for this mimetype we'll find out
++      // about it here.
++      mImage = do_CreateInstance("@mozilla.org/image/container;3");
++      if (!mImage) {
++        this->Cancel(NS_ERROR_OUT_OF_MEMORY);
++        return NS_ERROR_OUT_OF_MEMORY;
++      }
++      rv = mImage->Init(this, mContentType.get(), containerFlags);
++      if (NS_FAILED(rv)) { // Probably bad mimetype
+ 
+-      // There's no reason to keep the image around. Save memory.
+-      //
+-      // XXXbholley - This is also here because I'm not sure we've found
+-      // all the consumers who (incorrectly) check whether the container
+-      // is null to determine things like size availability (they should
+-      // be checking the image status instead).
+-      mImage = nsnull;
++        // There's no reason to keep the image around. Save memory.
++        //
++        // XXXbholley - This is also here because I'm not sure we've found
++        // all the consumers who (incorrectly) check whether the container
++        // is null to determine things like size availability (they should
++        // be checking the image status instead).
++        mImage = nsnull;
+ 
+-      this->Cancel(rv);
+-      return NS_BINDING_ABORTED;
++        this->Cancel(rv);
++        return NS_BINDING_ABORTED;
++      }
+     }
+ 
+     // If we were waiting on the image to do something, now's our chance.
+     if (mDecodeRequested) {
+       mImage->RequestDecode();
+     }
+     while (mDeferredLocks) {
+       mImage->LockImage();
+       mDeferredLocks--;
+     }
+   }
+ 
+-  // WriteToContainer always consumes everything it gets
+-  PRUint32 bytesRead;
+-  rv = inStr->ReadSegments(imgContainer::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;
++  if (isSVG) {
++    NS_WARNING("***********dholbert Need to call inStr->ReadSegments(something) here");
++  } else {
++    // WriteToContainer always consumes everything it gets
++    PRUint32 bytesRead;
++    rv = inStr->ReadSegments(imgContainer::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;
++    }
++    NS_ABORT_IF_FALSE(bytesRead == count, "WriteToContainer should consume everything!");
+   }
+-  NS_ABORT_IF_FALSE(bytesRead == count, "WriteToContainer should consume everything!");
+-
+   return NS_OK;
+ }
+ 
+ static NS_METHOD sniff_mimetype_callback(nsIInputStream* in,
+                                          void* closure,
+                                          const char* fromRawSegment,
+                                          PRUint32 toOffset,
+                                          PRUint32 count,