Bug 1377158 - (Part 3) Add style backend type member in VectorImage to be used to create SVGDocumentWrapper with specified style backend. r=heycam
☠☠ backed out by 1bcb249ab430 ☠ ☠
authorKuoE0 <kuoe0.tw@gmail.com>
Thu, 29 Jun 2017 15:34:02 -0700
changeset 419520 61637891db5f8aca01881440c83ee7a4d24306b3
parent 419519 9a76090acf6e300a8e00b5fb2e0cb122837f271e
child 419521 b05327c3c55f15d52e7b3adf474e944ce600ef03
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1377158
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377158 - (Part 3) Add style backend type member in VectorImage to be used to create SVGDocumentWrapper with specified style backend. r=heycam MozReview-Commit-ID: KkG3iY7R8ix
image/VectorImage.cpp
image/VectorImage.h
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -330,24 +330,26 @@ SVGDrawingCallback::operator()(gfxContex
 NS_IMPL_ISUPPORTS(VectorImage,
                   imgIContainer,
                   nsIStreamListener,
                   nsIRequestObserver)
 
 //------------------------------------------------------------------------------
 // Constructor / Destructor
 
-VectorImage::VectorImage(ImageURL* aURI /* = nullptr */) :
+VectorImage::VectorImage(ImageURL* aURI /* = nullptr */,
+                         StyleBackendType aStyleBackendType /* = StyleBackendType::None */) :
   ImageResource(aURI), // invoke superclass's constructor
   mLockCount(0),
   mIsInitialized(false),
   mIsFullyLoaded(false),
   mIsDrawing(false),
   mHaveAnimations(false),
-  mHasPendingInvalidation(false)
+  mHasPendingInvalidation(false),
+  mStyleBackendType(aStyleBackendType)
 { }
 
 VectorImage::~VectorImage()
 {
   CancelAllListeners();
   SurfaceCache::RemoveImage(ImageKey(this));
 }
 
@@ -1177,17 +1179,17 @@ VectorImage::GetFrameIndex(uint32_t aWhi
 
 //******************************************************************************
 NS_IMETHODIMP
 VectorImage::OnStartRequest(nsIRequest* aRequest, nsISupports* aCtxt)
 {
   MOZ_ASSERT(!mSVGDocumentWrapper,
              "Repeated call to OnStartRequest -- can this happen?");
 
-  mSVGDocumentWrapper = new SVGDocumentWrapper();
+  mSVGDocumentWrapper = new SVGDocumentWrapper(mStyleBackendType);
   nsresult rv = mSVGDocumentWrapper->OnStartRequest(aRequest, aCtxt);
   if (NS_FAILED(rv)) {
     mSVGDocumentWrapper = nullptr;
     mError = true;
     return rv;
   }
 
   // ProgressTracker::SyncNotifyProgress may release us, so ensure we
--- a/image/VectorImage.h
+++ b/image/VectorImage.h
@@ -67,17 +67,18 @@ public:
 
   // Callbacks for SVGLoadEventListener.
   void OnSVGDocumentLoaded();
   void OnSVGDocumentError();
 
   virtual void ReportUseCounters() override;
 
 protected:
-  explicit VectorImage(ImageURL* aURI = nullptr);
+  explicit VectorImage(ImageURL* aURI = nullptr,
+                       StyleBackendType aStyleBackendType = StyleBackendType::None);
   virtual ~VectorImage();
 
   virtual nsresult StartAnimation() override;
   virtual nsresult StopAnimation() override;
   virtual bool     ShouldAnimate() override;
 
 private:
   /// Attempt to find a cached surface matching @aParams in the SurfaceCache.
@@ -118,17 +119,17 @@ private:
   bool           mDiscardable;            // Are we discardable?
   bool           mIsFullyLoaded;          // Has the SVG document finished
                                           // loading?
   bool           mIsDrawing;              // Are we currently drawing?
   bool           mHaveAnimations;         // Is our SVG content SMIL-animated?
                                           // (Only set after mIsFullyLoaded.)
   bool           mHasPendingInvalidation; // Invalidate observers next refresh
                                           // driver tick.
-
+  StyleBackendType mStyleBackendType;     // The style backend used for this image document.
   friend class ImageFactory;
 };
 
 inline NS_IMETHODIMP VectorImage::GetAnimationMode(uint16_t* aAnimationMode) {
   return GetAnimationModeInternal(aAnimationMode);
 }
 
 inline NS_IMETHODIMP VectorImage::SetAnimationMode(uint16_t aAnimationMode) {