Bug 1377158 - (Part 2) Add style backend type member in SVGDocumentWrapper and create SVG document with specified style backend. r=heycam
☠☠ backed out by 941e995a4a30 ☠ ☠
authorKuoE0 <kuoe0.tw@gmail.com>
Thu, 13 Jul 2017 14:42:30 +0800
changeset 421921 9a76090acf6e300a8e00b5fb2e0cb122837f271e
parent 421920 7c3ddf34fc42d5fb32a9cd2d98ba84f3c606dc7d
child 421922 61637891db5f8aca01881440c83ee7a4d24306b3
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 2) Add style backend type member in SVGDocumentWrapper and create SVG document with specified style backend. r=heycam MozReview-Commit-ID: 7CRBzWcrtIc
image/SVGDocumentWrapper.cpp
image/SVGDocumentWrapper.h
--- a/image/SVGDocumentWrapper.cpp
+++ b/image/SVGDocumentWrapper.cpp
@@ -17,16 +17,18 @@
 #include "nsIObserverService.h"
 #include "nsIParser.h"
 #include "nsIPresShell.h"
 #include "nsIRequest.h"
 #include "nsIStreamListener.h"
 #include "nsIXMLContentSink.h"
 #include "nsNetCID.h"
 #include "nsComponentManagerUtils.h"
+#include "nsContentDLF.h"
+#include "nsContentCID.h"
 #include "nsSMILAnimationController.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "nsSVGEffects.h"
 #include "mozilla/dom/SVGAnimatedLength.h"
 #include "nsMimeTypes.h"
 #include "DOMSVGLength.h"
 #include "nsDocument.h"
@@ -43,18 +45,19 @@ using namespace gfx;
 namespace image {
 
 NS_IMPL_ISUPPORTS(SVGDocumentWrapper,
                   nsIStreamListener,
                   nsIRequestObserver,
                   nsIObserver,
                   nsISupportsWeakReference)
 
-SVGDocumentWrapper::SVGDocumentWrapper()
-  : mIgnoreInvalidation(false),
+SVGDocumentWrapper::SVGDocumentWrapper(StyleBackendType aStyleBackendType /* = StyleBackendType::None */)
+  : mStyleBackendType(aStyleBackendType),
+    mIgnoreInvalidation(false),
     mRegisteredForXPCOMShutdown(false)
 { }
 
 SVGDocumentWrapper::~SVGDocumentWrapper()
 {
   DestroyViewer();
   if (mRegisteredForXPCOMShutdown) {
     UnregisterForXPCOMShutdown();
@@ -340,17 +343,17 @@ SVGDocumentWrapper::SetupViewer(nsIReque
   NS_ENSURE_TRUE(docLoaderFactory, NS_ERROR_NOT_AVAILABLE);
 
   nsCOMPtr<nsIContentViewer> viewer;
   nsCOMPtr<nsIStreamListener> listener;
   rv = docLoaderFactory->CreateInstance("external-resource", chan,
                                         newLoadGroup,
                                         NS_LITERAL_CSTRING(IMAGE_SVG_XML),
                                         nullptr, nullptr,
-                                        nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE,
+                                        (int16_t)mStyleBackendType,
                                         getter_AddRefs(listener),
                                         getter_AddRefs(viewer));
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ENSURE_TRUE(viewer, NS_ERROR_UNEXPECTED);
 
   // Create a navigation time object and pass it to the SVG document through
   // the viewer.
--- a/image/SVGDocumentWrapper.h
+++ b/image/SVGDocumentWrapper.h
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This class wraps an SVG document, for use by VectorImage objects. */
 
 #ifndef mozilla_image_SVGDocumentWrapper_h
 #define mozilla_image_SVGDocumentWrapper_h
 
 #include "mozilla/Attributes.h"
+#include "mozilla/StyleBackendType.h"
 
 #include "nsCOMPtr.h"
 #include "nsIStreamListener.h"
 #include "nsIObserver.h"
 #include "nsIContentViewer.h"
 #include "nsWeakReference.h"
 #include "nsSize.h"
 
@@ -34,17 +35,17 @@ class SVGSVGElement;
 
 namespace image {
 
 class SVGDocumentWrapper final : public nsIStreamListener,
                                  public nsIObserver,
                                  nsSupportsWeakReference
 {
 public:
-  SVGDocumentWrapper();
+  explicit SVGDocumentWrapper(StyleBackendType aStyleBackendType = StyleBackendType::None);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSIOBSERVER
 
   enum Dimension {
     eWidth,
@@ -136,16 +137,17 @@ private:
                        nsILoadGroup** aLoadGroup);
   void     DestroyViewer();
   void     RegisterForXPCOMShutdown();
   void     UnregisterForXPCOMShutdown();
 
   nsCOMPtr<nsIContentViewer>  mViewer;
   nsCOMPtr<nsILoadGroup>      mLoadGroup;
   nsCOMPtr<nsIStreamListener> mListener;
+  StyleBackendType            mStyleBackendType;
   bool                        mIgnoreInvalidation;
   bool                        mRegisteredForXPCOMShutdown;
 };
 
 } // namespace image
 } // namespace mozilla
 
 #endif // mozilla_image_SVGDocumentWrapper_h