Bug 1377158 - (Part 4) Add a new parameter to pass style backend type to create image. r=heycam
☠☠ backed out by a013e95212fc ☠ ☠
authorKuoE0 <kuoe0.tw@gmail.com>
Thu, 13 Jul 2017 16:34:34 +0800
changeset 421923 b05327c3c55f15d52e7b3adf474e944ce600ef03
parent 421922 61637891db5f8aca01881440c83ee7a4d24306b3
child 421924 1310d6d8b5c091998951a05ce7ac05e4ffac7b28
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [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 4) Add a new parameter to pass style backend type to create image. r=heycam MozReview-Commit-ID: 74gWTbUyYOZ
image/ImageFactory.cpp
image/ImageFactory.h
--- a/image/ImageFactory.cpp
+++ b/image/ImageFactory.cpp
@@ -79,17 +79,18 @@ ComputeImageFlags(ImageURL* uri, const n
 }
 
 /* static */ already_AddRefed<Image>
 ImageFactory::CreateImage(nsIRequest* aRequest,
                           ProgressTracker* aProgressTracker,
                           const nsCString& aMimeType,
                           ImageURL* aURI,
                           bool aIsMultiPart,
-                          uint32_t aInnerWindowId)
+                          uint32_t aInnerWindowId,
+                          StyleBackendType aStyleBackendType /* = StyleBackendType::None */)
 {
   MOZ_ASSERT(gfxPrefs::SingletonExists(),
              "Pref observers should have been initialized already");
 
   // Compute the image's initialization flags.
   uint32_t imageFlags = ComputeImageFlags(aURI, aMimeType, aIsMultiPart);
 
 #ifdef DEBUG
@@ -103,17 +104,17 @@ ImageFactory::CreateImage(nsIRequest* aR
       obs->NotifyObservers(nullptr, "image-loading", NS_ConvertUTF8toUTF16(spec).get());
     }
   }
 #endif
 
   // Select the type of image to create based on MIME type.
   if (aMimeType.EqualsLiteral(IMAGE_SVG_XML)) {
     return CreateVectorImage(aRequest, aProgressTracker, aMimeType,
-                             aURI, imageFlags, aInnerWindowId);
+                             aURI, imageFlags, aInnerWindowId, aStyleBackendType);
   } else {
     return CreateRasterImage(aRequest, aProgressTracker, aMimeType,
                              aURI, imageFlags, aInnerWindowId);
   }
 }
 
 // Marks an image as having an error before returning it.
 template <typename T>
@@ -248,23 +249,24 @@ ImageFactory::CreateRasterImage(nsIReque
 }
 
 /* static */ already_AddRefed<Image>
 ImageFactory::CreateVectorImage(nsIRequest* aRequest,
                                 ProgressTracker* aProgressTracker,
                                 const nsCString& aMimeType,
                                 ImageURL* aURI,
                                 uint32_t aImageFlags,
-                                uint32_t aInnerWindowId)
+                                uint32_t aInnerWindowId,
+                                StyleBackendType aStyleBackendType)
 {
   MOZ_ASSERT(aProgressTracker);
 
   nsresult rv;
 
-  RefPtr<VectorImage> newImage = new VectorImage(aURI);
+  RefPtr<VectorImage> newImage = new VectorImage(aURI, aStyleBackendType);
   aProgressTracker->SetImage(newImage);
   newImage->SetProgressTracker(aProgressTracker);
 
   rv = newImage->Init(aMimeType.get(), aImageFlags);
   if (NS_FAILED(rv)) {
     return BadImage("VectorImage::Init failed", newImage);
   }
 
--- a/image/ImageFactory.h
+++ b/image/ImageFactory.h
@@ -2,16 +2,17 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_image_ImageFactory_h
 #define mozilla_image_ImageFactory_h
 
+#include "mozilla/StyleBackendType.h"
 #include "nsCOMPtr.h"
 #include "nsProxyRelease.h"
 
 class nsCString;
 class nsIRequest;
 
 namespace mozilla {
 namespace image {
@@ -40,17 +41,18 @@ public:
    * @param aIsMultiPart     Whether the image is part of a multipart request.
    * @param aInnerWindowId   The window this image belongs to.
    */
   static already_AddRefed<Image> CreateImage(nsIRequest* aRequest,
                                              ProgressTracker* aProgressTracker,
                                              const nsCString& aMimeType,
                                              ImageURL* aURI,
                                              bool aIsMultiPart,
-                                             uint32_t aInnerWindowId);
+                                             uint32_t aInnerWindowId,
+                                             StyleBackendType aStyleBackendType = StyleBackendType::None);
   /**
    * Creates a new image which isn't associated with a URI or loaded through
    * the usual image loading mechanism.
    *
    * @param aMimeType      The mimetype of the image.
    */
   static already_AddRefed<Image>
   CreateAnonymousImage(const nsCString& aMimeType);
@@ -78,17 +80,18 @@ private:
                     uint32_t aInnerWindowId);
 
   static already_AddRefed<Image>
   CreateVectorImage(nsIRequest* aRequest,
                     ProgressTracker* aProgressTracker,
                     const nsCString& aMimeType,
                     ImageURL* aURI,
                     uint32_t aImageFlags,
-                    uint32_t aInnerWindowId);
+                    uint32_t aInnerWindowId,
+                    StyleBackendType aStyleBackendType);
 
   // This is a static factory class, so disallow instantiation.
   virtual ~ImageFactory() = 0;
 };
 
 } // namespace image
 } // namespace mozilla