Bug 1517127 - move nsSVGClass to the mozilla::dom namespace r=jwatt
authorlongsonr <longsonr@gmail.com>
Tue, 01 Jan 2019 16:26:26 +0000
changeset 452243 0def5ac36b5bf1f7f70bd84d3398dfb64d853ba8
parent 452242 59468cc2550d9441832a6d6954dd46cccc089435
child 452244 a11545a2c1e89e86ebdf5068e931a7250dac523f
child 452248 fda9de78ff7f1836278a7bd4b2581940883afb84
push id110847
push userlongsonr@gmail.com
push dateTue, 01 Jan 2019 16:26:51 +0000
treeherdermozilla-inbound@0def5ac36b5b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1517127
milestone66.0a1
first release with
nightly linux32
0def5ac36b5b / 66.0a1 / 20190101212914 / files
nightly linux64
0def5ac36b5b / 66.0a1 / 20190101212914 / files
nightly mac
0def5ac36b5b / 66.0a1 / 20190101212914 / files
nightly win32
0def5ac36b5b / 66.0a1 / 20190101212914 / files
nightly win64
0def5ac36b5b / 66.0a1 / 20190101212914 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1517127 - move nsSVGClass to the mozilla::dom namespace r=jwatt
dom/svg/SVGClass.cpp
dom/svg/SVGClass.h
dom/svg/SVGElement.h
dom/svg/moz.build
dom/svg/nsSVGClass.cpp
dom/svg/nsSVGClass.h
rename from dom/svg/nsSVGClass.cpp
rename to dom/svg/SVGClass.cpp
--- a/dom/svg/nsSVGClass.cpp
+++ b/dom/svg/SVGClass.cpp
@@ -1,33 +1,33 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-#include "nsSVGClass.h"
+#include "SVGClass.h"
 
 #include "mozilla/dom/SVGAnimatedString.h"
 #include "mozilla/Move.h"
 #include "SVGElement.h"
 #include "nsSMILValue.h"
 #include "SMILStringType.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
 struct DOMAnimatedString final : public SVGAnimatedString {
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMAnimatedString)
 
-  DOMAnimatedString(nsSVGClass* aVal, SVGElement* aSVGElement)
+  DOMAnimatedString(SVGClass* aVal, SVGElement* aSVGElement)
       : SVGAnimatedString(aSVGElement), mVal(aVal) {}
 
-  nsSVGClass* mVal;  // kept alive because it belongs to content
+  SVGClass* mVal;  // kept alive because it belongs to content
 
   void GetBaseVal(nsAString& aResult) override {
     mVal->GetBaseValue(aResult, mSVGElement);
   }
 
   void SetBaseVal(const nsAString& aValue) override {
     mVal->SetBaseValue(aValue, mSVGElement, true);
   }
@@ -43,99 +43,101 @@ NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPER
 NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMAnimatedString)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMAnimatedString)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMAnimatedString)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-already_AddRefed<SVGAnimatedString> nsSVGClass::ToDOMAnimatedString(
+already_AddRefed<SVGAnimatedString> SVGClass::ToDOMAnimatedString(
     SVGElement* aSVGElement) {
   RefPtr<DOMAnimatedString> result = new DOMAnimatedString(this, aSVGElement);
   return result.forget();
 }
 
 /* Implementation */
 
-void nsSVGClass::SetBaseValue(const nsAString& aValue, SVGElement* aSVGElement,
-                              bool aDoSetAttr) {
+void SVGClass::SetBaseValue(const nsAString& aValue, SVGElement* aSVGElement,
+                            bool aDoSetAttr) {
   NS_ASSERTION(aSVGElement, "Null element passed to SetBaseValue");
 
   aSVGElement->SetMayHaveClass();
   if (aDoSetAttr) {
     aSVGElement->SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aValue, true);
   }
   if (mAnimVal) {
     aSVGElement->AnimationNeedsResample();
   }
 }
 
-void nsSVGClass::GetBaseValue(nsAString& aValue,
-                              const SVGElement* aSVGElement) const {
+void SVGClass::GetBaseValue(nsAString& aValue,
+                            const SVGElement* aSVGElement) const {
   aSVGElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aValue);
 }
 
-void nsSVGClass::GetAnimValue(nsAString& aResult,
-                              const SVGElement* aSVGElement) const {
+void SVGClass::GetAnimValue(nsAString& aResult,
+                            const SVGElement* aSVGElement) const {
   if (mAnimVal) {
     aResult = *mAnimVal;
     return;
   }
 
   aSVGElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aResult);
 }
 
-void nsSVGClass::SetAnimValue(const nsAString& aValue,
-                              SVGElement* aSVGElement) {
+void SVGClass::SetAnimValue(const nsAString& aValue, SVGElement* aSVGElement) {
   if (mAnimVal && mAnimVal->Equals(aValue)) {
     return;
   }
   if (!mAnimVal) {
     mAnimVal = new nsString();
   }
   *mAnimVal = aValue;
   aSVGElement->SetMayHaveClass();
   aSVGElement->DidAnimateClass();
 }
 
 void DOMAnimatedString::GetAnimVal(nsAString& aResult) {
   mSVGElement->FlushAnimations();
   mVal->GetAnimValue(aResult, mSVGElement);
 }
 
-UniquePtr<nsISMILAttr> nsSVGClass::ToSMILAttr(SVGElement* aSVGElement) {
+UniquePtr<nsISMILAttr> SVGClass::ToSMILAttr(SVGElement* aSVGElement) {
   return MakeUnique<SMILString>(this, aSVGElement);
 }
 
-nsresult nsSVGClass::SMILString::ValueFromString(
+nsresult SVGClass::SMILString::ValueFromString(
     const nsAString& aStr, const dom::SVGAnimationElement* /*aSrcElement*/,
     nsSMILValue& aValue, bool& aPreventCachingOfSandwich) const {
   nsSMILValue val(SMILStringType::Singleton());
 
   *static_cast<nsAString*>(val.mU.mPtr) = aStr;
   aValue = std::move(val);
   aPreventCachingOfSandwich = false;
   return NS_OK;
 }
 
-nsSMILValue nsSVGClass::SMILString::GetBaseValue() const {
+nsSMILValue SVGClass::SMILString::GetBaseValue() const {
   nsSMILValue val(SMILStringType::Singleton());
   mSVGElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_class,
                        *static_cast<nsAString*>(val.mU.mPtr));
   return val;
 }
 
-void nsSVGClass::SMILString::ClearAnimValue() {
+void SVGClass::SMILString::ClearAnimValue() {
   if (mVal->mAnimVal) {
     mVal->mAnimVal = nullptr;
     mSVGElement->DidAnimateClass();
   }
 }
 
-nsresult nsSVGClass::SMILString::SetAnimValue(const nsSMILValue& aValue) {
+nsresult SVGClass::SMILString::SetAnimValue(const nsSMILValue& aValue) {
   NS_ASSERTION(aValue.mType == SMILStringType::Singleton(),
                "Unexpected type to assign animated value");
   if (aValue.mType == SMILStringType::Singleton()) {
     mVal->SetAnimValue(*static_cast<nsAString*>(aValue.mU.mPtr), mSVGElement);
   }
   return NS_OK;
 }
+
+}  // namespace dom
+}  // namespace mozilla
rename from dom/svg/nsSVGClass.h
rename to dom/svg/SVGClass.h
--- a/dom/svg/nsSVGClass.h
+++ b/dom/svg/SVGClass.h
@@ -14,20 +14,18 @@
 #include "nsString.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/UniquePtr.h"
 
 namespace mozilla {
 namespace dom {
 class SVGAnimatedString;
 class SVGElement;
-}  // namespace dom
-}  // namespace mozilla
 
-class nsSVGClass {
+class SVGClass {
  public:
   typedef mozilla::dom::SVGElement SVGElement;
 
   void Init() { mAnimVal = nullptr; }
 
   void SetBaseValue(const nsAString& aValue, SVGElement* aSVGElement,
                     bool aDoSetAttr);
   void GetBaseValue(nsAString& aValue, const SVGElement* aSVGElement) const;
@@ -42,28 +40,32 @@ class nsSVGClass {
   mozilla::UniquePtr<nsISMILAttr> ToSMILAttr(SVGElement* aSVGElement);
 
  private:
   nsAutoPtr<nsString> mAnimVal;
 
  public:
   struct SMILString : public nsISMILAttr {
    public:
-    SMILString(nsSVGClass* aVal, SVGElement* aSVGElement)
+    SMILString(SVGClass* aVal, SVGElement* aSVGElement)
         : mVal(aVal), mSVGElement(aSVGElement) {}
 
     // These will stay alive because a nsISMILAttr only lives as long
     // as the Compositing step, and DOM elements don't get a chance to
     // die during that.
-    nsSVGClass* mVal;
+    SVGClass* mVal;
     SVGElement* mSVGElement;
 
     // nsISMILAttr methods
     virtual nsresult ValueFromString(
         const nsAString& aStr,
         const mozilla::dom::SVGAnimationElement* aSrcElement,
         nsSMILValue& aValue, bool& aPreventCachingOfSandwich) const override;
     virtual nsSMILValue GetBaseValue() const override;
     virtual void ClearAnimValue() override;
     virtual nsresult SetAnimValue(const nsSMILValue& aValue) override;
   };
 };
+
+}  // namespace dom
+}  // namespace mozilla
+
 #endif  //__NS_SVGCLASS_H__
--- a/dom/svg/SVGElement.h
+++ b/dom/svg/SVGElement.h
@@ -11,25 +11,25 @@
   SVGElement is the base class for all SVG content elements.
   It implements all the common DOM interfaces and handles attributes.
 */
 
 #include "mozilla/Attributes.h"
 #include "mozilla/SVGContentUtils.h"
 #include "mozilla/dom/DOMRect.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/SVGClass.h"
 #include "mozilla/gfx/MatrixFwd.h"
 #include "nsAutoPtr.h"
 #include "nsChangeHint.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsError.h"
 #include "nsISupportsImpl.h"
 #include "nsStyledElement.h"
-#include "nsSVGClass.h"
 #include "gfxMatrix.h"
 
 class SVGAngle;
 class nsSVGBoolean;
 class nsSVGEnum;
 class nsSVGInteger;
 class nsSVGIntegerPair;
 class nsSVGLength2;
@@ -606,17 +606,17 @@ class SVGElement : public SVGElementBase
   virtual StringListAttributesInfo GetStringListInfo();
 
   static nsSVGEnumMapping sSVGUnitTypesMap[];
 
  private:
   void UnsetAttrInternal(int32_t aNameSpaceID, nsAtom* aAttribute,
                          bool aNotify);
 
-  nsSVGClass mClassAttribute;
+  SVGClass mClassAttribute;
   nsAutoPtr<nsAttrValue> mClassAnimAttr;
   RefPtr<mozilla::DeclarationBlock> mContentDeclarationBlock;
 };
 
 /**
  * A macro to implement the NS_NewSVGXXXElement() functions.
  */
 #define NS_IMPL_NS_NEW_SVG_ELEMENT(_elementName)                            \
--- a/dom/svg/moz.build
+++ b/dom/svg/moz.build
@@ -4,20 +4,16 @@
 # 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/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "SVG")
 
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 
-EXPORTS += [
-    'nsSVGClass.h',
-]
-
 EXPORTS.mozilla += [
     'SVGAttrValueWrapper.h',
     'SVGContentUtils.h',
     'SVGPreserveAspectRatio.h',
     'SVGStringList.h',
     'SVGTagList.h',
 ]
 
@@ -34,16 +30,17 @@ EXPORTS.mozilla.dom += [
     'SVGAnimatedPathSegList.h',
     'SVGAnimatedRect.h',
     'SVGAnimatedString.h',
     'SVGAnimateElement.h',
     'SVGAnimateMotionElement.h',
     'SVGAnimateTransformElement.h',
     'SVGAnimationElement.h',
     'SVGCircleElement.h',
+    'SVGClass.h',
     'SVGClipPathElement.h',
     'SVGComponentTransferFunctionElement.h',
     'SVGDefsElement.h',
     'SVGDescElement.h',
     'SVGDocument.h',
     'SVGElement.h',
     'SVGElementFactory.h',
     'SVGEllipseElement.h',
@@ -122,17 +119,16 @@ UNIFIED_SOURCES += [
     'DOMSVGPathSegList.cpp',
     'DOMSVGPoint.cpp',
     'DOMSVGPointList.cpp',
     'DOMSVGStringList.cpp',
     'DOMSVGTransform.cpp',
     'DOMSVGTransformList.cpp',
     'nsISVGPoint.cpp',
     'nsSVGBoolean.cpp',
-    'nsSVGClass.cpp',
     'nsSVGEnum.cpp',
     'nsSVGInteger.cpp',
     'nsSVGIntegerPair.cpp',
     'nsSVGLength2.cpp',
     'nsSVGNumber2.cpp',
     'nsSVGNumberPair.cpp',
     'nsSVGString.cpp',
     'nsSVGViewBox.cpp',
@@ -153,16 +149,17 @@ UNIFIED_SOURCES += [
     'SVGAnimatedString.cpp',
     'SVGAnimatedTransformList.cpp',
     'SVGAnimateElement.cpp',
     'SVGAnimateMotionElement.cpp',
     'SVGAnimateTransformElement.cpp',
     'SVGAnimationElement.cpp',
     'SVGAttrValueWrapper.cpp',
     'SVGCircleElement.cpp',
+    'SVGClass.cpp',
     'SVGClipPathElement.cpp',
     'SVGContentUtils.cpp',
     'SVGDataParser.cpp',
     'SVGDefsElement.cpp',
     'SVGDescElement.cpp',
     'SVGDocument.cpp',
     'SVGElement.cpp',
     'SVGElementFactory.cpp',