Bug 1435477 - Make the SVG dom code use the WebIDL constants from the bindings r=jwatt

This commit is contained in:
Robert Longson 2018-02-18 15:53:13 +00:00
parent db56d2ee65
commit 728a3f36fc
41 changed files with 179 additions and 172 deletions

View File

@ -14,6 +14,8 @@
namespace mozilla { namespace mozilla {
using namespace dom::SVGPathSegBinding;
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to // 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 // 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 // not unlink and rely on the breaking of the other edges in the cycle, as

View File

@ -22,7 +22,7 @@ namespace mozilla {
#define CHECK_ARG_COUNT_IN_SYNC(segType) \ #define CHECK_ARG_COUNT_IN_SYNC(segType) \
MOZ_ASSERT(ArrayLength(mArgs) == \ MOZ_ASSERT(ArrayLength(mArgs) == \
SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \ SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \
uint32_t(segType) == PATHSEG_CLOSEPATH, \ uint32_t(segType) == dom::SVGPathSegBinding::PATHSEG_CLOSEPATH, \
"Arg count/array size out of sync") "Arg count/array size out of sync")
#define IMPL_SVGPATHSEG_SUBCLASS_COMMON(segName, segType) \ #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: protected:
// To allow IMPL_SVGPATHSEG_SUBCLASS_COMMON above to compile we need an // To allow IMPL_SVGPATHSEG_SUBCLASS_COMMON above to compile we need an
@ -253,7 +254,8 @@ public:
mArgs[1] = y; mArgs[1] = y;
} }
IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoAbs, PATHSEG_MOVETO_ABS) IMPL_SVGPATHSEG_SUBCLASS_COMMON(
MovetoAbs, dom::SVGPathSegBinding::PATHSEG_MOVETO_ABS)
float X(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -275,7 +277,8 @@ public:
mArgs[1] = y; mArgs[1] = y;
} }
IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoRel, PATHSEG_MOVETO_REL) IMPL_SVGPATHSEG_SUBCLASS_COMMON(
MovetoRel, dom::SVGPathSegBinding::PATHSEG_MOVETO_REL)
float X(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -297,7 +300,8 @@ public:
mArgs[1] = y; mArgs[1] = y;
} }
IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoAbs, PATHSEG_LINETO_ABS) IMPL_SVGPATHSEG_SUBCLASS_COMMON(
LinetoAbs, dom::SVGPathSegBinding::PATHSEG_LINETO_ABS)
float X(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -319,7 +323,8 @@ public:
mArgs[1] = y; mArgs[1] = y;
} }
IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoRel, PATHSEG_LINETO_REL) IMPL_SVGPATHSEG_SUBCLASS_COMMON(
LinetoRel, dom::SVGPathSegBinding::PATHSEG_LINETO_REL)
float X(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -360,7 +365,8 @@ public:
float Y2(); float Y2();
void SetY2(float aY2, ErrorResult& rv); 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: protected:
float mArgs[6]; float mArgs[6];
@ -383,7 +389,8 @@ public:
mArgs[5] = y; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -416,7 +423,8 @@ public:
mArgs[3] = y; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -445,7 +453,8 @@ public:
mArgs[3] = y; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -478,7 +487,8 @@ public:
mArgs[6] = y; mArgs[6] = y;
} }
IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcAbs, PATHSEG_ARC_ABS) IMPL_SVGPATHSEG_SUBCLASS_COMMON(
ArcAbs, dom::SVGPathSegBinding::PATHSEG_ARC_ABS)
float X(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -517,7 +527,8 @@ public:
mArgs[6] = y; mArgs[6] = y;
} }
IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcRel, PATHSEG_ARC_REL) IMPL_SVGPATHSEG_SUBCLASS_COMMON(
ArcRel, dom::SVGPathSegBinding::PATHSEG_ARC_REL)
float X(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -548,7 +559,8 @@ public:
mArgs[0] = x; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -567,7 +579,8 @@ public:
mArgs[0] = x; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -586,7 +599,8 @@ public:
mArgs[0] = y; 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(); float Y();
void SetY(float aY, ErrorResult& rv); void SetY(float aY, ErrorResult& rv);
@ -605,7 +619,8 @@ public:
mArgs[0] = y; 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(); float Y();
void SetY(float aY, ErrorResult& rv); void SetY(float aY, ErrorResult& rv);
@ -628,7 +643,8 @@ public:
mArgs[3] = y; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -657,7 +673,8 @@ public:
mArgs[3] = y; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -683,7 +700,8 @@ public:
mArgs[1] = y; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);
@ -705,7 +723,8 @@ public:
mArgs[1] = y; 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(); float X();
void SetX(float aX, ErrorResult& rv); void SetX(float aX, ErrorResult& rv);

View File

