Bug 1516727 - Part 2 rename SVGAngle to DOMSVGAngle r=jwatt

--HG--
rename : dom/svg/SVGAngle.cpp => dom/svg/DOMSVGAngle.cpp
rename : dom/svg/SVGAngle.h => dom/svg/DOMSVGAngle.h
This commit is contained in:
longsonr 2018-12-30 18:18:30 +00:00
Родитель 55e0dac60d
Коммит 5106b5cfcf
12 изменённых файлов: 62 добавлений и 55 удалений

Просмотреть файл

@ -791,6 +791,11 @@ DOMInterfaces = {
'headerFile': 'SVGAnimatedPreserveAspectRatio.h'
},
'SVGAngle': {
'nativeType': 'mozilla::dom::DOMSVGAngle',
'headerFile': 'DOMSVGAngle.h'
},
'SVGAnimationElement': {
'concrete': False
},

Просмотреть файл

@ -4,44 +4,44 @@
* 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 "SVGAngle.h"
#include "DOMSVGAngle.h"
#include "nsSVGAngle.h"
#include "mozilla/dom/SVGAngleBinding.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(SVGAngle, mSVGElement)
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAngle, mSVGElement)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(SVGAngle, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(SVGAngle, Release)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAngle, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAngle, Release)
SVGAngle::SVGAngle(SVGElement* aSVGElement)
: mSVGElement(aSVGElement), mType(SVGAngle::CreatedValue) {
DOMSVGAngle::DOMSVGAngle(SVGElement* aSVGElement)
: mSVGElement(aSVGElement), mType(DOMSVGAngle::CreatedValue) {
mVal = new nsSVGAngle();
mVal->Init();
}
JSObject* SVGAngle::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
JSObject* DOMSVGAngle::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return SVGAngle_Binding::Wrap(aCx, this, aGivenProto);
}
uint16_t SVGAngle::UnitType() const {
uint16_t DOMSVGAngle::UnitType() const {
if (mType == AnimValue) {
return mVal->mAnimValUnit;
}
return mVal->mBaseValUnit;
}
float SVGAngle::Value() const {
float DOMSVGAngle::Value() const {
if (mType == AnimValue) {
return mVal->GetAnimValue();
}
return mVal->GetBaseValue();
}
void SVGAngle::SetValue(float aValue, ErrorResult& rv) {
void DOMSVGAngle::SetValue(float aValue, ErrorResult& rv) {
if (mType == AnimValue) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -51,14 +51,14 @@ void SVGAngle::SetValue(float aValue, ErrorResult& rv) {
isBaseVal ? mSVGElement.get() : nullptr, isBaseVal);
}
float SVGAngle::ValueInSpecifiedUnits() const {
float DOMSVGAngle::ValueInSpecifiedUnits() const {
if (mType == AnimValue) {
return mVal->mAnimVal;
}
return mVal->mBaseVal;
}
void SVGAngle::SetValueInSpecifiedUnits(float aValue, ErrorResult& rv) {
void DOMSVGAngle::SetValueInSpecifiedUnits(float aValue, ErrorResult& rv) {
if (mType == AnimValue) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -69,9 +69,9 @@ void SVGAngle::SetValueInSpecifiedUnits(float aValue, ErrorResult& rv) {
}
}
void SVGAngle::NewValueSpecifiedUnits(uint16_t unitType,
float valueInSpecifiedUnits,
ErrorResult& rv) {
void DOMSVGAngle::NewValueSpecifiedUnits(uint16_t unitType,
float valueInSpecifiedUnits,
ErrorResult& rv) {
if (mType == AnimValue) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -81,7 +81,7 @@ void SVGAngle::NewValueSpecifiedUnits(uint16_t unitType,
mType == BaseValue ? mSVGElement.get() : nullptr);
}
void SVGAngle::ConvertToSpecifiedUnits(uint16_t unitType, ErrorResult& rv) {
void DOMSVGAngle::ConvertToSpecifiedUnits(uint16_t unitType, ErrorResult& rv) {
if (mType == AnimValue) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -90,7 +90,7 @@ void SVGAngle::ConvertToSpecifiedUnits(uint16_t unitType, ErrorResult& rv) {
unitType, mType == BaseValue ? mSVGElement.get() : nullptr);
}
void SVGAngle::SetValueAsString(const nsAString& aValue, ErrorResult& rv) {
void DOMSVGAngle::SetValueAsString(const nsAString& aValue, ErrorResult& rv) {
if (mType == AnimValue) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -100,7 +100,7 @@ void SVGAngle::SetValueAsString(const nsAString& aValue, ErrorResult& rv) {
isBaseVal);
}
void SVGAngle::GetValueAsString(nsAString& aValue) {
void DOMSVGAngle::GetValueAsString(nsAString& aValue) {
if (mType == AnimValue) {
mVal->GetAnimValueString(aValue);
} else {

Просмотреть файл

@ -16,24 +16,24 @@ class nsSVGAngle;
namespace mozilla {
namespace dom {
class SVGAngle final : public nsWrapperCache {
class DOMSVGAngle final : public nsWrapperCache {
public:
typedef enum { BaseValue, AnimValue, CreatedValue } AngleType;
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(SVGAngle)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(SVGAngle)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAngle)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAngle)
/**
* Generic ctor for SVGAngle objects that are created for an attribute.
* Generic ctor for DOMSVGAngle objects that are created for an attribute.
*/
SVGAngle(nsSVGAngle* aVal, SVGElement* aSVGElement, AngleType aType)
DOMSVGAngle(nsSVGAngle* aVal, SVGElement* aSVGElement, AngleType aType)
: mVal(aVal), mSVGElement(aSVGElement), mType(aType) {}
/**
* Ctor for creating the objects returned by SVGSVGElement.createSVGAngle(),
* which do not initially belong to an attribute.
*/
explicit SVGAngle(SVGElement* aSVGElement);
explicit DOMSVGAngle(SVGElement* aSVGElement);
// WebIDL
SVGElement* GetParentObject() { return mSVGElement; }
@ -50,7 +50,7 @@ class SVGAngle final : public nsWrapperCache {
void ConvertToSpecifiedUnits(uint16_t unitType, ErrorResult& rv);
protected:
~SVGAngle();
~DOMSVGAngle();
nsSVGAngle* mVal; // if mType is CreatedValue, we own the angle. Otherwise,
// the element does.

Просмотреть файл

@ -21,10 +21,10 @@ JSObject* SVGAnimatedAngle::WrapObject(JSContext* aCx,
return SVGAnimatedAngle_Binding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<SVGAngle> SVGAnimatedAngle::BaseVal() {
already_AddRefed<DOMSVGAngle> SVGAnimatedAngle::BaseVal() {
return mVal->ToDOMBaseVal(mSVGElement);
}
already_AddRefed<SVGAngle> SVGAnimatedAngle::AnimVal() {
already_AddRefed<DOMSVGAngle> SVGAnimatedAngle::AnimVal() {
return mVal->ToDOMAnimVal(mSVGElement);
}

Просмотреть файл

@ -16,7 +16,7 @@ class nsSVGAngle;
namespace mozilla {
namespace dom {
class SVGAngle;
class DOMSVGAngle;
class SVGAnimatedAngle final : public nsWrapperCache {
public:
@ -30,8 +30,8 @@ class SVGAnimatedAngle final : public nsWrapperCache {
SVGElement* GetParentObject() { return mSVGElement; }
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
already_AddRefed<SVGAngle> BaseVal();
already_AddRefed<SVGAngle> AnimVal();
already_AddRefed<DOMSVGAngle> BaseVal();
already_AddRefed<DOMSVGAngle> AnimVal();
protected:
~SVGAnimatedAngle();

Просмотреть файл

@ -11,7 +11,7 @@
#include "SVGAnimatedPreserveAspectRatio.h"
#include "nsError.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/SVGAngle.h"
#include "mozilla/dom/DOMSVGAngle.h"
#include "mozilla/dom/SVGGeometryElement.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGMarkerElementBinding.h"
@ -138,7 +138,7 @@ void SVGMarkerElement::SetOrientToAuto() {
NS_LITERAL_STRING("auto"), true);
}
void SVGMarkerElement::SetOrientToAngle(SVGAngle& angle, ErrorResult& rv) {
void SVGMarkerElement::SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv) {
float f = angle.Value();
if (!IsFinite(f)) {
rv.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);

Просмотреть файл

@ -127,7 +127,7 @@ class SVGMarkerElement : public SVGMarkerElementBase {
already_AddRefed<SVGAnimatedEnumeration> OrientType();
already_AddRefed<SVGAnimatedAngle> OrientAngle();
void SetOrientToAuto();
void SetOrientToAngle(SVGAngle& angle, ErrorResult& rv);
void SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv);
protected:
virtual bool ParseAttribute(int32_t aNameSpaceID, nsAtom* aName,

Просмотреть файл

@ -14,6 +14,7 @@
#include "mozilla/EventDispatcher.h"
#include "mozilla/SMILAnimationController.h"
#include "DOMSVGAngle.h"
#include "DOMSVGLength.h"
#include "DOMSVGNumber.h"
#include "DOMSVGPoint.h"
@ -22,7 +23,6 @@
#include "nsIFrame.h"
#include "nsISVGSVGFrame.h"
#include "nsSMILTimeContainer.h"
#include "SVGAngle.h"
#include "nsSVGDisplayableFrame.h"
#include "nsSVGUtils.h"
@ -261,8 +261,8 @@ already_AddRefed<DOMSVGLength> SVGSVGElement::CreateSVGLength() {
return length.forget();
}
already_AddRefed<SVGAngle> SVGSVGElement::CreateSVGAngle() {
return do_AddRef(new SVGAngle(this));
already_AddRefed<DOMSVGAngle> SVGSVGElement::CreateSVGAngle() {
return do_AddRef(new DOMSVGAngle(this));
}
already_AddRefed<nsISVGPoint> SVGSVGElement::CreateSVGPoint() {

Просмотреть файл

@ -21,9 +21,9 @@ class SVGFragmentIdentifier;
class EventChainPreVisitor;
namespace dom {
class DOMSVGAngle;
class DOMSVGLength;
class DOMSVGNumber;
class SVGAngle;
class SVGMatrix;
class SVGIRect;
class SVGSVGElement;
@ -133,7 +133,7 @@ class SVGSVGElement final : public SVGSVGElementBase {
void DeselectAll();
already_AddRefed<DOMSVGNumber> CreateSVGNumber();
already_AddRefed<DOMSVGLength> CreateSVGLength();
already_AddRefed<SVGAngle> CreateSVGAngle();
already_AddRefed<DOMSVGAngle> CreateSVGAngle();
already_AddRefed<nsISVGPoint> CreateSVGPoint();
already_AddRefed<SVGMatrix> CreateSVGMatrix();
already_AddRefed<SVGIRect> CreateSVGRect();

Просмотреть файл

@ -20,9 +20,9 @@ EXPORTS += [
]
EXPORTS.mozilla.dom += [
'DOMSVGAngle.h',
'DOMSVGTransform.h',
'SVGAElement.h',
'SVGAngle.h',
'SVGAnimatedAngle.h',
'SVGAnimatedBoolean.h',
'SVGAnimatedEnumeration.h',
@ -108,6 +108,7 @@ EXPORTS.mozilla.dom += [
]
UNIFIED_SOURCES += [
'DOMSVGAngle.cpp',
'DOMSVGAnimatedLengthList.cpp',
'DOMSVGAnimatedNumberList.cpp',
'DOMSVGAnimatedTransformList.cpp',
@ -136,7 +137,6 @@ UNIFIED_SOURCES += [
'nsSVGString.cpp',
'nsSVGViewBox.cpp',
'SVGAElement.cpp',
'SVGAngle.cpp',
'SVGAnimatedAngle.cpp',
'SVGAnimatedBoolean.cpp',
'SVGAnimatedEnumeration.cpp',

Просмотреть файл

@ -10,10 +10,10 @@
#include "mozilla/dom/SVGMarkerElement.h"
#include "mozilla/Move.h"
#include "nsContentUtils.h" // NS_ENSURE_FINITE
#include "DOMSVGAngle.h"
#include "nsSMILValue.h"
#include "nsSVGAttrTearoffTable.h"
#include "nsTextFormatter.h"
#include "SVGAngle.h"
#include "SVGAnimatedAngle.h"
#include "SVGOrientSMILType.h"
@ -29,8 +29,8 @@ static const nsStaticAtom* const angleUnitMap[] = {
static nsSVGAttrTearoffTable<nsSVGAngle, SVGAnimatedAngle>
sSVGAnimatedAngleTearoffTable;
static nsSVGAttrTearoffTable<nsSVGAngle, SVGAngle> sBaseSVGAngleTearoffTable;
static nsSVGAttrTearoffTable<nsSVGAngle, SVGAngle> sAnimSVGAngleTearoffTable;
static nsSVGAttrTearoffTable<nsSVGAngle, DOMSVGAngle> sBaseSVGAngleTearoffTable;
static nsSVGAttrTearoffTable<nsSVGAngle, DOMSVGAngle> sAnimSVGAngleTearoffTable;
/* Helper functions */
@ -174,27 +174,29 @@ nsresult nsSVGAngle::NewValueSpecifiedUnits(uint16_t unitType,
return NS_OK;
}
already_AddRefed<SVGAngle> nsSVGAngle::ToDOMBaseVal(SVGElement* aSVGElement) {
RefPtr<SVGAngle> domBaseVal = sBaseSVGAngleTearoffTable.GetTearoff(this);
already_AddRefed<DOMSVGAngle> nsSVGAngle::ToDOMBaseVal(
SVGElement* aSVGElement) {
RefPtr<DOMSVGAngle> domBaseVal = sBaseSVGAngleTearoffTable.GetTearoff(this);
if (!domBaseVal) {
domBaseVal = new SVGAngle(this, aSVGElement, SVGAngle::BaseValue);
domBaseVal = new DOMSVGAngle(this, aSVGElement, DOMSVGAngle::BaseValue);
sBaseSVGAngleTearoffTable.AddTearoff(this, domBaseVal);
}
return domBaseVal.forget();
}
already_AddRefed<SVGAngle> nsSVGAngle::ToDOMAnimVal(SVGElement* aSVGElement) {
RefPtr<SVGAngle> domAnimVal = sAnimSVGAngleTearoffTable.GetTearoff(this);
already_AddRefed<DOMSVGAngle> nsSVGAngle::ToDOMAnimVal(
SVGElement* aSVGElement) {
RefPtr<DOMSVGAngle> domAnimVal = sAnimSVGAngleTearoffTable.GetTearoff(this);
if (!domAnimVal) {
domAnimVal = new SVGAngle(this, aSVGElement, SVGAngle::AnimValue);
domAnimVal = new DOMSVGAngle(this, aSVGElement, DOMSVGAngle::AnimValue);
sAnimSVGAngleTearoffTable.AddTearoff(this, domAnimVal);
}
return domAnimVal.forget();
}
SVGAngle::~SVGAngle() {
DOMSVGAngle::~DOMSVGAngle() {
if (mType == BaseValue) {
sBaseSVGAngleTearoffTable.RemoveTearoff(mVal);
} else if (mType == AnimValue) {

Просмотреть файл

@ -21,7 +21,7 @@ namespace mozilla {
namespace dom {
class nsSVGOrientType;
class SVGAngle;
class DOMSVGAngle;
class SVGAnimatedAngle;
class SVGAnimationElement;
class SVGElement;
@ -29,7 +29,7 @@ class SVGElement;
} // namespace mozilla
class nsSVGAngle {
friend class mozilla::dom::SVGAngle;
friend class mozilla::dom::DOMSVGAngle;
friend class mozilla::dom::SVGAnimatedAngle;
typedef mozilla::dom::SVGElement SVGElement;
@ -85,9 +85,9 @@ class nsSVGAngle {
nsresult NewValueSpecifiedUnits(uint16_t aUnitType, float aValue,
SVGElement* aSVGElement);
nsresult ConvertToSpecifiedUnits(uint16_t aUnitType, SVGElement* aSVGElement);
already_AddRefed<mozilla::dom::SVGAngle> ToDOMBaseVal(
already_AddRefed<mozilla::dom::DOMSVGAngle> ToDOMBaseVal(
SVGElement* aSVGElement);
already_AddRefed<mozilla::dom::SVGAngle> ToDOMAnimVal(
already_AddRefed<mozilla::dom::DOMSVGAngle> ToDOMAnimVal(
SVGElement* aSVGElement);
public: