diff --git a/dom/svg/DOMSVGPathSeg.cpp b/dom/svg/DOMSVGPathSeg.cpp index a15bf42e94d9..3a3935c2712d 100644 --- a/dom/svg/DOMSVGPathSeg.cpp +++ b/dom/svg/DOMSVGPathSeg.cpp @@ -14,6 +14,8 @@ namespace mozilla { +using namespace dom::SVGPathSegBinding; + // We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to // clear our list's weak ref to us to be safe. (The other option would be to // not unlink and rely on the breaking of the other edges in the cycle, as diff --git a/dom/svg/DOMSVGPathSeg.h b/dom/svg/DOMSVGPathSeg.h index 33efe719b0d1..986c4ae41e2e 100644 --- a/dom/svg/DOMSVGPathSeg.h +++ b/dom/svg/DOMSVGPathSeg.h @@ -22,7 +22,7 @@ namespace mozilla { #define CHECK_ARG_COUNT_IN_SYNC(segType) \ MOZ_ASSERT(ArrayLength(mArgs) == \ SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \ - uint32_t(segType) == PATHSEG_CLOSEPATH, \ + uint32_t(segType) == dom::SVGPathSegBinding::PATHSEG_CLOSEPATH, \ "Arg count/array size out of sync") #define IMPL_SVGPATHSEG_SUBCLASS_COMMON(segName, segType) \ @@ -233,7 +233,8 @@ public: { } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(ClosePath, PATHSEG_CLOSEPATH) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + ClosePath, dom::SVGPathSegBinding::PATHSEG_CLOSEPATH) protected: // To allow IMPL_SVGPATHSEG_SUBCLASS_COMMON above to compile we need an @@ -253,7 +254,8 @@ public: mArgs[1] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoAbs, PATHSEG_MOVETO_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + MovetoAbs, dom::SVGPathSegBinding::PATHSEG_MOVETO_ABS) float X(); void SetX(float aX, ErrorResult& rv); @@ -275,7 +277,8 @@ public: mArgs[1] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoRel, PATHSEG_MOVETO_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + MovetoRel, dom::SVGPathSegBinding::PATHSEG_MOVETO_REL) float X(); void SetX(float aX, ErrorResult& rv); @@ -297,7 +300,8 @@ public: mArgs[1] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoAbs, PATHSEG_LINETO_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + LinetoAbs, dom::SVGPathSegBinding::PATHSEG_LINETO_ABS) float X(); void SetX(float aX, ErrorResult& rv); @@ -319,7 +323,8 @@ public: mArgs[1] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoRel, PATHSEG_LINETO_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + LinetoRel, dom::SVGPathSegBinding::PATHSEG_LINETO_REL) float X(); void SetX(float aX, ErrorResult& rv); @@ -360,7 +365,8 @@ public: float Y2(); void SetY2(float aY2, ErrorResult& rv); - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicAbs, PATHSEG_CURVETO_CUBIC_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoCubicAbs, dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_ABS) protected: float mArgs[6]; @@ -383,7 +389,8 @@ public: mArgs[5] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicRel, PATHSEG_CURVETO_CUBIC_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoCubicRel, dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_REL) float X(); void SetX(float aX, ErrorResult& rv); @@ -416,7 +423,8 @@ public: mArgs[3] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticAbs, PATHSEG_CURVETO_QUADRATIC_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoQuadraticAbs, dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_ABS) float X(); void SetX(float aX, ErrorResult& rv); @@ -445,7 +453,8 @@ public: mArgs[3] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticRel, PATHSEG_CURVETO_QUADRATIC_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoQuadraticRel, dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_REL) float X(); void SetX(float aX, ErrorResult& rv); @@ -478,7 +487,8 @@ public: mArgs[6] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcAbs, PATHSEG_ARC_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + ArcAbs, dom::SVGPathSegBinding::PATHSEG_ARC_ABS) float X(); void SetX(float aX, ErrorResult& rv); @@ -517,7 +527,8 @@ public: mArgs[6] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcRel, PATHSEG_ARC_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + ArcRel, dom::SVGPathSegBinding::PATHSEG_ARC_REL) float X(); void SetX(float aX, ErrorResult& rv); @@ -548,7 +559,8 @@ public: mArgs[0] = x; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoHorizontalAbs, PATHSEG_LINETO_HORIZONTAL_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + LinetoHorizontalAbs, dom::SVGPathSegBinding::PATHSEG_LINETO_HORIZONTAL_ABS) float X(); void SetX(float aX, ErrorResult& rv); @@ -567,7 +579,8 @@ public: mArgs[0] = x; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoHorizontalRel, PATHSEG_LINETO_HORIZONTAL_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + LinetoHorizontalRel, dom::SVGPathSegBinding::PATHSEG_LINETO_HORIZONTAL_REL) float X(); void SetX(float aX, ErrorResult& rv); @@ -586,7 +599,8 @@ public: mArgs[0] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoVerticalAbs, PATHSEG_LINETO_VERTICAL_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + LinetoVerticalAbs, dom::SVGPathSegBinding::PATHSEG_LINETO_VERTICAL_ABS) float Y(); void SetY(float aY, ErrorResult& rv); @@ -605,7 +619,8 @@ public: mArgs[0] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoVerticalRel, PATHSEG_LINETO_VERTICAL_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + LinetoVerticalRel, dom::SVGPathSegBinding::PATHSEG_LINETO_VERTICAL_REL) float Y(); void SetY(float aY, ErrorResult& rv); @@ -628,7 +643,8 @@ public: mArgs[3] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicSmoothAbs, PATHSEG_CURVETO_CUBIC_SMOOTH_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoCubicSmoothAbs, dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS) float X(); void SetX(float aX, ErrorResult& rv); @@ -657,7 +673,8 @@ public: mArgs[3] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicSmoothRel, PATHSEG_CURVETO_CUBIC_SMOOTH_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoCubicSmoothRel, dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_SMOOTH_REL) float X(); void SetX(float aX, ErrorResult& rv); @@ -683,7 +700,8 @@ public: mArgs[1] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticSmoothAbs, PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoQuadraticSmoothAbs, dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS) float X(); void SetX(float aX, ErrorResult& rv); @@ -705,7 +723,8 @@ public: mArgs[1] = y; } - IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticSmoothRel, PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL) + IMPL_SVGPATHSEG_SUBCLASS_COMMON( + CurvetoQuadraticSmoothRel, dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL) float X(); void SetX(float aX, ErrorResult& rv); diff --git a/dom/svg/SVGAnimatedPreserveAspectRatio.h b/dom/svg/SVGAnimatedPreserveAspectRatio.h index 6b940936e6cd..c29026a23157 100644 --- a/dom/svg/SVGAnimatedPreserveAspectRatio.h +++ b/dom/svg/SVGAnimatedPreserveAspectRatio.h @@ -27,8 +27,10 @@ class SVGAnimatedPreserveAspectRatio final { public: void Init() { - mBaseVal.mAlign = SVG_PRESERVEASPECTRATIO_XMIDYMID; - mBaseVal.mMeetOrSlice = SVG_MEETORSLICE_MEET; + mBaseVal.mAlign = + dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_XMIDYMID; + mBaseVal.mMeetOrSlice = + dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_MEET; mAnimVal = mBaseVal; mIsAnimated = false; mIsBaseSet = false; @@ -45,8 +47,7 @@ public: if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID) { return NS_ERROR_FAILURE; } - SetBaseValue(SVGPreserveAspectRatio( - static_cast(aAlign), mBaseVal.GetMeetOrSlice()), + SetBaseValue(SVGPreserveAspectRatio(aAlign, mBaseVal.GetMeetOrSlice()), aSVGElement); return NS_OK; } @@ -55,8 +56,7 @@ public: aMeetOrSlice > SVG_MEETORSLICE_MAX_VALID) { return NS_ERROR_FAILURE; } - SetBaseValue(SVGPreserveAspectRatio( - mBaseVal.GetAlign(), static_cast(aMeetOrSlice)), + SetBaseValue(SVGPreserveAspectRatio(mBaseVal.GetAlign(), aMeetOrSlice), aSVGElement); return NS_OK; } diff --git a/dom/svg/SVGClipPathElement.cpp b/dom/svg/SVGClipPathElement.cpp index 60d72fdf042c..4220c206a3f1 100644 --- a/dom/svg/SVGClipPathElement.cpp +++ b/dom/svg/SVGClipPathElement.cpp @@ -8,6 +8,7 @@ #include "mozilla/dom/SVGClipPathElement.h" #include "mozilla/dom/SVGClipPathElementBinding.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "nsGkAtoms.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ClipPath) @@ -15,6 +16,8 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ClipPath) namespace mozilla { namespace dom { +using namespace SVGUnitTypesBinding; + JSObject* SVGClipPathElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { diff --git a/dom/svg/SVGContentUtils.cpp b/dom/svg/SVGContentUtils.cpp index a6bf6245e95e..c584b82b08ff 100644 --- a/dom/svg/SVGContentUtils.cpp +++ b/dom/svg/SVGContentUtils.cpp @@ -35,6 +35,7 @@ using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGPreserveAspectRatioBinding; using namespace mozilla::gfx; SVGSVGElement* @@ -552,8 +553,8 @@ SVGContentUtils::GetViewBoxTransform(float aViewportWidth, float aViewportHeight NS_ASSERTION(aViewboxWidth > 0, "viewBox width must be greater than zero!"); NS_ASSERTION(aViewboxHeight > 0, "viewBox height must be greater than zero!"); - SVGAlign align = aPreserveAspectRatio.GetAlign(); - SVGMeetOrSlice meetOrSlice = aPreserveAspectRatio.GetMeetOrSlice(); + uint16_t align = aPreserveAspectRatio.GetAlign(); + uint16_t meetOrSlice = aPreserveAspectRatio.GetMeetOrSlice(); // default to the defaults if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN) diff --git a/dom/svg/SVGFilterElement.cpp b/dom/svg/SVGFilterElement.cpp index 0eef637049ef..61abe8a48015 100644 --- a/dom/svg/SVGFilterElement.cpp +++ b/dom/svg/SVGFilterElement.cpp @@ -11,6 +11,7 @@ #include "mozilla/dom/SVGFilterElement.h" #include "mozilla/dom/SVGFilterElementBinding.h" #include "mozilla/dom/SVGLengthBinding.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "nsSVGUtils.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter) @@ -18,6 +19,8 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter) namespace mozilla { namespace dom { +using namespace SVGUnitTypesBinding; + JSObject* SVGFilterElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { diff --git a/dom/svg/SVGGradientElement.cpp b/dom/svg/SVGGradientElement.cpp index 7757ec3549cc..81d5b6d4608b 100644 --- a/dom/svg/SVGGradientElement.cpp +++ b/dom/svg/SVGGradientElement.cpp @@ -8,9 +8,11 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/dom/SVGAnimatedTransformList.h" +#include "mozilla/dom/SVGGradientElementBinding.h" #include "mozilla/dom/SVGRadialGradientElementBinding.h" #include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLinearGradientElementBinding.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "nsCOMPtr.h" #include "nsGkAtoms.h" #include "nsSVGElement.h" @@ -21,6 +23,9 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(RadialGradient) namespace mozilla { namespace dom { +using namespace SVGGradientElementBinding; +using namespace SVGUnitTypesBinding; + //--------------------- Gradients------------------------ nsSVGEnumMapping SVGGradientElement::sSpreadMethodMap[] = { diff --git a/dom/svg/SVGGradientElement.h b/dom/svg/SVGGradientElement.h index af1c06428ca8..9dfa5dfdd296 100644 --- a/dom/svg/SVGGradientElement.h +++ b/dom/svg/SVGGradientElement.h @@ -14,11 +14,6 @@ #include "nsSVGEnum.h" #include "nsSVGString.h" -static const unsigned short SVG_SPREADMETHOD_UNKNOWN = 0; -static const unsigned short SVG_SPREADMETHOD_PAD = 1; -static const unsigned short SVG_SPREADMETHOD_REFLECT = 2; -static const unsigned short SVG_SPREADMETHOD_REPEAT = 3; - class nsSVGGradientFrame; class nsSVGLinearGradientFrame; class nsSVGRadialGradientFrame; diff --git a/dom/svg/SVGMarkerElement.cpp b/dom/svg/SVGMarkerElement.cpp index 369ec0698289..ec979f455f42 100644 --- a/dom/svg/SVGMarkerElement.cpp +++ b/dom/svg/SVGMarkerElement.cpp @@ -20,12 +20,15 @@ #include "SVGContentUtils.h" using namespace mozilla::gfx; +using namespace mozilla::dom::SVGMarkerElementBinding; NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Marker) namespace mozilla { namespace dom { +using namespace SVGAngleBinding; + JSObject* SVGMarkerElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { diff --git a/dom/svg/SVGMarkerElement.h b/dom/svg/SVGMarkerElement.h index 26e068a90789..c5e80f0f222b 100644 --- a/dom/svg/SVGMarkerElement.h +++ b/dom/svg/SVGMarkerElement.h @@ -16,6 +16,7 @@ #include "nsSVGElement.h" #include "mozilla/Attributes.h" #include "mozilla/dom/SVGAnimatedEnumeration.h" +#include "mozilla/dom/SVGMarkerElementBinding.h" class nsSVGMarkerFrame; struct nsSVGMark; @@ -26,23 +27,15 @@ nsresult NS_NewSVGMarkerElement(nsIContent **aResult, namespace mozilla { namespace dom { -// Marker Unit Types -static const unsigned short SVG_MARKERUNITS_UNKNOWN = 0; -static const unsigned short SVG_MARKERUNITS_USERSPACEONUSE = 1; -static const unsigned short SVG_MARKERUNITS_STROKEWIDTH = 2; - -// Marker Orientation Types -static const unsigned short SVG_MARKER_ORIENT_UNKNOWN = 0; -static const unsigned short SVG_MARKER_ORIENT_AUTO = 1; -static const unsigned short SVG_MARKER_ORIENT_ANGLE = 2; -static const unsigned short SVG_MARKER_ORIENT_AUTO_START_REVERSE = 3; +// Non-Exposed Marker Orientation Types +static const uint16_t SVG_MARKER_ORIENT_AUTO_START_REVERSE = 3; class nsSVGOrientType { public: nsSVGOrientType() - : mAnimVal(SVG_MARKER_ORIENT_ANGLE), - mBaseVal(SVG_MARKER_ORIENT_ANGLE) {} + : mAnimVal(SVGMarkerElementBinding::SVG_MARKER_ORIENT_ANGLE), + mBaseVal(SVGMarkerElementBinding::SVG_MARKER_ORIENT_ANGLE) {} nsresult SetBaseValue(uint16_t aValue, nsSVGElement *aSVGElement); @@ -59,10 +52,10 @@ public: // Web content uint16_t GetBaseValue() const { return mAnimVal == SVG_MARKER_ORIENT_AUTO_START_REVERSE ? - SVG_MARKER_ORIENT_UNKNOWN : mBaseVal; } + SVGMarkerElementBinding::SVG_MARKER_ORIENT_UNKNOWN : mBaseVal; } uint16_t GetAnimValue() const { return mAnimVal == SVG_MARKER_ORIENT_AUTO_START_REVERSE ? - SVG_MARKER_ORIENT_UNKNOWN : mAnimVal; } + SVGMarkerElementBinding::SVG_MARKER_ORIENT_UNKNOWN : mAnimVal; } uint16_t GetAnimValueInternal() const { return mAnimVal; } diff --git a/dom/svg/SVGMaskElement.cpp b/dom/svg/SVGMaskElement.cpp index 364fb17a0a36..62e352d2ddc1 100644 --- a/dom/svg/SVGMaskElement.cpp +++ b/dom/svg/SVGMaskElement.cpp @@ -11,12 +11,15 @@ #include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGMaskElement.h" #include "mozilla/dom/SVGMaskElementBinding.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Mask) namespace mozilla { namespace dom { +using namespace SVGUnitTypesBinding; + JSObject* SVGMaskElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { diff --git a/dom/svg/SVGMotionSMILAnimationFunction.cpp b/dom/svg/SVGMotionSMILAnimationFunction.cpp index 5709b81ae3af..24bb8bcbf648 100644 --- a/dom/svg/SVGMotionSMILAnimationFunction.cpp +++ b/dom/svg/SVGMotionSMILAnimationFunction.cpp @@ -18,6 +18,7 @@ #include "SVGMotionSMILPathUtils.h" using namespace mozilla::dom; +using namespace mozilla::dom::SVGAngleBinding; using namespace mozilla::gfx; namespace mozilla { diff --git a/dom/svg/SVGOrientSMILType.cpp b/dom/svg/SVGOrientSMILType.cpp index 8e69ef132934..e129c084eb47 100644 --- a/dom/svg/SVGOrientSMILType.cpp +++ b/dom/svg/SVGOrientSMILType.cpp @@ -13,6 +13,9 @@ namespace mozilla { +using namespace dom::SVGAngleBinding; +using namespace dom::SVGMarkerElementBinding; + /*static*/ SVGOrientSMILType SVGOrientSMILType::sSingleton; void @@ -22,7 +25,7 @@ SVGOrientSMILType::Init(nsSMILValue& aValue) const aValue.mU.mOrient.mAngle = 0.0f; aValue.mU.mOrient.mUnit = SVG_ANGLETYPE_UNSPECIFIED; - aValue.mU.mOrient.mOrientType = dom::SVG_MARKER_ORIENT_ANGLE; + aValue.mU.mOrient.mOrientType = SVG_MARKER_ORIENT_ANGLE; aValue.mType = this; } @@ -67,8 +70,8 @@ SVGOrientSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, "Trying to add invalid types"); NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type"); - if (aDest.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE || - aValueToAdd.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE) { + if (aDest.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE || + aValueToAdd.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) { // TODO: it would be nice to be able to add to auto angles return NS_ERROR_FAILURE; } @@ -98,8 +101,8 @@ SVGOrientSMILType::ComputeDistance(const nsSMILValue& aFrom, NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types"); NS_PRECONDITION(aFrom.mType == this, "Unexpected source type"); - if (aFrom.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE || - aTo.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE) { + if (aFrom.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE || + aTo.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) { // TODO: it would be nice to be able to compute distance with auto angles return NS_ERROR_FAILURE; } @@ -127,8 +130,8 @@ SVGOrientSMILType::Interpolate(const nsSMILValue& aStartVal, "Unexpected types for interpolation."); NS_PRECONDITION(aResult.mType == this, "Unexpected result type."); - if (aStartVal.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE || - aEndVal.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE) { + if (aStartVal.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE || + aEndVal.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) { // TODO: it would be nice to be able to handle auto angles too. return NS_ERROR_FAILURE; } diff --git a/dom/svg/SVGPathData.cpp b/dom/svg/SVGPathData.cpp index e31117aa5588..eb8b7e179bd5 100644 --- a/dom/svg/SVGPathData.cpp +++ b/dom/svg/SVGPathData.cpp @@ -23,6 +23,7 @@ #include using namespace mozilla; +using namespace mozilla::dom::SVGPathSegBinding; using namespace mozilla::gfx; static bool IsMoveto(uint16_t aSegType) diff --git a/dom/svg/SVGPathSegUtils.h b/dom/svg/SVGPathSegUtils.h index 9600f5ca1d47..1c461e40e73b 100644 --- a/dom/svg/SVGPathSegUtils.h +++ b/dom/svg/SVGPathSegUtils.h @@ -8,36 +8,15 @@ #define MOZILLA_SVGPATHSEGUTILS_H__ #include "mozilla/ArrayUtils.h" +#include "mozilla/dom/SVGPathSegBinding.h" #include "mozilla/gfx/Point.h" #include "nsDebug.h" namespace mozilla { -// Path Segment Types -static const unsigned short PATHSEG_UNKNOWN = 0; -static const unsigned short PATHSEG_CLOSEPATH = 1; -static const unsigned short PATHSEG_MOVETO_ABS = 2; -static const unsigned short PATHSEG_MOVETO_REL = 3; -static const unsigned short PATHSEG_LINETO_ABS = 4; -static const unsigned short PATHSEG_LINETO_REL = 5; -static const unsigned short PATHSEG_CURVETO_CUBIC_ABS = 6; -static const unsigned short PATHSEG_CURVETO_CUBIC_REL = 7; -static const unsigned short PATHSEG_CURVETO_QUADRATIC_ABS = 8; -static const unsigned short PATHSEG_CURVETO_QUADRATIC_REL = 9; -static const unsigned short PATHSEG_ARC_ABS = 10; -static const unsigned short PATHSEG_ARC_REL = 11; -static const unsigned short PATHSEG_LINETO_HORIZONTAL_ABS = 12; -static const unsigned short PATHSEG_LINETO_HORIZONTAL_REL = 13; -static const unsigned short PATHSEG_LINETO_VERTICAL_ABS = 14; -static const unsigned short PATHSEG_LINETO_VERTICAL_REL = 15; -static const unsigned short PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16; -static const unsigned short PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17; -static const unsigned short PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18; -static const unsigned short PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19; - #define NS_SVG_PATH_SEG_MAX_ARGS 7 -#define NS_SVG_PATH_SEG_FIRST_VALID_TYPE mozilla::PATHSEG_CLOSEPATH -#define NS_SVG_PATH_SEG_LAST_VALID_TYPE mozilla::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL +#define NS_SVG_PATH_SEG_FIRST_VALID_TYPE dom::SVGPathSegBinding::PATHSEG_CLOSEPATH +#define NS_SVG_PATH_SEG_LAST_VALID_TYPE dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL #define NS_SVG_PATH_SEG_TYPE_COUNT (NS_SVG_PATH_SEG_LAST_VALID_TYPE + 1) /** @@ -201,22 +180,22 @@ public: } static bool IsCubicType(uint32_t aType) { - return aType == PATHSEG_CURVETO_CUBIC_REL || - aType == PATHSEG_CURVETO_CUBIC_ABS || - aType == PATHSEG_CURVETO_CUBIC_SMOOTH_REL || - aType == PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; + return aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_REL || + aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_ABS || + aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_SMOOTH_REL || + aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; } static bool IsQuadraticType(uint32_t aType) { - return aType == PATHSEG_CURVETO_QUADRATIC_REL || - aType == PATHSEG_CURVETO_QUADRATIC_ABS || - aType == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL || - aType == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; + return aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_REL || + aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_ABS || + aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL || + aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; } static bool IsArcType(uint32_t aType) { - return aType == PATHSEG_ARC_ABS || - aType == PATHSEG_ARC_REL; + return aType == dom::SVGPathSegBinding::PATHSEG_ARC_ABS || + aType == dom::SVGPathSegBinding::PATHSEG_ARC_REL; } static bool IsRelativeOrAbsoluteType(uint32_t aType) { @@ -224,10 +203,11 @@ public: // When adding a new path segment type, ensure that the returned condition // below is still correct. - static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == + dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "Unexpected type"); - return aType >= PATHSEG_MOVETO_ABS; + return aType >= dom::SVGPathSegBinding::PATHSEG_MOVETO_ABS; } static bool IsRelativeType(uint32_t aType) { @@ -237,7 +217,8 @@ public: // When adding a new path segment type, ensure that the returned condition // below is still correct. - static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == + dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "Unexpected type"); return aType & 1; @@ -250,7 +231,8 @@ public: // When adding a new path segment type, ensure that the returned condition // below is still correct. - static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == + dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "Unexpected type"); return aType | 1; diff --git a/dom/svg/SVGPatternElement.cpp b/dom/svg/SVGPatternElement.cpp index 9c06460992d4..e2e44b7f232d 100644 --- a/dom/svg/SVGPatternElement.cpp +++ b/dom/svg/SVGPatternElement.cpp @@ -12,12 +12,15 @@ #include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGPatternElement.h" #include "mozilla/dom/SVGPatternElementBinding.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Pattern) namespace mozilla { namespace dom { +using namespace SVGUnitTypesBinding; + JSObject* SVGPatternElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { diff --git a/dom/svg/SVGPreserveAspectRatio.cpp b/dom/svg/SVGPreserveAspectRatio.cpp index c1f43d696cb2..d0ca1afd5693 100644 --- a/dom/svg/SVGPreserveAspectRatio.cpp +++ b/dom/svg/SVGPreserveAspectRatio.cpp @@ -12,6 +12,7 @@ using namespace mozilla; using namespace dom; +using namespace SVGPreserveAspectRatioBinding; NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGPreserveAspectRatio, mSVGElement) diff --git a/dom/svg/SVGPreserveAspectRatio.h b/dom/svg/SVGPreserveAspectRatio.h index fc8a33aa57c4..670b50fc58c6 100644 --- a/dom/svg/SVGPreserveAspectRatio.h +++ b/dom/svg/SVGPreserveAspectRatio.h @@ -7,6 +7,7 @@ #ifndef MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_ #define MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_ +#include "mozilla/dom/SVGPreserveAspectRatioBinding.h" #include "mozilla/HashFunctions.h" // for HashGeneric #include "nsWrapperCache.h" @@ -15,37 +16,20 @@ #include "nsSVGElement.h" namespace mozilla { -// Alignment Types -enum SVGAlign : uint8_t { - SVG_PRESERVEASPECTRATIO_UNKNOWN = 0, - SVG_PRESERVEASPECTRATIO_NONE = 1, - SVG_PRESERVEASPECTRATIO_XMINYMIN = 2, - SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3, - SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4, - SVG_PRESERVEASPECTRATIO_XMINYMID = 5, - SVG_PRESERVEASPECTRATIO_XMIDYMID = 6, - SVG_PRESERVEASPECTRATIO_XMAXYMID = 7, - SVG_PRESERVEASPECTRATIO_XMINYMAX = 8, - SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9, - SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10 -}; // These constants represent the range of valid enum values for the // parameter. They exclude the sentinel _UNKNOWN value. -const uint16_t SVG_ALIGN_MIN_VALID = SVG_PRESERVEASPECTRATIO_NONE; -const uint16_t SVG_ALIGN_MAX_VALID = SVG_PRESERVEASPECTRATIO_XMAXYMAX; - -// Meet-or-slice Types -enum SVGMeetOrSlice : uint8_t { - SVG_MEETORSLICE_UNKNOWN = 0, - SVG_MEETORSLICE_MEET = 1, - SVG_MEETORSLICE_SLICE = 2 -}; +const uint16_t SVG_ALIGN_MIN_VALID = + dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_NONE; +const uint16_t SVG_ALIGN_MAX_VALID = + dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_XMAXYMAX; // These constants represent the range of valid enum values for the // parameter. They exclude the sentinel _UNKNOWN value. -const uint16_t SVG_MEETORSLICE_MIN_VALID = SVG_MEETORSLICE_MEET; -const uint16_t SVG_MEETORSLICE_MAX_VALID = SVG_MEETORSLICE_SLICE; +const uint16_t SVG_MEETORSLICE_MIN_VALID = + dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_MEET; +const uint16_t SVG_MEETORSLICE_MAX_VALID = + dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_SLICE; class SVGAnimatedPreserveAspectRatio; @@ -54,11 +38,11 @@ class SVGPreserveAspectRatio final friend class SVGAnimatedPreserveAspectRatio; public: explicit SVGPreserveAspectRatio() - : mAlign(SVG_PRESERVEASPECTRATIO_UNKNOWN) - , mMeetOrSlice(SVG_MEETORSLICE_UNKNOWN) + : mAlign(dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_UNKNOWN) + , mMeetOrSlice(dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_UNKNOWN) {} - SVGPreserveAspectRatio(SVGAlign aAlign, SVGMeetOrSlice aMeetOrSlice) + SVGPreserveAspectRatio(uint16_t aAlign, uint16_t aMeetOrSlice) : mAlign(aAlign) , mMeetOrSlice(aMeetOrSlice) {} @@ -76,8 +60,8 @@ public: return NS_OK; } - SVGAlign GetAlign() const { - return static_cast(mAlign); + uint16_t GetAlign() const { + return mAlign; } nsresult SetMeetOrSlice(uint16_t aMeetOrSlice) { @@ -88,8 +72,8 @@ public: return NS_OK; } - SVGMeetOrSlice GetMeetOrSlice() const { - return static_cast(mMeetOrSlice); + uint16_t GetMeetOrSlice() const { + return mMeetOrSlice; } PLDHashNumber Hash() const { diff --git a/dom/svg/SVGSVGElement.cpp b/dom/svg/SVGSVGElement.cpp index bb6f0e08739e..6d7d5ad34e6c 100644 --- a/dom/svg/SVGSVGElement.cpp +++ b/dom/svg/SVGSVGElement.cpp @@ -32,6 +32,9 @@ using namespace mozilla::gfx; namespace mozilla { namespace dom { +using namespace SVGPreserveAspectRatioBinding; +using namespace SVGSVGElementBinding; + nsSVGEnumMapping SVGSVGElement::sZoomAndPanMap[] = { {&nsGkAtoms::disable, SVG_ZOOMANDPAN_DISABLE}, {&nsGkAtoms::magnify, SVG_ZOOMANDPAN_MAGNIFY}, diff --git a/dom/svg/SVGTextContentElement.cpp b/dom/svg/SVGTextContentElement.cpp index d0f2919ab424..fcf644050e81 100644 --- a/dom/svg/SVGTextContentElement.cpp +++ b/dom/svg/SVGTextContentElement.cpp @@ -7,6 +7,7 @@ #include "mozilla/dom/SVGTextContentElement.h" #include "mozilla/dom/SVGLengthBinding.h" +#include "mozilla/dom/SVGTextContentElementBinding.h" #include "mozilla/dom/SVGIRect.h" #include "nsBidiUtils.h" #include "nsISVGPoint.h" @@ -18,15 +19,17 @@ namespace mozilla { namespace dom { +using namespace SVGTextContentElementBinding; + nsSVGEnumMapping SVGTextContentElement::sLengthAdjustMap[] = { - { &nsGkAtoms::spacing, SVG_LENGTHADJUST_SPACING }, - { &nsGkAtoms::spacingAndGlyphs, SVG_LENGTHADJUST_SPACINGANDGLYPHS }, + { &nsGkAtoms::spacing, LENGTHADJUST_SPACING }, + { &nsGkAtoms::spacingAndGlyphs, LENGTHADJUST_SPACINGANDGLYPHS }, { nullptr, 0 } }; nsSVGElement::EnumInfo SVGTextContentElement::sEnumInfo[1] = { - { &nsGkAtoms::lengthAdjust, sLengthAdjustMap, SVG_LENGTHADJUST_SPACING } + { &nsGkAtoms::lengthAdjust, sLengthAdjustMap, LENGTHADJUST_SPACING } }; nsSVGElement::LengthInfo SVGTextContentElement::sLengthInfo[1] = diff --git a/dom/svg/SVGTextContentElement.h b/dom/svg/SVGTextContentElement.h index 99172b5ea2a1..712d9492b5a0 100644 --- a/dom/svg/SVGTextContentElement.h +++ b/dom/svg/SVGTextContentElement.h @@ -12,10 +12,6 @@ #include "nsSVGEnum.h" #include "nsSVGLength2.h" -static const unsigned short SVG_LENGTHADJUST_UNKNOWN = 0; -static const unsigned short SVG_LENGTHADJUST_SPACING = 1; -static const unsigned short SVG_LENGTHADJUST_SPACINGANDGLYPHS = 2; - class SVGTextFrame; namespace mozilla { diff --git a/dom/svg/SVGTextPathElement.cpp b/dom/svg/SVGTextPathElement.cpp index fa0cdfc13f73..824618a21cdb 100644 --- a/dom/svg/SVGTextPathElement.cpp +++ b/dom/svg/SVGTextPathElement.cpp @@ -6,6 +6,7 @@ #include "mozilla/dom/SVGTextPathElement.h" #include "mozilla/dom/SVGLengthBinding.h" +#include "mozilla/dom/SVGTextContentElementBinding.h" #include "mozilla/dom/SVGTextPathElementBinding.h" #include "nsSVGElement.h" #include "nsGkAtoms.h" @@ -16,6 +17,9 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TextPath) namespace mozilla { namespace dom { +using namespace SVGTextContentElementBinding; +using namespace SVGTextPathElementBinding; + class SVGAnimatedLength; JSObject* @@ -49,7 +53,7 @@ nsSVGElement::EnumInfo SVGTextPathElement::sEnumInfo[3] = // from SVGTextContentElement: { &nsGkAtoms::lengthAdjust, sLengthAdjustMap, - SVG_LENGTHADJUST_SPACING + LENGTHADJUST_SPACING }, // from SVGTextPathElement: { &nsGkAtoms::method, diff --git a/dom/svg/SVGTextPathElement.h b/dom/svg/SVGTextPathElement.h index 4857cb712c50..4e1535d05735 100644 --- a/dom/svg/SVGTextPathElement.h +++ b/dom/svg/SVGTextPathElement.h @@ -21,15 +21,6 @@ nsresult NS_NewSVGTextPathElement(nsIContent **aResult, namespace mozilla { namespace dom { -// textPath Method Types -static const unsigned short TEXTPATH_METHODTYPE_UNKNOWN = 0; -static const unsigned short TEXTPATH_METHODTYPE_ALIGN = 1; -static const unsigned short TEXTPATH_METHODTYPE_STRETCH = 2; -// textPath Spacing Types -static const unsigned short TEXTPATH_SPACINGTYPE_UNKNOWN = 0; -static const unsigned short TEXTPATH_SPACINGTYPE_AUTO = 1; -static const unsigned short TEXTPATH_SPACINGTYPE_EXACT = 2; - typedef SVGTextContentElement SVGTextPathElementBase; class SVGTextPathElement final : public SVGTextPathElementBase diff --git a/dom/svg/SVGTransform.cpp b/dom/svg/SVGTransform.cpp index 1cba997eb1f6..ec83d2c68d82 100644 --- a/dom/svg/SVGTransform.cpp +++ b/dom/svg/SVGTransform.cpp @@ -22,6 +22,8 @@ namespace { namespace mozilla { namespace dom { +using namespace SVGTransformBinding; + static nsSVGAttrTearoffTable& SVGMatrixTearoffTable() { diff --git a/dom/svg/SVGTransformListSMILType.cpp b/dom/svg/SVGTransformListSMILType.cpp index 40777b026bd4..dd617a65e03c 100644 --- a/dom/svg/SVGTransformListSMILType.cpp +++ b/dom/svg/SVGTransformListSMILType.cpp @@ -12,6 +12,7 @@ #include using namespace mozilla; +using namespace dom::SVGTransformBinding; typedef FallibleTArray TransformArray; diff --git a/dom/svg/SVGViewElement.cpp b/dom/svg/SVGViewElement.cpp index a9c5c1621299..65310a394e26 100644 --- a/dom/svg/SVGViewElement.cpp +++ b/dom/svg/SVGViewElement.cpp @@ -13,6 +13,8 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(View) namespace mozilla { namespace dom { +using namespace SVGViewElementBinding; + JSObject* SVGViewElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { diff --git a/dom/svg/SVGViewElement.h b/dom/svg/SVGViewElement.h index d7756cdd481f..2ddeff16dc6a 100644 --- a/dom/svg/SVGViewElement.h +++ b/dom/svg/SVGViewElement.h @@ -13,10 +13,6 @@ #include "SVGAnimatedPreserveAspectRatio.h" #include "SVGStringList.h" -static const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0; -static const unsigned short SVG_ZOOMANDPAN_DISABLE = 1; -static const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2; - typedef nsSVGElement SVGViewElementBase; class nsSVGOuterSVGFrame; diff --git a/dom/svg/nsSVGAngle.cpp b/dom/svg/nsSVGAngle.cpp index b7ef0354adf3..b78afb5a57d5 100644 --- a/dom/svg/nsSVGAngle.cpp +++ b/dom/svg/nsSVGAngle.cpp @@ -19,6 +19,8 @@ using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGAngleBinding; +using namespace mozilla::dom::SVGMarkerElementBinding; static nsStaticAtom** const unitMap[] = { diff --git a/dom/svg/nsSVGAngle.h b/dom/svg/nsSVGAngle.h index e18bcf087297..0f3cfb06a6cc 100644 --- a/dom/svg/nsSVGAngle.h +++ b/dom/svg/nsSVGAngle.h @@ -11,6 +11,7 @@ #include "nsError.h" #include "nsISMILAttr.h" #include "mozilla/Attributes.h" +#include "mozilla/dom/SVGAngleBinding.h" #include "mozilla/UniquePtr.h" class nsISupports; @@ -19,13 +20,6 @@ class nsSVGElement; namespace mozilla { -// Angle Unit Types -static const unsigned short SVG_ANGLETYPE_UNKNOWN = 0; -static const unsigned short SVG_ANGLETYPE_UNSPECIFIED = 1; -static const unsigned short SVG_ANGLETYPE_DEG = 2; -static const unsigned short SVG_ANGLETYPE_RAD = 3; -static const unsigned short SVG_ANGLETYPE_GRAD = 4; - namespace dom { class nsSVGOrientType; class SVGAngle; @@ -42,7 +36,8 @@ class nsSVGAngle public: void Init(uint8_t aAttrEnum = 0xff, float aValue = 0, - uint8_t aUnitType = mozilla::SVG_ANGLETYPE_UNSPECIFIED) { + uint8_t aUnitType = + mozilla::dom::SVGAngleBinding::SVG_ANGLETYPE_UNSPECIFIED) { mAnimVal = mBaseVal = aValue; mAnimValUnit = mBaseValUnit = aUnitType; mAttrEnum = aAttrEnum; diff --git a/dom/svg/nsSVGElement.cpp b/dom/svg/nsSVGElement.cpp index 538fc6c3dcdd..8bdca15bfbd6 100644 --- a/dom/svg/nsSVGElement.cpp +++ b/dom/svg/nsSVGElement.cpp @@ -13,6 +13,7 @@ #include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGSVGElement.h" #include "mozilla/dom/SVGTests.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "nsContentUtils.h" #include "nsICSSDeclaration.h" #include "nsIContentInlines.h" @@ -64,6 +65,7 @@ using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGUnitTypesBinding; // This is needed to ensure correct handling of calls to the // vararg-list methods in this file: diff --git a/dom/svg/nsSVGElement.h b/dom/svg/nsSVGElement.h index 5672b1257d49..4962c76c09e5 100644 --- a/dom/svg/nsSVGElement.h +++ b/dom/svg/nsSVGElement.h @@ -46,10 +46,6 @@ namespace dom { class SVGSVGElement; class SVGViewportElement; -static const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0; -static const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1; -static const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2; - } // namespace dom class SVGAnimatedNumberList; diff --git a/dom/svg/nsSVGPathDataParser.cpp b/dom/svg/nsSVGPathDataParser.cpp index bf946fdf6d70..dad32b69424d 100644 --- a/dom/svg/nsSVGPathDataParser.cpp +++ b/dom/svg/nsSVGPathDataParser.cpp @@ -13,6 +13,7 @@ #include "SVGPathSegUtils.h" using namespace mozilla; +using namespace mozilla::dom::SVGPathSegBinding; using namespace mozilla::gfx; static inline char16_t ToUpper(char16_t aCh) diff --git a/dom/svg/nsSVGTransform.cpp b/dom/svg/nsSVGTransform.cpp index 8946e898cd7a..26b2338c023a 100644 --- a/dom/svg/nsSVGTransform.cpp +++ b/dom/svg/nsSVGTransform.cpp @@ -15,6 +15,8 @@ namespace { namespace mozilla { +using namespace dom::SVGTransformBinding; + void nsSVGTransform::GetValueAsString(nsAString& aValue) const { diff --git a/dom/svg/nsSVGTransform.h b/dom/svg/nsSVGTransform.h index e689b6867611..81cc1717cbae 100644 --- a/dom/svg/nsSVGTransform.h +++ b/dom/svg/nsSVGTransform.h @@ -8,20 +8,12 @@ #define MOZILLA_SVGTRANSFORM_H__ #include "gfxMatrix.h" +#include "mozilla/dom/SVGTransformBinding.h" #include "mozilla/gfx/Matrix.h" #include "nsDebug.h" namespace mozilla { -// Transform Types -static const unsigned short SVG_TRANSFORM_UNKNOWN = 0; -static const unsigned short SVG_TRANSFORM_MATRIX = 1; -static const unsigned short SVG_TRANSFORM_TRANSLATE = 2; -static const unsigned short SVG_TRANSFORM_SCALE = 3; -static const unsigned short SVG_TRANSFORM_ROTATE = 4; -static const unsigned short SVG_TRANSFORM_SKEWX = 5; -static const unsigned short SVG_TRANSFORM_SKEWY = 6; - /* * The DOM wrapper class for this class is DOMSVGTransformMatrix. */ @@ -34,7 +26,7 @@ public: , mAngle(0.f) , mOriginX(0.f) , mOriginY(0.f) - , mType(SVG_TRANSFORM_MATRIX) + , mType(dom::SVGTransformBinding::SVG_TRANSFORM_MATRIX) { } explicit nsSVGTransform(const gfxMatrix& aMatrix) @@ -42,7 +34,7 @@ public: , mAngle(0.f) , mOriginX(0.f) , mOriginY(0.f) - , mType(SVG_TRANSFORM_MATRIX) + , mType(dom::SVGTransformBinding::SVG_TRANSFORM_MATRIX) { } bool operator==(const nsSVGTransform& rhs) const { @@ -127,7 +119,8 @@ public: explicit SVGTransformSMILData(uint16_t aType) : mTransformType(aType) { - MOZ_ASSERT(aType >= SVG_TRANSFORM_MATRIX && aType <= SVG_TRANSFORM_SKEWY, + MOZ_ASSERT(aType >=dom::SVGTransformBinding:: SVG_TRANSFORM_MATRIX && + aType <= dom::SVGTransformBinding::SVG_TRANSFORM_SKEWY, "Unexpected transform type"); for (uint32_t i = 0; i < NUM_STORED_PARAMS; ++i) { mParams[i] = 0.f; @@ -137,7 +130,8 @@ public: SVGTransformSMILData(uint16_t aType, float (&aParams)[NUM_SIMPLE_PARAMS]) : mTransformType(aType) { - MOZ_ASSERT(aType >= SVG_TRANSFORM_TRANSLATE && aType <= SVG_TRANSFORM_SKEWY, + MOZ_ASSERT(aType >= dom::SVGTransformBinding::SVG_TRANSFORM_TRANSLATE && + aType <= dom::SVGTransformBinding::SVG_TRANSFORM_SKEWY, "Expected 'simple' transform type"); for (uint32_t i = 0; i < NUM_SIMPLE_PARAMS; ++i) { mParams[i] = aParams[i]; diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp index 7239bf460392..bd0332b691ba 100644 --- a/image/VectorImage.cpp +++ b/image/VectorImage.cpp @@ -44,6 +44,7 @@ namespace mozilla { using namespace dom; +using namespace dom::SVGPreserveAspectRatioBinding; using namespace gfx; using namespace layers; diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index 4a76b3e88db0..f9c8f49a67ba 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -31,6 +31,7 @@ #include "nsSVGOuterSVGFrame.h" #include "nsSVGPaintServerFrame.h" #include "mozilla/dom/SVGRect.h" +#include "mozilla/dom/SVGTextContentElementBinding.h" #include "nsSVGIntegrationUtils.h" #include "nsSVGUtils.h" #include "nsTArray.h" @@ -52,6 +53,7 @@ using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGTextContentElementBinding; using namespace mozilla::gfx; using namespace mozilla::image; @@ -5302,7 +5304,7 @@ SVGTextFrame::DoGlyphPositioning() RefPtr lengthAdjustEnum = element->LengthAdjust(); uint16_t lengthAdjust = lengthAdjustEnum->AnimVal(); switch (lengthAdjust) { - case SVG_LENGTHADJUST_SPACINGANDGLYPHS: + case LENGTHADJUST_SPACINGANDGLYPHS: // Scale the glyphs and their positions. if (actualTextLength > 0) { mLengthAdjustScaleFactor = expectedTextLength / actualTextLength; @@ -5310,7 +5312,7 @@ SVGTextFrame::DoGlyphPositioning() break; default: - MOZ_ASSERT(lengthAdjust == SVG_LENGTHADJUST_SPACING); + MOZ_ASSERT(lengthAdjust == LENGTHADJUST_SPACING); // Just add space between each glyph. int32_t adjustableSpaces = 0; for (uint32_t i = 1; i < mPositions.Length(); i++) { diff --git a/layout/svg/nsSVGFilterInstance.cpp b/layout/svg/nsSVGFilterInstance.cpp index a996f142b8a7..4d36e3d0761a 100644 --- a/layout/svg/nsSVGFilterInstance.cpp +++ b/layout/svg/nsSVGFilterInstance.cpp @@ -14,6 +14,7 @@ #include "mozilla/dom/HTMLCanvasElement.h" #include "mozilla/dom/IDTracker.h" #include "mozilla/dom/SVGLengthBinding.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "mozilla/dom/SVGFilterElement.h" #include "SVGObserverUtils.h" #include "nsSVGFilterFrame.h" @@ -24,6 +25,7 @@ using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGUnitTypesBinding; using namespace mozilla::gfx; nsSVGFilterInstance::nsSVGFilterInstance(const nsStyleFilter& aFilter, diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index 5e4bfdfbb112..cb2bed379fde 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -12,7 +12,9 @@ #include "AutoReferenceChainGuard.h" #include "gfxPattern.h" #include "mozilla/dom/SVGGradientElement.h" +#include "mozilla/dom/SVGGradientElementBinding.h" #include "mozilla/dom/SVGStopElement.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "nsContentUtils.h" #include "SVGObserverUtils.h" #include "nsSVGAnimatedTransformList.h" @@ -21,6 +23,8 @@ using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGGradientElementBinding; +using namespace mozilla::dom::SVGUnitTypesBinding; using namespace mozilla::gfx; //---------------------------------------------------------------------- diff --git a/layout/svg/nsSVGMaskFrame.cpp b/layout/svg/nsSVGMaskFrame.cpp index 30274cab7ad6..73c1ac356bd0 100644 --- a/layout/svg/nsSVGMaskFrame.cpp +++ b/layout/svg/nsSVGMaskFrame.cpp @@ -15,9 +15,11 @@ #include "mozilla/RefPtr.h" #include "SVGObserverUtils.h" #include "mozilla/dom/SVGMaskElement.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGUnitTypesBinding; using namespace mozilla::gfx; using namespace mozilla::image; diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index ac995e11d66f..b3c3f62cfdb9 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -22,12 +22,14 @@ #include "SVGObserverUtils.h" #include "SVGGeometryFrame.h" #include "mozilla/dom/SVGPatternElement.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "nsSVGUtils.h" #include "nsSVGAnimatedTransformList.h" #include "SVGContentUtils.h" using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGUnitTypesBinding; using namespace mozilla::gfx; using namespace mozilla::image; diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index b39b0f0e8928..0583443ea06d 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -47,6 +47,7 @@ #include "nsSVGOuterSVGFrame.h" #include "mozilla/dom/SVGClipPathElement.h" #include "mozilla/dom/SVGPathElement.h" +#include "mozilla/dom/SVGUnitTypesBinding.h" #include "SVGGeometryElement.h" #include "SVGGeometryFrame.h" #include "nsSVGPaintServerFrame.h" @@ -58,6 +59,7 @@ using namespace mozilla; using namespace mozilla::dom; +using namespace mozilla::dom::SVGUnitTypesBinding; using namespace mozilla::gfx; using namespace mozilla::image;