@ -27,8 +27,10 @@ class SVGAnimatedPreserveAspectRatio final
{ {
public: public:
void Init() { void Init() {
mBaseVal.mAlign = SVG_PRESERVEASPECTRATIO_XMIDYMID; mBaseVal.mAlign =
mBaseVal.mMeetOrSlice = SVG_MEETORSLICE_MEET; dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_XMIDYMID;
mBaseVal.mMeetOrSlice =
dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_MEET;
mAnimVal = mBaseVal; mAnimVal = mBaseVal;
mIsAnimated = false; mIsAnimated = false;
mIsBaseSet = false; mIsBaseSet = false;
@ -45,8 +47,7 @@ public:
if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID) { if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
SetBaseValue(SVGPreserveAspectRatio( SetBaseValue(SVGPreserveAspectRatio(aAlign, mBaseVal.GetMeetOrSlice()),
static_cast<SVGAlign>(aAlign), mBaseVal.GetMeetOrSlice()),
aSVGElement); aSVGElement);
return NS_OK; return NS_OK;
} }
@ -55,8 +56,7 @@ public:
aMeetOrSlice > SVG_MEETORSLICE_MAX_VALID) { aMeetOrSlice > SVG_MEETORSLICE_MAX_VALID) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
SetBaseValue(SVGPreserveAspectRatio( SetBaseValue(SVGPreserveAspectRatio(mBaseVal.GetAlign(), aMeetOrSlice),
mBaseVal.GetAlign(), static_cast<SVGMeetOrSlice>(aMeetOrSlice)),
aSVGElement); aSVGElement);
return NS_OK; return NS_OK;
} }

View File

