Bug 1443797: Remove SVGTests::IsInChromeDoc. r=dholbert
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 07 Mar 2018 15:18:52 +0100
changeset 407139 a1f879c4c1b722b4282bf2ffb130894bf2afe939
parent 407138 b363c50f8ac28a99ddde6eb20bc2181d49afd02a
child 407140 1aec18f5bac95a3b975c4d43982ff5b93b1d90a9
push id60815
push userecoal95@gmail.com
push dateThu, 08 Mar 2018 08:27:15 +0000
treeherderautoland@1aec18f5bac9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1443797
milestone60.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 1443797: Remove SVGTests::IsInChromeDoc. r=dholbert Summary: It's effectively the same as AsSVGElement()->IsInChromeDocument(). Reviewers: dholbert Bug #: 1443797 Differential Revision: https://phabricator.services.mozilla.com/D695 MozReview-Commit-ID: 8f8fUsPfdnm
dom/svg/SVGAnimationElement.cpp
dom/svg/SVGAnimationElement.h
dom/svg/SVGGraphicsElement.cpp
dom/svg/SVGGraphicsElement.h
dom/svg/SVGSymbolElement.cpp
dom/svg/SVGSymbolElement.h
dom/svg/SVGTests.cpp
dom/svg/SVGTests.h
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -349,25 +349,16 @@ SVGAnimationElement::AfterSetAttr(int32_
 
 bool
 SVGAnimationElement::IsNodeOfType(uint32_t aFlags) const
 {
   return !(aFlags & ~eANIMATION);
 }
 
 //----------------------------------------------------------------------
-// SVGTests methods
-
-bool
-SVGAnimationElement::IsInChromeDoc() const
-{
-  return nsContentUtils::IsChromeDoc(OwnerDoc());
-}
-
-//----------------------------------------------------------------------
 // SVG utility methods
 
 void
 SVGAnimationElement::ActivateByHyperlink()
 {
   FlushAnimations();
 
   // The behavior for when the target is an animation element is defined in
--- a/dom/svg/SVGAnimationElement.h
+++ b/dom/svg/SVGAnimationElement.h
@@ -83,17 +83,16 @@ public:
   float GetCurrentTime();
   float GetSimpleDuration(ErrorResult& rv);
   void BeginElement(ErrorResult& rv) { BeginElementAt(0.f, rv); }
   void BeginElementAt(float offset, ErrorResult& rv);
   void EndElement(ErrorResult& rv) { EndElementAt(0.f, rv); }
   void EndElementAt(float offset, ErrorResult& rv);
 
   // SVGTests
-  virtual bool IsInChromeDoc() const override;
   nsSVGElement* AsSVGElement() final { return this; }
 
  protected:
   // nsSVGElement overrides
 
   void UpdateHrefTarget(nsIContent* aNodeForContext,
                         const nsAString& aHrefStr);
   void AnimationTargetChanged();
--- a/dom/svg/SVGGraphicsElement.cpp
+++ b/dom/svg/SVGGraphicsElement.cpp
@@ -26,16 +26,10 @@ SVGGraphicsElement::SVGGraphicsElement(a
   : SVGGraphicsElementBase(aNodeInfo)
 {
 }
 
 SVGGraphicsElement::~SVGGraphicsElement()
 {
 }
 
-bool
-SVGGraphicsElement::IsInChromeDoc() const
-{
-  return nsContentUtils::IsChromeDoc(OwnerDoc());
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/svg/SVGGraphicsElement.h
+++ b/dom/svg/SVGGraphicsElement.h
@@ -21,16 +21,15 @@ class SVGGraphicsElement : public SVGGra
 protected:
   explicit SVGGraphicsElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
   ~SVGGraphicsElement();
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  bool IsInChromeDoc() const override;
   nsSVGElement* AsSVGElement() final { return this; }
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGGraphicsElement_h
--- a/dom/svg/SVGSymbolElement.cpp
+++ b/dom/svg/SVGSymbolElement.cpp
@@ -37,19 +37,10 @@ SVGSymbolElement::~SVGSymbolElement()
 {
 }
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
 
-//----------------------------------------------------------------------
-// SVGTests methods
-
-bool
-SVGSymbolElement::IsInChromeDoc() const
-{
-  return nsContentUtils::IsChromeDoc(OwnerDoc());
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/svg/SVGSymbolElement.h
+++ b/dom/svg/SVGSymbolElement.h
@@ -27,17 +27,14 @@ protected:
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
-
-  // SVGTests
-  bool IsInChromeDoc() const override;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGSymbolElement_h
--- a/dom/svg/SVGTests.cpp
+++ b/dom/svg/SVGTests.cpp
@@ -46,17 +46,18 @@ SVGTests::SystemLanguage()
 {
   return DOMSVGStringList::GetDOMWrapper(
            &mStringListAttributes[LANGUAGE], AsSVGElement(), true, LANGUAGE);
 }
 
 bool
 SVGTests::HasExtension(const nsAString& aExtension)
 {
-  return nsSVGFeatures::HasExtension(aExtension, IsInChromeDoc());
+  return nsSVGFeatures::HasExtension(aExtension,
+                                     AsSVGElement()->IsInChromeDocument());
 }
 
 bool
 SVGTests::IsConditionalProcessingAttribute(const nsAtom* aAttribute) const
 {
   for (uint32_t i = 0; i < ArrayLength(sStringListNames); i++) {
     if (aAttribute == *sStringListNames[i]) {
       return true;
@@ -113,17 +114,18 @@ SVGTests::PassesConditionalProcessingTes
   // go beyond the feature set defined in the SVG specification.
   // Each extension is identified by a URI reference.
   // For now, claim that mozilla's SVG implementation supports XHTML and MathML.
   if (mStringListAttributes[EXTENSIONS].IsExplicitlySet()) {
     if (mStringListAttributes[EXTENSIONS].IsEmpty()) {
       return false;
     }
     for (uint32_t i = 0; i < mStringListAttributes[EXTENSIONS].Length(); i++) {
-      if (!nsSVGFeatures::HasExtension(mStringListAttributes[EXTENSIONS][i], IsInChromeDoc())) {
+      if (!nsSVGFeatures::HasExtension(mStringListAttributes[EXTENSIONS][i],
+                                       AsSVGElement()->IsInChromeDocument())) {
         return false;
       }
     }
   }
 
   if (aAcceptLangs == kIgnoreSystemLanguage) {
     return true;
   }
--- a/dom/svg/SVGTests.h
+++ b/dom/svg/SVGTests.h
@@ -91,19 +91,23 @@ public:
   void MaybeInvalidate();
 
   // WebIDL
   already_AddRefed<DOMSVGStringList> RequiredFeatures();
   already_AddRefed<DOMSVGStringList> RequiredExtensions();
   already_AddRefed<DOMSVGStringList> SystemLanguage();
   bool HasExtension(const nsAString& aExtension);
 
-  virtual bool IsInChromeDoc() const = 0;
   virtual nsSVGElement* AsSVGElement() = 0;
 
+  const nsSVGElement* AsSVGElement() const
+  {
+    return const_cast<SVGTests*>(this)->AsSVGElement();
+  }
+
 protected:
   virtual ~SVGTests() {}
 
 private:
   enum { FEATURES, EXTENSIONS, LANGUAGE };
   SVGStringList mStringListAttributes[3];
   static nsStaticAtom** sStringListNames[3];
 };