@ -8,6 +8,7 @@
#include "mozilla/dom/SVGClipPathElement.h" #include "mozilla/dom/SVGClipPathElement.h"
#include "mozilla/dom/SVGClipPathElementBinding.h" #include "mozilla/dom/SVGClipPathElementBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ClipPath) NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ClipPath)
@ -15,6 +16,8 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ClipPath)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGUnitTypesBinding;
JSObject* JSObject*
SVGClipPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) SVGClipPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{ {

View File

@ -35,6 +35,7 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGPreserveAspectRatioBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
SVGSVGElement* SVGSVGElement*
@ -552,8 +553,8 @@ SVGContentUtils::GetViewBoxTransform(float aViewportWidth, float aViewportHeight
NS_ASSERTION(aViewboxWidth > 0, "viewBox width must be greater than zero!"); NS_ASSERTION(aViewboxWidth > 0, "viewBox width must be greater than zero!");
NS_ASSERTION(aViewboxHeight > 0, "viewBox height must be greater than zero!"); NS_ASSERTION(aViewboxHeight > 0, "viewBox height must be greater than zero!");
SVGAlign align = aPreserveAspectRatio.GetAlign(); uint16_t align = aPreserveAspectRatio.GetAlign();
SVGMeetOrSlice meetOrSlice = aPreserveAspectRatio.GetMeetOrSlice(); uint16_t meetOrSlice = aPreserveAspectRatio.GetMeetOrSlice();
// default to the defaults // default to the defaults
if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN) if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN)

View File

@ -11,6 +11,7 @@
#include "mozilla/dom/SVGFilterElement.h" #include "mozilla/dom/SVGFilterElement.h"
#include "mozilla/dom/SVGFilterElementBinding.h" #include "mozilla/dom/SVGFilterElementBinding.h"
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "nsSVGUtils.h" #include "nsSVGUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter) NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter)
@ -18,6 +19,8 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGUnitTypesBinding;
JSObject* JSObject*
SVGFilterElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) SVGFilterElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{ {

View File

@ -8,9 +8,11 @@
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/dom/SVGAnimatedTransformList.h" #include "mozilla/dom/SVGAnimatedTransformList.h"
#include "mozilla/dom/SVGGradientElementBinding.h"
#include "mozilla/dom/SVGRadialGradientElementBinding.h" #include "mozilla/dom/SVGRadialGradientElementBinding.h"
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGLinearGradientElementBinding.h" #include "mozilla/dom/SVGLinearGradientElementBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsSVGElement.h" #include "nsSVGElement.h"
@ -21,6 +23,9 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(RadialGradient)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGGradientElementBinding;
using namespace SVGUnitTypesBinding;
//--------------------- Gradients------------------------ //--------------------- Gradients------------------------
nsSVGEnumMapping SVGGradientElement::sSpreadMethodMap[] = { nsSVGEnumMapping SVGGradientElement::sSpreadMethodMap[] = {

View File

@ -14,11 +14,6 @@
#include "nsSVGEnum.h" #include "nsSVGEnum.h"
#include "nsSVGString.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 nsSVGGradientFrame;
class nsSVGLinearGradientFrame; class nsSVGLinearGradientFrame;
class nsSVGRadialGradientFrame; class nsSVGRadialGradientFrame;

View File

@ -20,12 +20,15 @@
#include "SVGContentUtils.h" #include "SVGContentUtils.h"
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::dom::SVGMarkerElementBinding;
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Marker) NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Marker)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGAngleBinding;
JSObject* JSObject*
SVGMarkerElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) SVGMarkerElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{ {

View File

@ -16,6 +16,7 @@
#include "nsSVGElement.h" #include "nsSVGElement.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/dom/SVGAnimatedEnumeration.h" #include "mozilla/dom/SVGAnimatedEnumeration.h"
#include "mozilla/dom/SVGMarkerElementBinding.h"
class nsSVGMarkerFrame; class nsSVGMarkerFrame;
struct nsSVGMark; struct nsSVGMark;
@ -26,23 +27,15 @@ nsresult NS_NewSVGMarkerElement(nsIContent **aResult,
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
// Marker Unit Types // Non-Exposed Marker Orientation Types
static const unsigned short SVG_MARKERUNITS_UNKNOWN = 0; static const uint16_t SVG_MARKER_ORIENT_AUTO_START_REVERSE = 3;
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;
class nsSVGOrientType class nsSVGOrientType
{ {
public: public:
nsSVGOrientType() nsSVGOrientType()
: mAnimVal(SVG_MARKER_ORIENT_ANGLE), : mAnimVal(SVGMarkerElementBinding::SVG_MARKER_ORIENT_ANGLE),
mBaseVal(SVG_MARKER_ORIENT_ANGLE) {} mBaseVal(SVGMarkerElementBinding::SVG_MARKER_ORIENT_ANGLE) {}
nsresult SetBaseValue(uint16_t aValue, nsresult SetBaseValue(uint16_t aValue,
nsSVGElement *aSVGElement); nsSVGElement *aSVGElement);
@ -59,10 +52,10 @@ public:
// Web content // Web content
uint16_t GetBaseValue() const uint16_t GetBaseValue() const
{ return mAnimVal == SVG_MARKER_ORIENT_AUTO_START_REVERSE ? { return mAnimVal == SVG_MARKER_ORIENT_AUTO_START_REVERSE ?
SVG_MARKER_ORIENT_UNKNOWN : mBaseVal; } SVGMarkerElementBinding::SVG_MARKER_ORIENT_UNKNOWN : mBaseVal; }
uint16_t GetAnimValue() const uint16_t GetAnimValue() const
{ return mAnimVal == SVG_MARKER_ORIENT_AUTO_START_REVERSE ? { return mAnimVal == SVG_MARKER_ORIENT_AUTO_START_REVERSE ?
SVG_MARKER_ORIENT_UNKNOWN : mAnimVal; } SVGMarkerElementBinding::SVG_MARKER_ORIENT_UNKNOWN : mAnimVal; }
uint16_t GetAnimValueInternal() const uint16_t GetAnimValueInternal() const
{ return mAnimVal; } { return mAnimVal; }

View File

@ -11,12 +11,15 @@
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGMaskElement.h" #include "mozilla/dom/SVGMaskElement.h"
#include "mozilla/dom/SVGMaskElementBinding.h" #include "mozilla/dom/SVGMaskElementBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Mask) NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Mask)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGUnitTypesBinding;
JSObject* JSObject*
SVGMaskElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) SVGMaskElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{ {

View File

@ -18,6 +18,7 @@
#include "SVGMotionSMILPathUtils.h" #include "SVGMotionSMILPathUtils.h"
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGAngleBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
namespace mozilla { namespace mozilla {

View File

@ -13,6 +13,9 @@
namespace mozilla { namespace mozilla {
using namespace dom::SVGAngleBinding;
using namespace dom::SVGMarkerElementBinding;
/*static*/ SVGOrientSMILType SVGOrientSMILType::sSingleton; /*static*/ SVGOrientSMILType SVGOrientSMILType::sSingleton;
void void
@ -22,7 +25,7 @@ SVGOrientSMILType::Init(nsSMILValue& aValue) const
aValue.mU.mOrient.mAngle = 0.0f; aValue.mU.mOrient.mAngle = 0.0f;
aValue.mU.mOrient.mUnit = SVG_ANGLETYPE_UNSPECIFIED; 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; aValue.mType = this;
} }
@ -67,8 +70,8 @@ SVGOrientSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
"Trying to add invalid types"); "Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type"); NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
if (aDest.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE || if (aDest.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aValueToAdd.mU.mOrient.mOrientType != dom::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 // TODO: it would be nice to be able to add to auto angles
return NS_ERROR_FAILURE; 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 == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type"); NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
if (aFrom.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE || if (aFrom.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aTo.mU.mOrient.mOrientType != dom::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 // TODO: it would be nice to be able to compute distance with auto angles
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -127,8 +130,8 @@ SVGOrientSMILType::Interpolate(const nsSMILValue& aStartVal,
"Unexpected types for interpolation."); "Unexpected types for interpolation.");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type."); NS_PRECONDITION(aResult.mType == this, "Unexpected result type.");
if (aStartVal.mU.mOrient.mOrientType != dom::SVG_MARKER_ORIENT_ANGLE || if (aStartVal.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aEndVal.mU.mOrient.mOrientType != dom::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. // TODO: it would be nice to be able to handle auto angles too.
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

View File

@ -23,6 +23,7 @@
#include <algorithm> #include <algorithm>
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom::SVGPathSegBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
static bool IsMoveto(uint16_t aSegType) static bool IsMoveto(uint16_t aSegType)

View File

@ -8,36 +8,15 @@
#define MOZILLA_SVGPATHSEGUTILS_H__ #define MOZILLA_SVGPATHSEGUTILS_H__
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/dom/SVGPathSegBinding.h"
#include "mozilla/gfx/Point.h" #include "mozilla/gfx/Point.h"
#include "nsDebug.h" #include "nsDebug.h"
namespace mozilla { 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_MAX_ARGS 7
#define NS_SVG_PATH_SEG_FIRST_VALID_TYPE mozilla::PATHSEG_CLOSEPATH #define NS_SVG_PATH_SEG_FIRST_VALID_TYPE dom::SVGPathSegBinding::PATHSEG_CLOSEPATH
#define NS_SVG_PATH_SEG_LAST_VALID_TYPE mozilla::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL #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) #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) { static bool IsCubicType(uint32_t aType) {
return aType == PATHSEG_CURVETO_CUBIC_REL || return aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_REL ||
aType == PATHSEG_CURVETO_CUBIC_ABS || aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_ABS ||
aType == PATHSEG_CURVETO_CUBIC_SMOOTH_REL || aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_SMOOTH_REL ||
aType == PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
} }
static bool IsQuadraticType(uint32_t aType) { static bool IsQuadraticType(uint32_t aType) {
return aType == PATHSEG_CURVETO_QUADRATIC_REL || return aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_REL ||
aType == PATHSEG_CURVETO_QUADRATIC_ABS || aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_ABS ||
aType == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL || aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL ||
aType == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; aType == dom::SVGPathSegBinding::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
} }
static bool IsArcType(uint32_t aType) { static bool IsArcType(uint32_t aType) {
return aType == PATHSEG_ARC_ABS || return aType == dom::SVGPathSegBinding::PATHSEG_ARC_ABS ||
aType == PATHSEG_ARC_REL; aType == dom::SVGPathSegBinding::PATHSEG_ARC_REL;
} }
static bool IsRelativeOrAbsoluteType(uint32_t aType) { static bool IsRelativeOrAbsoluteType(uint32_t aType) {
@ -224,10 +203,11 @@ public:
// When adding a new path segment type, ensure that the returned condition // When adding a new path segment type, ensure that the returned condition
// below is still correct. // 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"); "Unexpected type");
return aType >= PATHSEG_MOVETO_ABS; return aType >= dom::SVGPathSegBinding::PATHSEG_MOVETO_ABS;
} }
static bool IsRelativeType(uint32_t aType) { static bool IsRelativeType(uint32_t aType) {
@ -237,7 +217,8 @@ public:
// When adding a new path segment type, ensure that the returned condition // When adding a new path segment type, ensure that the returned condition
// below is still correct. // 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"); "Unexpected type");
return aType & 1; return aType & 1;
@ -250,7 +231,8 @@ public:
// When adding a new path segment type, ensure that the returned condition // When adding a new path segment type, ensure that the returned condition
// below is still correct. // 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"); "Unexpected type");
return aType | 1; return aType | 1;

View File

@ -12,12 +12,15 @@
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGPatternElement.h" #include "mozilla/dom/SVGPatternElement.h"
#include "mozilla/dom/SVGPatternElementBinding.h" #include "mozilla/dom/SVGPatternElementBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Pattern) NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Pattern)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGUnitTypesBinding;
JSObject* JSObject*
SVGPatternElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) SVGPatternElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{ {

View File

@ -12,6 +12,7 @@
using namespace mozilla; using namespace mozilla;
using namespace dom; using namespace dom;
using namespace SVGPreserveAspectRatioBinding;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGPreserveAspectRatio, mSVGElement) NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGPreserveAspectRatio, mSVGElement)

View File

@ -7,6 +7,7 @@
#ifndef MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_ #ifndef MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_
#define MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_ #define MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_
#include "mozilla/dom/SVGPreserveAspectRatioBinding.h"
#include "mozilla/HashFunctions.h" // for HashGeneric #include "mozilla/HashFunctions.h" // for HashGeneric
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
@ -15,37 +16,20 @@
#include "nsSVGElement.h" #include "nsSVGElement.h"
namespace mozilla { 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 <align> // These constants represent the range of valid enum values for the <align>
// parameter. They exclude the sentinel _UNKNOWN value. // parameter. They exclude the sentinel _UNKNOWN value.
const uint16_t SVG_ALIGN_MIN_VALID = SVG_PRESERVEASPECTRATIO_NONE; const uint16_t SVG_ALIGN_MIN_VALID =
const uint16_t SVG_ALIGN_MAX_VALID = SVG_PRESERVEASPECTRATIO_XMAXYMAX; dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_NONE;
const uint16_t SVG_ALIGN_MAX_VALID =
// Meet-or-slice Types dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_XMAXYMAX;
enum SVGMeetOrSlice : uint8_t {
SVG_MEETORSLICE_UNKNOWN = 0,
SVG_MEETORSLICE_MEET = 1,
SVG_MEETORSLICE_SLICE = 2
};
// These constants represent the range of valid enum values for the // These constants represent the range of valid enum values for the
// <meetOrSlice> parameter. They exclude the sentinel _UNKNOWN value. // <meetOrSlice> parameter. They exclude the sentinel _UNKNOWN value.
const uint16_t SVG_MEETORSLICE_MIN_VALID = SVG_MEETORSLICE_MEET; const uint16_t SVG_MEETORSLICE_MIN_VALID =
const uint16_t SVG_MEETORSLICE_MAX_VALID = SVG_MEETORSLICE_SLICE; dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_MEET;
const uint16_t SVG_MEETORSLICE_MAX_VALID =
dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_SLICE;
class SVGAnimatedPreserveAspectRatio; class SVGAnimatedPreserveAspectRatio;
@ -54,11 +38,11 @@ class SVGPreserveAspectRatio final
friend class SVGAnimatedPreserveAspectRatio; friend class SVGAnimatedPreserveAspectRatio;
public: public:
explicit SVGPreserveAspectRatio() explicit SVGPreserveAspectRatio()
: mAlign(SVG_PRESERVEASPECTRATIO_UNKNOWN) : mAlign(dom::SVGPreserveAspectRatioBinding::SVG_PRESERVEASPECTRATIO_UNKNOWN)
, mMeetOrSlice(SVG_MEETORSLICE_UNKNOWN) , mMeetOrSlice(dom::SVGPreserveAspectRatioBinding::SVG_MEETORSLICE_UNKNOWN)
{} {}
SVGPreserveAspectRatio(SVGAlign aAlign, SVGMeetOrSlice aMeetOrSlice) SVGPreserveAspectRatio(uint16_t aAlign, uint16_t aMeetOrSlice)
: mAlign(aAlign) : mAlign(aAlign)
, mMeetOrSlice(aMeetOrSlice) , mMeetOrSlice(aMeetOrSlice)
{} {}
@ -76,8 +60,8 @@ public:
return NS_OK; return NS_OK;
} }
SVGAlign GetAlign() const { uint16_t GetAlign() const {
return static_cast<SVGAlign>(mAlign); return mAlign;
} }
nsresult SetMeetOrSlice(uint16_t aMeetOrSlice) { nsresult SetMeetOrSlice(uint16_t aMeetOrSlice) {
@ -88,8 +72,8 @@ public:
return NS_OK; return NS_OK;
} }
SVGMeetOrSlice GetMeetOrSlice() const { uint16_t GetMeetOrSlice() const {
return static_cast<SVGMeetOrSlice>(mMeetOrSlice); return mMeetOrSlice;
} }
PLDHashNumber Hash() const { PLDHashNumber Hash() const {

View File

@ -32,6 +32,9 @@ using namespace mozilla::gfx;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGPreserveAspectRatioBinding;
using namespace SVGSVGElementBinding;
nsSVGEnumMapping SVGSVGElement::sZoomAndPanMap[] = { nsSVGEnumMapping SVGSVGElement::sZoomAndPanMap[] = {
{&nsGkAtoms::disable, SVG_ZOOMANDPAN_DISABLE}, {&nsGkAtoms::disable, SVG_ZOOMANDPAN_DISABLE},
{&nsGkAtoms::magnify, SVG_ZOOMANDPAN_MAGNIFY}, {&nsGkAtoms::magnify, SVG_ZOOMANDPAN_MAGNIFY},

View File

@ -7,6 +7,7 @@
#include "mozilla/dom/SVGTextContentElement.h" #include "mozilla/dom/SVGTextContentElement.h"
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGTextContentElementBinding.h"
#include "mozilla/dom/SVGIRect.h" #include "mozilla/dom/SVGIRect.h"
#include "nsBidiUtils.h" #include "nsBidiUtils.h"
#include "nsISVGPoint.h" #include "nsISVGPoint.h"
@ -18,15 +19,17 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGTextContentElementBinding;
nsSVGEnumMapping SVGTextContentElement::sLengthAdjustMap[] = { nsSVGEnumMapping SVGTextContentElement::sLengthAdjustMap[] = {
{ &nsGkAtoms::spacing, SVG_LENGTHADJUST_SPACING }, { &nsGkAtoms::spacing, LENGTHADJUST_SPACING },
{ &nsGkAtoms::spacingAndGlyphs, SVG_LENGTHADJUST_SPACINGANDGLYPHS }, { &nsGkAtoms::spacingAndGlyphs, LENGTHADJUST_SPACINGANDGLYPHS },
{ nullptr, 0 } { nullptr, 0 }
}; };
nsSVGElement::EnumInfo SVGTextContentElement::sEnumInfo[1] = nsSVGElement::EnumInfo SVGTextContentElement::sEnumInfo[1] =
{ {
{ &nsGkAtoms::lengthAdjust, sLengthAdjustMap, SVG_LENGTHADJUST_SPACING } { &nsGkAtoms::lengthAdjust, sLengthAdjustMap, LENGTHADJUST_SPACING }
}; };
nsSVGElement::LengthInfo SVGTextContentElement::sLengthInfo[1] = nsSVGElement::LengthInfo SVGTextContentElement::sLengthInfo[1] =

View File

@ -12,10 +12,6 @@
#include "nsSVGEnum.h" #include "nsSVGEnum.h"
#include "nsSVGLength2.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; class SVGTextFrame;
namespace mozilla { namespace mozilla {

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/SVGTextPathElement.h" #include "mozilla/dom/SVGTextPathElement.h"
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGTextContentElementBinding.h"
#include "mozilla/dom/SVGTextPathElementBinding.h" #include "mozilla/dom/SVGTextPathElementBinding.h"
#include "nsSVGElement.h" #include "nsSVGElement.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
@ -16,6 +17,9 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TextPath)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGTextContentElementBinding;
using namespace SVGTextPathElementBinding;
class SVGAnimatedLength; class SVGAnimatedLength;
JSObject* JSObject*
@ -49,7 +53,7 @@ nsSVGElement::EnumInfo SVGTextPathElement::sEnumInfo[3] =
// from SVGTextContentElement: // from SVGTextContentElement:
{ &nsGkAtoms::lengthAdjust, { &nsGkAtoms::lengthAdjust,
sLengthAdjustMap, sLengthAdjustMap,
SVG_LENGTHADJUST_SPACING LENGTHADJUST_SPACING
}, },
// from SVGTextPathElement: // from SVGTextPathElement:
{ &nsGkAtoms::method, { &nsGkAtoms::method,

View File

@ -21,15 +21,6 @@ nsresult NS_NewSVGTextPathElement(nsIContent **aResult,
namespace mozilla { namespace mozilla {
namespace dom { 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; typedef SVGTextContentElement SVGTextPathElementBase;
class SVGTextPathElement final : public SVGTextPathElementBase class SVGTextPathElement final : public SVGTextPathElementBase

View File

@ -22,6 +22,8 @@ namespace {
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGTransformBinding;
static nsSVGAttrTearoffTable<SVGTransform, SVGMatrix>& static nsSVGAttrTearoffTable<SVGTransform, SVGMatrix>&
SVGMatrixTearoffTable() SVGMatrixTearoffTable()
{ {

View File

@ -12,6 +12,7 @@
#include <math.h> #include <math.h>
using namespace mozilla; using namespace mozilla;
using namespace dom::SVGTransformBinding;
typedef FallibleTArray<SVGTransformSMILData> TransformArray; typedef FallibleTArray<SVGTransformSMILData> TransformArray;

View File

@ -13,6 +13,8 @@ NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(View)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
using namespace SVGViewElementBinding;
JSObject* JSObject*
SVGViewElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) SVGViewElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{ {

View File

@ -13,10 +13,6 @@
#include "SVGAnimatedPreserveAspectRatio.h" #include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGStringList.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; typedef nsSVGElement SVGViewElementBase;
class nsSVGOuterSVGFrame; class nsSVGOuterSVGFrame;

View File

@ -19,6 +19,8 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGAngleBinding;
using namespace mozilla::dom::SVGMarkerElementBinding;
static nsStaticAtom** const unitMap[] = static nsStaticAtom** const unitMap[] =
{ {

View File

@ -11,6 +11,7 @@
#include "nsError.h" #include "nsError.h"
#include "nsISMILAttr.h" #include "nsISMILAttr.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/dom/SVGAngleBinding.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
class nsISupports; class nsISupports;
@ -19,13 +20,6 @@ class nsSVGElement;
namespace mozilla { 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 { namespace dom {
class nsSVGOrientType; class nsSVGOrientType;
class SVGAngle; class SVGAngle;
@ -42,7 +36,8 @@ class nsSVGAngle
public: public:
void Init(uint8_t aAttrEnum = 0xff, void Init(uint8_t aAttrEnum = 0xff,
float aValue = 0, float aValue = 0,
uint8_t aUnitType = mozilla::SVG_ANGLETYPE_UNSPECIFIED) { uint8_t aUnitType =
mozilla::dom::SVGAngleBinding::SVG_ANGLETYPE_UNSPECIFIED) {
mAnimVal = mBaseVal = aValue; mAnimVal = mBaseVal = aValue;
mAnimValUnit = mBaseValUnit = aUnitType; mAnimValUnit = mBaseValUnit = aUnitType;
mAttrEnum = aAttrEnum; mAttrEnum = aAttrEnum;

View File

@ -13,6 +13,7 @@
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGSVGElement.h" #include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/SVGTests.h" #include "mozilla/dom/SVGTests.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsICSSDeclaration.h" #include "nsICSSDeclaration.h"
#include "nsIContentInlines.h" #include "nsIContentInlines.h"
@ -64,6 +65,7 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGUnitTypesBinding;
// This is needed to ensure correct handling of calls to the // This is needed to ensure correct handling of calls to the
// vararg-list methods in this file: // vararg-list methods in this file:

View File

@ -46,10 +46,6 @@ namespace dom {
class SVGSVGElement; class SVGSVGElement;
class SVGViewportElement; 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 } // namespace dom
class SVGAnimatedNumberList; class SVGAnimatedNumberList;

View File

@ -13,6 +13,7 @@
#include "SVGPathSegUtils.h" #include "SVGPathSegUtils.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom::SVGPathSegBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
static inline char16_t ToUpper(char16_t aCh) static inline char16_t ToUpper(char16_t aCh)

View File

@ -15,6 +15,8 @@ namespace {
namespace mozilla { namespace mozilla {
using namespace dom::SVGTransformBinding;
void void
nsSVGTransform::GetValueAsString(nsAString& aValue) const nsSVGTransform::GetValueAsString(nsAString& aValue) const
{ {

View File

@ -8,20 +8,12 @@
#define MOZILLA_SVGTRANSFORM_H__ #define MOZILLA_SVGTRANSFORM_H__
#include "gfxMatrix.h" #include "gfxMatrix.h"
#include "mozilla/dom/SVGTransformBinding.h"
#include "mozilla/gfx/Matrix.h" #include "mozilla/gfx/Matrix.h"
#include "nsDebug.h" #include "nsDebug.h"
namespace mozilla { 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. * The DOM wrapper class for this class is DOMSVGTransformMatrix.
*/ */
@ -34,7 +26,7 @@ public:
, mAngle(0.f) , mAngle(0.f)
, mOriginX(0.f) , mOriginX(0.f)
, mOriginY(0.f) , mOriginY(0.f)
, mType(SVG_TRANSFORM_MATRIX) , mType(dom::SVGTransformBinding::SVG_TRANSFORM_MATRIX)
{ } { }
explicit nsSVGTransform(const gfxMatrix& aMatrix) explicit nsSVGTransform(const gfxMatrix& aMatrix)
@ -42,7 +34,7 @@ public:
, mAngle(0.f) , mAngle(0.f)
, mOriginX(0.f) , mOriginX(0.f)
, mOriginY(0.f) , mOriginY(0.f)
, mType(SVG_TRANSFORM_MATRIX) , mType(dom::SVGTransformBinding::SVG_TRANSFORM_MATRIX)
{ } { }
bool operator==(const nsSVGTransform& rhs) const { bool operator==(const nsSVGTransform& rhs) const {
@ -127,7 +119,8 @@ public:
explicit SVGTransformSMILData(uint16_t aType) explicit SVGTransformSMILData(uint16_t aType)
: mTransformType(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"); "Unexpected transform type");
for (uint32_t i = 0; i < NUM_STORED_PARAMS; ++i) { for (uint32_t i = 0; i < NUM_STORED_PARAMS; ++i) {
mParams[i] = 0.f; mParams[i] = 0.f;
@ -137,7 +130,8 @@ public:
SVGTransformSMILData(uint16_t aType, float (&aParams)[NUM_SIMPLE_PARAMS]) SVGTransformSMILData(uint16_t aType, float (&aParams)[NUM_SIMPLE_PARAMS])
: mTransformType(aType) : 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"); "Expected 'simple' transform type");
for (uint32_t i = 0; i < NUM_SIMPLE_PARAMS; ++i) { for (uint32_t i = 0; i < NUM_SIMPLE_PARAMS; ++i) {
mParams[i] = aParams[i]; mParams[i] = aParams[i];

View File

@ -44,6 +44,7 @@
namespace mozilla { namespace mozilla {
using namespace dom; using namespace dom;
using namespace dom::SVGPreserveAspectRatioBinding;
using namespace gfx; using namespace gfx;
using namespace layers; using namespace layers;

View File

@ -31,6 +31,7 @@
#include "nsSVGOuterSVGFrame.h" #include "nsSVGOuterSVGFrame.h"
#include "nsSVGPaintServerFrame.h" #include "nsSVGPaintServerFrame.h"
#include "mozilla/dom/SVGRect.h" #include "mozilla/dom/SVGRect.h"
#include "mozilla/dom/SVGTextContentElementBinding.h"
#include "nsSVGIntegrationUtils.h" #include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h" #include "nsSVGUtils.h"
#include "nsTArray.h" #include "nsTArray.h"
@ -52,6 +53,7 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGTextContentElementBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image; using namespace mozilla::image;
@ -5302,7 +5304,7 @@ SVGTextFrame::DoGlyphPositioning()
RefPtr<SVGAnimatedEnumeration> lengthAdjustEnum = element->LengthAdjust(); RefPtr<SVGAnimatedEnumeration> lengthAdjustEnum = element->LengthAdjust();
uint16_t lengthAdjust = lengthAdjustEnum->AnimVal(); uint16_t lengthAdjust = lengthAdjustEnum->AnimVal();
switch (lengthAdjust) { switch (lengthAdjust) {
case SVG_LENGTHADJUST_SPACINGANDGLYPHS: case LENGTHADJUST_SPACINGANDGLYPHS:
// Scale the glyphs and their positions. // Scale the glyphs and their positions.
if (actualTextLength > 0) { if (actualTextLength > 0) {
mLengthAdjustScaleFactor = expectedTextLength / actualTextLength; mLengthAdjustScaleFactor = expectedTextLength / actualTextLength;
@ -5310,7 +5312,7 @@ SVGTextFrame::DoGlyphPositioning()
break; break;
default: default:
MOZ_ASSERT(lengthAdjust == SVG_LENGTHADJUST_SPACING); MOZ_ASSERT(lengthAdjust == LENGTHADJUST_SPACING);
// Just add space between each glyph. // Just add space between each glyph.
int32_t adjustableSpaces = 0; int32_t adjustableSpaces = 0;
for (uint32_t i = 1; i < mPositions.Length(); i++) { for (uint32_t i = 1; i < mPositions.Length(); i++) {

View File

@ -14,6 +14,7 @@
#include "mozilla/dom/HTMLCanvasElement.h" #include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/dom/IDTracker.h" #include "mozilla/dom/IDTracker.h"
#include "mozilla/dom/SVGLengthBinding.h" #include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "mozilla/dom/SVGFilterElement.h" #include "mozilla/dom/SVGFilterElement.h"
#include "SVGObserverUtils.h" #include "SVGObserverUtils.h"
#include "nsSVGFilterFrame.h" #include "nsSVGFilterFrame.h"
@ -24,6 +25,7 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGUnitTypesBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
nsSVGFilterInstance::nsSVGFilterInstance(const nsStyleFilter& aFilter, nsSVGFilterInstance::nsSVGFilterInstance(const nsStyleFilter& aFilter,

View File

@ -12,7 +12,9 @@
#include "AutoReferenceChainGuard.h" #include "AutoReferenceChainGuard.h"
#include "gfxPattern.h" #include "gfxPattern.h"
#include "mozilla/dom/SVGGradientElement.h" #include "mozilla/dom/SVGGradientElement.h"
#include "mozilla/dom/SVGGradientElementBinding.h"
#include "mozilla/dom/SVGStopElement.h" #include "mozilla/dom/SVGStopElement.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "SVGObserverUtils.h" #include "SVGObserverUtils.h"
#include "nsSVGAnimatedTransformList.h" #include "nsSVGAnimatedTransformList.h"
@ -21,6 +23,8 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGGradientElementBinding;
using namespace mozilla::dom::SVGUnitTypesBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -15,9 +15,11 @@
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "SVGObserverUtils.h" #include "SVGObserverUtils.h"
#include "mozilla/dom/SVGMaskElement.h" #include "mozilla/dom/SVGMaskElement.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGUnitTypesBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image; using namespace mozilla::image;

View File

@ -22,12 +22,14 @@
#include "SVGObserverUtils.h" #include "SVGObserverUtils.h"
#include "SVGGeometryFrame.h" #include "SVGGeometryFrame.h"
#include "mozilla/dom/SVGPatternElement.h" #include "mozilla/dom/SVGPatternElement.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "nsSVGUtils.h" #include "nsSVGUtils.h"
#include "nsSVGAnimatedTransformList.h" #include "nsSVGAnimatedTransformList.h"
#include "SVGContentUtils.h" #include "SVGContentUtils.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGUnitTypesBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image; using namespace mozilla::image;

View File

@ -47,6 +47,7 @@
#include "nsSVGOuterSVGFrame.h" #include "nsSVGOuterSVGFrame.h"
#include "mozilla/dom/SVGClipPathElement.h" #include "mozilla/dom/SVGClipPathElement.h"
#include "mozilla/dom/SVGPathElement.h" #include "mozilla/dom/SVGPathElement.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "SVGGeometryElement.h" #include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h" #include "SVGGeometryFrame.h"
#include "nsSVGPaintServerFrame.h" #include "nsSVGPaintServerFrame.h"
@ -58,6 +59,7 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::SVGUnitTypesBinding;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image; using namespace mozilla::image;