Bug 1540408 Part 2 - Move nsSVGLength2 and nsSVGNumber2 to the mozilla namespace renaming them to be SVGAnimatedLength and SVGAnimatedNumber. r=dholbert

--HG--
rename : dom/svg/nsSVGLength2.h => dom/svg/SVGAnimateLength.h
rename : dom/svg/nsSVGLength2.cpp => dom/svg/SVGAnimatedLength.cpp
rename : dom/svg/nsSVGNumber2.cpp => dom/svg/SVGAnimatedNumber.cpp
rename : dom/svg/nsSVGNumber2.h => dom/svg/SVGAnimatedNumber.h
This commit is contained in:
longsonr 2019-04-09 07:33:14 +01:00
Родитель a3e3bcf2fe
Коммит ef9cb13839
64 изменённых файлов: 275 добавлений и 258 удалений

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

@ -410,7 +410,7 @@ void nsAttrValue::SetTo(const SVGAnimatedIntegerPair& aValue,
SetSVGType(eSVGIntegerPair, &aValue, aSerialized);
}
void nsAttrValue::SetTo(const nsSVGLength2& aValue,
void nsAttrValue::SetTo(const SVGAnimatedLength& aValue,
const nsAString* aSerialized) {
SetSVGType(eSVGLength, &aValue, aSerialized);
}
@ -1610,7 +1610,7 @@ void nsAttrValue::SetSVGType(ValueType aType, const void* aValue,
// will do. We'll lose type-safety but the signature of the calling
// function should ensure we don't get anything unexpected, and once we
// stick aValue in a union we lose type information anyway.
cont->mValue.mSVGLength = static_cast<const nsSVGLength2*>(aValue);
cont->mValue.mSVGLength = static_cast<const SVGAnimatedLength*>(aValue);
cont->mType = aType;
SetMiscAtomOrString(aSerialized);
}

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

@ -153,7 +153,8 @@ class nsAttrValue {
void SetTo(const nsIntMargin& aValue);
void SetTo(const mozilla::SVGAnimatedIntegerPair& aValue,
const nsAString* aSerialized);
void SetTo(const nsSVGLength2& aValue, const nsAString* aSerialized);
void SetTo(const mozilla::SVGAnimatedLength& aValue,
const nsAString* aSerialized);
void SetTo(const mozilla::SVGAnimatedNumberPair& aValue,
const nsAString* aSerialized);
void SetTo(const mozilla::SVGAnimatedOrient& aValue,

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

@ -45,11 +45,11 @@ struct MiscContainer final {
mozilla::AtomArray* mAtomArray;
nsIntMargin* mIntMargin;
const mozilla::SVGAnimatedIntegerPair* mSVGAnimatedIntegerPair;
const mozilla::SVGAnimatedPreserveAspectRatio*
mSVGAnimatedPreserveAspectRatio;
const mozilla::SVGAnimatedLength* mSVGLength;
const mozilla::SVGAnimatedNumberPair* mSVGAnimatedNumberPair;
const mozilla::SVGAnimatedOrient* mSVGAnimatedOrient;
const nsSVGLength2* mSVGLength;
const mozilla::SVGAnimatedPreserveAspectRatio*
mSVGAnimatedPreserveAspectRatio;
const mozilla::SVGAnimatedViewBox* mSVGAnimatedViewBox;
const mozilla::SVGLengthList* mSVGLengthList;
const mozilla::SVGNumberList* mSVGNumberList;

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

@ -111,7 +111,6 @@
#include "nsGlobalWindow.h"
#include "nsIScreenManager.h"
#include "nsFilterInstance.h"
#include "nsSVGLength2.h"
#include "nsDeviceContext.h"
#include "nsFontMetrics.h"
#include "Units.h"

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

@ -7,7 +7,7 @@
#include "DOMSVGAnimatedLength.h"
#include "mozilla/dom/SVGAnimatedLengthBinding.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "DOMSVGLength.h"
namespace mozilla {

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

@ -10,10 +10,10 @@
#include "mozilla/Attributes.h"
#include "SVGElement.h"
class nsSVGLength2;
namespace mozilla {
class SVGAnimatedLength;
namespace dom {
class DOMSVGLength;
@ -23,7 +23,7 @@ class DOMSVGAnimatedLength final : public nsWrapperCache {
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedLength)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedLength)
DOMSVGAnimatedLength(nsSVGLength2* aVal, SVGElement* aSVGElement)
DOMSVGAnimatedLength(SVGAnimatedLength* aVal, SVGElement* aSVGElement)
: mVal(aVal), mSVGElement(aSVGElement) {}
// WebIDL
@ -36,7 +36,7 @@ class DOMSVGAnimatedLength final : public nsWrapperCache {
protected:
~DOMSVGAnimatedLength();
nsSVGLength2* mVal; // kept alive because it belongs to content
SVGAnimatedLength* mVal; // kept alive because it belongs to content
RefPtr<SVGElement> mSVGElement;
};

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

@ -10,10 +10,10 @@
#include "DOMSVGAnimatedLengthList.h"
#include "nsError.h"
#include "nsMathUtils.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedLengthList.h"
#include "SVGAttrTearoffTable.h"
#include "SVGLength.h"
#include "nsSVGLength2.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/FloatingPoint.h"
@ -24,7 +24,7 @@ namespace mozilla {
namespace dom {
static SVGAttrTearoffTable<nsSVGLength2, DOMSVGLength>
static SVGAttrTearoffTable<SVGAnimatedLength, DOMSVGLength>
sBaseSVGLengthTearOffTable, sAnimSVGLengthTearOffTable;
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
@ -117,7 +117,7 @@ DOMSVGLength::DOMSVGLength()
mValue(0.0f),
mVal(nullptr) {}
DOMSVGLength::DOMSVGLength(nsSVGLength2* aVal, SVGElement* aSVGElement,
DOMSVGLength::DOMSVGLength(SVGAnimatedLength* aVal, SVGElement* aSVGElement,
bool aAnimVal)
: mList(nullptr),
mListIndex(0),
@ -149,7 +149,7 @@ void DOMSVGLength::CleanupWeakRefs() {
DOMSVGLength::~DOMSVGLength() { CleanupWeakRefs(); }
already_AddRefed<DOMSVGLength> DOMSVGLength::GetTearOff(nsSVGLength2* aVal,
already_AddRefed<DOMSVGLength> DOMSVGLength::GetTearOff(SVGAnimatedLength* aVal,
SVGElement* aSVGElement,
bool aAnimVal) {
auto& table =

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

@ -43,7 +43,7 @@ class SVGElement;
* are in an SVGLengthList. It is also used to create the objects returned by
* SVGSVGElement.createSVGLength().
*
* For the DOM wrapper classes for non-list SVGLength, see nsSVGLength2.h.
* For the DOM wrapper classes for non-list SVGLength, see SVGAnimatedLength.h.
*
* See the architecture comment in DOMSVGAnimatedLengthList.h.
*
@ -66,7 +66,7 @@ class SVGElement;
* Objects of this type are also used to reflect the baseVal and animVal of
* a single, non-list SVGLength attribute. Getting and settings values of the
* DOMSVGLength in this case requires reading and writing to the corresponding
* nsSVGLength2 object.
* SVGAnimatedLength object.
*
* This class also stores its current list index, attribute enum, and whether
* it belongs to a baseVal or animVal list. This is so that objects of this
@ -83,9 +83,10 @@ class DOMSVGLength final : public nsISupports, public nsWrapperCache {
/**
* Ctor for creating the object returned by
* nsSVGLength2::ToDOMBaseVal/ToDOMAnimVal
* SVGAnimatedLength::ToDOMBaseVal/ToDOMAnimVal
*/
DOMSVGLength(nsSVGLength2* aVal, dom::SVGElement* aSVGElement, bool aAnimVal);
DOMSVGLength(SVGAnimatedLength* aVal, dom::SVGElement* aSVGElement,
bool aAnimVal);
~DOMSVGLength();
@ -106,7 +107,7 @@ class DOMSVGLength final : public nsISupports, public nsWrapperCache {
*/
DOMSVGLength();
static already_AddRefed<DOMSVGLength> GetTearOff(nsSVGLength2* aVal,
static already_AddRefed<DOMSVGLength> GetTearOff(SVGAnimatedLength* aVal,
dom::SVGElement* aSVGElement,
bool aAnimVal);
@ -227,8 +228,8 @@ class DOMSVGLength final : public nsISupports, public nsWrapperCache {
// vh, wm, calc + future additions)
float mValue;
// The following members are only used when we have an nsSVGLength2
nsSVGLength2* mVal; // kept alive because it belongs to mSVGElement
// The following members are only used when we have an SVGAnimatedLength
SVGAnimatedLength* mVal; // kept alive because it belongs to mSVGElement
RefPtr<dom::SVGElement> mSVGElement;
};

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

@ -31,7 +31,7 @@ class SVGSVGElement;
* are in an SVGNumberList. It is also used to create the objects returned by
* SVGSVGElement.createSVGNumber().
*
* For the DOM wrapper classes for non-list SVGNumber, see nsSVGNumber2.h.
* For the DOM wrapper classes for non-list SVGNumber, see SVGAnimatedNumber.h.
*
* See the architecture comment in DOMSVGAnimatedNumberList.h.
*

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

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

@ -4,7 +4,7 @@
* 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 "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/SMILValue.h"
@ -19,9 +19,10 @@
#include "SVGAttrTearoffTable.h"
#include "nsSVGIntegrationUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
static const nsStaticAtom* const unitMap[] = {
nullptr, /* SVG_LENGTHTYPE_UNKNOWN */
nullptr, /* SVG_LENGTHTYPE_NUMBER */
@ -35,7 +36,7 @@ static const nsStaticAtom* const unitMap[] = {
nsGkAtoms::pt,
nsGkAtoms::pc};
static SVGAttrTearoffTable<nsSVGLength2, DOMSVGAnimatedLength>
static SVGAttrTearoffTable<SVGAnimatedLength, DOMSVGAnimatedLength>
sSVGAnimatedLengthTearoffTable;
/* Helper functions */
@ -179,18 +180,18 @@ float UserSpaceMetricsWithSize::GetAxisLength(uint8_t aCtxType) const {
return FixAxisLength(length);
}
float nsSVGLength2::GetPixelsPerUnit(SVGElement* aSVGElement,
uint8_t aUnitType) const {
float SVGAnimatedLength::GetPixelsPerUnit(SVGElement* aSVGElement,
uint8_t aUnitType) const {
return GetPixelsPerUnit(SVGElementMetrics(aSVGElement), aUnitType);
}
float nsSVGLength2::GetPixelsPerUnit(SVGViewportElement* aCtx,
uint8_t aUnitType) const {
float SVGAnimatedLength::GetPixelsPerUnit(SVGViewportElement* aCtx,
uint8_t aUnitType) const {
return GetPixelsPerUnit(SVGElementMetrics(aCtx, aCtx), aUnitType);
}
float nsSVGLength2::GetPixelsPerUnit(nsIFrame* aFrame,
uint8_t aUnitType) const {
float SVGAnimatedLength::GetPixelsPerUnit(nsIFrame* aFrame,
uint8_t aUnitType) const {
nsIContent* content = aFrame->GetContent();
if (content->IsSVGElement()) {
return GetPixelsPerUnit(
@ -202,8 +203,8 @@ float nsSVGLength2::GetPixelsPerUnit(nsIFrame* aFrame,
// See https://www.w3.org/TR/css-values-3/#absolute-lengths
static const float DPI = 96.0f;
float nsSVGLength2::GetPixelsPerUnit(const UserSpaceMetrics& aMetrics,
uint8_t aUnitType) const {
float SVGAnimatedLength::GetPixelsPerUnit(const UserSpaceMetrics& aMetrics,
uint8_t aUnitType) const {
switch (aUnitType) {
case SVGLength_Binding::SVG_LENGTHTYPE_NUMBER:
case SVGLength_Binding::SVG_LENGTHTYPE_PX:
@ -230,9 +231,9 @@ float nsSVGLength2::GetPixelsPerUnit(const UserSpaceMetrics& aMetrics,
}
}
void nsSVGLength2::SetBaseValueInSpecifiedUnits(float aValue,
SVGElement* aSVGElement,
bool aDoSetAttr) {
void SVGAnimatedLength::SetBaseValueInSpecifiedUnits(float aValue,
SVGElement* aSVGElement,
bool aDoSetAttr) {
if (mIsBaseSet && mBaseVal == aValue) {
return;
}
@ -253,8 +254,8 @@ void nsSVGLength2::SetBaseValueInSpecifiedUnits(float aValue,
}
}
nsresult nsSVGLength2::ConvertToSpecifiedUnits(uint16_t unitType,
SVGElement* aSVGElement) {
nsresult SVGAnimatedLength::ConvertToSpecifiedUnits(uint16_t unitType,
SVGElement* aSVGElement) {
if (!IsValidUnitType(unitType)) return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
if (mIsBaseSet && mSpecifiedUnitType == uint8_t(unitType)) return NS_OK;
@ -288,9 +289,9 @@ nsresult nsSVGLength2::ConvertToSpecifiedUnits(uint16_t unitType,
return NS_OK;
}
nsresult nsSVGLength2::NewValueSpecifiedUnits(uint16_t unitType,
float valueInSpecifiedUnits,
SVGElement* aSVGElement) {
nsresult SVGAnimatedLength::NewValueSpecifiedUnits(uint16_t unitType,
float valueInSpecifiedUnits,
SVGElement* aSVGElement) {
NS_ENSURE_FINITE(valueInSpecifiedUnits, NS_ERROR_ILLEGAL_VALUE);
if (!IsValidUnitType(unitType)) return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
@ -313,21 +314,21 @@ nsresult nsSVGLength2::NewValueSpecifiedUnits(uint16_t unitType,
return NS_OK;
}
already_AddRefed<DOMSVGLength> nsSVGLength2::ToDOMBaseVal(
already_AddRefed<DOMSVGLength> SVGAnimatedLength::ToDOMBaseVal(
SVGElement* aSVGElement) {
return DOMSVGLength::GetTearOff(this, aSVGElement, false);
}
already_AddRefed<DOMSVGLength> nsSVGLength2::ToDOMAnimVal(
already_AddRefed<DOMSVGLength> SVGAnimatedLength::ToDOMAnimVal(
SVGElement* aSVGElement) {
return DOMSVGLength::GetTearOff(this, aSVGElement, true);
}
/* Implementation */
nsresult nsSVGLength2::SetBaseValueString(const nsAString& aValueAsString,
SVGElement* aSVGElement,
bool aDoSetAttr) {
nsresult SVGAnimatedLength::SetBaseValueString(const nsAString& aValueAsString,
SVGElement* aSVGElement,
bool aDoSetAttr) {
float value;
uint16_t unitType;
@ -359,16 +360,16 @@ nsresult nsSVGLength2::SetBaseValueString(const nsAString& aValueAsString,
return NS_OK;
}
void nsSVGLength2::GetBaseValueString(nsAString& aValueAsString) const {
void SVGAnimatedLength::GetBaseValueString(nsAString& aValueAsString) const {
GetValueString(aValueAsString, mBaseVal, mSpecifiedUnitType);
}
void nsSVGLength2::GetAnimValueString(nsAString& aValueAsString) const {
void SVGAnimatedLength::GetAnimValueString(nsAString& aValueAsString) const {
GetValueString(aValueAsString, mAnimVal, mSpecifiedUnitType);
}
nsresult nsSVGLength2::SetBaseValue(float aValue, SVGElement* aSVGElement,
bool aDoSetAttr) {
nsresult SVGAnimatedLength::SetBaseValue(float aValue, SVGElement* aSVGElement,
bool aDoSetAttr) {
float pixelsPerUnit = GetPixelsPerUnit(aSVGElement, mSpecifiedUnitType);
if (pixelsPerUnit == 0.0f) {
return NS_ERROR_ILLEGAL_VALUE;
@ -383,8 +384,8 @@ nsresult nsSVGLength2::SetBaseValue(float aValue, SVGElement* aSVGElement,
return NS_OK;
}
void nsSVGLength2::SetAnimValueInSpecifiedUnits(float aValue,
SVGElement* aSVGElement) {
void SVGAnimatedLength::SetAnimValueInSpecifiedUnits(float aValue,
SVGElement* aSVGElement) {
if (mAnimVal == aValue && mIsAnimated) {
return;
}
@ -393,7 +394,8 @@ void nsSVGLength2::SetAnimValueInSpecifiedUnits(float aValue,
aSVGElement->DidAnimateLength(mAttrEnum);
}
nsresult nsSVGLength2::SetAnimValue(float aValue, SVGElement* aSVGElement) {
nsresult SVGAnimatedLength::SetAnimValue(float aValue,
SVGElement* aSVGElement) {
float valueInSpecifiedUnits =
aValue / GetPixelsPerUnit(aSVGElement, mSpecifiedUnitType);
@ -404,7 +406,7 @@ nsresult nsSVGLength2::SetAnimValue(float aValue, SVGElement* aSVGElement) {
return NS_ERROR_ILLEGAL_VALUE;
}
already_AddRefed<DOMSVGAnimatedLength> nsSVGLength2::ToDOMAnimatedLength(
already_AddRefed<DOMSVGAnimatedLength> SVGAnimatedLength::ToDOMAnimatedLength(
SVGElement* aSVGElement) {
RefPtr<DOMSVGAnimatedLength> svgAnimatedLength =
sSVGAnimatedLengthTearoffTable.GetTearoff(this);
@ -420,11 +422,11 @@ DOMSVGAnimatedLength::~DOMSVGAnimatedLength() {
sSVGAnimatedLengthTearoffTable.RemoveTearoff(mVal);
}
UniquePtr<SMILAttr> nsSVGLength2::ToSMILAttr(SVGElement* aSVGElement) {
UniquePtr<SMILAttr> SVGAnimatedLength::ToSMILAttr(SVGElement* aSVGElement) {
return MakeUnique<SMILLength>(this, aSVGElement);
}
nsresult nsSVGLength2::SMILLength::ValueFromString(
nsresult SVGAnimatedLength::SMILLength::ValueFromString(
const nsAString& aStr, const SVGAnimationElement* /*aSrcElement*/,
SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
float value;
@ -445,13 +447,13 @@ nsresult nsSVGLength2::SMILLength::ValueFromString(
return NS_OK;
}
SMILValue nsSVGLength2::SMILLength::GetBaseValue() const {
SMILValue SVGAnimatedLength::SMILLength::GetBaseValue() const {
SMILValue val(SMILFloatType::Singleton());
val.mU.mDouble = mVal->GetBaseValue(mSVGElement);
return val;
}
void nsSVGLength2::SMILLength::ClearAnimValue() {
void SVGAnimatedLength::SMILLength::ClearAnimValue() {
if (mVal->mIsAnimated) {
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
@ -459,7 +461,7 @@ void nsSVGLength2::SMILLength::ClearAnimValue() {
}
}
nsresult nsSVGLength2::SMILLength::SetAnimValue(const SMILValue& aValue) {
nsresult SVGAnimatedLength::SMILLength::SetAnimValue(const SMILValue& aValue) {
NS_ASSERTION(aValue.mType == SMILFloatType::Singleton(),
"Unexpected type to assign animated value");
if (aValue.mType == SMILFloatType::Singleton()) {
@ -467,3 +469,5 @@ nsresult nsSVGLength2::SMILLength::SetAnimValue(const SMILValue& aValue) {
}
return NS_OK;
}
} // namespace mozilla

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

@ -4,7 +4,7 @@
* 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 "nsSVGNumber2.h"
#include "SVGAnimatedNumber.h"
#include "mozilla/Attributes.h"
#include "mozilla/SMILValue.h"
@ -13,12 +13,14 @@
#include "SMILFloatType.h"
#include "SVGAttrTearoffTable.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
/* Implementation */
static SVGAttrTearoffTable<nsSVGNumber2, nsSVGNumber2::DOMAnimatedNumber>
static SVGAttrTearoffTable<SVGAnimatedNumber,
SVGAnimatedNumber::DOMAnimatedNumber>
sSVGAnimatedNumberTearoffTable;
static bool GetValueFromString(const nsAString& aString,
@ -48,8 +50,8 @@ static bool GetValueFromString(const nsAString& aString,
return iter == end;
}
nsresult nsSVGNumber2::SetBaseValueString(const nsAString& aValueAsString,
SVGElement* aSVGElement) {
nsresult SVGAnimatedNumber::SetBaseValueString(const nsAString& aValueAsString,
SVGElement* aSVGElement) {
float val;
if (!GetValueFromString(aValueAsString,
@ -72,12 +74,12 @@ nsresult nsSVGNumber2::SetBaseValueString(const nsAString& aValueAsString,
return NS_OK;
}
void nsSVGNumber2::GetBaseValueString(nsAString& aValueAsString) {
void SVGAnimatedNumber::GetBaseValueString(nsAString& aValueAsString) {
aValueAsString.Truncate();
aValueAsString.AppendFloat(mBaseVal);
}
void nsSVGNumber2::SetBaseValue(float aValue, SVGElement* aSVGElement) {
void SVGAnimatedNumber::SetBaseValue(float aValue, SVGElement* aSVGElement) {
if (mIsBaseSet && aValue == mBaseVal) {
return;
}
@ -92,7 +94,7 @@ void nsSVGNumber2::SetBaseValue(float aValue, SVGElement* aSVGElement) {
aSVGElement->DidChangeNumber(mAttrEnum);
}
void nsSVGNumber2::SetAnimValue(float aValue, SVGElement* aSVGElement) {
void SVGAnimatedNumber::SetAnimValue(float aValue, SVGElement* aSVGElement) {
if (mIsAnimated && aValue == mAnimVal) {
return;
}
@ -101,7 +103,7 @@ void nsSVGNumber2::SetAnimValue(float aValue, SVGElement* aSVGElement) {
aSVGElement->DidAnimateNumber(mAttrEnum);
}
already_AddRefed<DOMSVGAnimatedNumber> nsSVGNumber2::ToDOMAnimatedNumber(
already_AddRefed<DOMSVGAnimatedNumber> SVGAnimatedNumber::ToDOMAnimatedNumber(
SVGElement* aSVGElement) {
RefPtr<DOMAnimatedNumber> domAnimatedNumber =
sSVGAnimatedNumberTearoffTable.GetTearoff(this);
@ -113,15 +115,15 @@ already_AddRefed<DOMSVGAnimatedNumber> nsSVGNumber2::ToDOMAnimatedNumber(
return domAnimatedNumber.forget();
}
nsSVGNumber2::DOMAnimatedNumber::~DOMAnimatedNumber() {
SVGAnimatedNumber::DOMAnimatedNumber::~DOMAnimatedNumber() {
sSVGAnimatedNumberTearoffTable.RemoveTearoff(mVal);
}
UniquePtr<SMILAttr> nsSVGNumber2::ToSMILAttr(SVGElement* aSVGElement) {
UniquePtr<SMILAttr> SVGAnimatedNumber::ToSMILAttr(SVGElement* aSVGElement) {
return MakeUnique<SMILNumber>(this, aSVGElement);
}
nsresult nsSVGNumber2::SMILNumber::ValueFromString(
nsresult SVGAnimatedNumber::SMILNumber::ValueFromString(
const nsAString& aStr,
const mozilla::dom::SVGAnimationElement* /*aSrcElement*/, SMILValue& aValue,
bool& aPreventCachingOfSandwich) const {
@ -141,13 +143,13 @@ nsresult nsSVGNumber2::SMILNumber::ValueFromString(
return NS_OK;
}
SMILValue nsSVGNumber2::SMILNumber::GetBaseValue() const {
SMILValue SVGAnimatedNumber::SMILNumber::GetBaseValue() const {
SMILValue val(SMILFloatType::Singleton());
val.mU.mDouble = mVal->mBaseVal;
return val;
}
void nsSVGNumber2::SMILNumber::ClearAnimValue() {
void SVGAnimatedNumber::SMILNumber::ClearAnimValue() {
if (mVal->mIsAnimated) {
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
@ -155,7 +157,7 @@ void nsSVGNumber2::SMILNumber::ClearAnimValue() {
}
}
nsresult nsSVGNumber2::SMILNumber::SetAnimValue(const SMILValue& aValue) {
nsresult SVGAnimatedNumber::SMILNumber::SetAnimValue(const SMILValue& aValue) {
NS_ASSERTION(aValue.mType == SMILFloatType::Singleton(),
"Unexpected type to assign animated value");
if (aValue.mType == SMILFloatType::Singleton()) {
@ -163,3 +165,5 @@ nsresult nsSVGNumber2::SMILNumber::SetAnimValue(const SMILValue& aValue) {
}
return NS_OK;
}
} // namespace mozilla

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

@ -4,8 +4,8 @@
* 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/. */
#ifndef __NS_SVGNUMBER2_H__
#define __NS_SVGNUMBER2_H__
#ifndef mozilla_SVGAnimatedNumber_h
#define mozilla_SVGAnimatedNumber_h
#include "DOMSVGAnimatedNumber.h"
#include "nsCycleCollectionParticipant.h"
@ -24,9 +24,8 @@ class SMILValue;
namespace dom {
class SVGAnimationElement;
} // namespace dom
} // namespace mozilla
class nsSVGNumber2 {
class SVGAnimatedNumber {
public:
typedef mozilla::SMILAttr SMILAttr;
typedef mozilla::SMILValue SMILValue;
@ -67,13 +66,13 @@ class nsSVGNumber2 {
public:
// DOM wrapper class for the (DOM)SVGAnimatedNumber interface where the
// wrapped class is nsSVGNumber2.
// wrapped class is SVGAnimatedNumber.
struct DOMAnimatedNumber final : public mozilla::dom::DOMSVGAnimatedNumber {
DOMAnimatedNumber(nsSVGNumber2* aVal, SVGElement* aSVGElement)
DOMAnimatedNumber(SVGAnimatedNumber* aVal, SVGElement* aSVGElement)
: mozilla::dom::DOMSVGAnimatedNumber(aSVGElement), mVal(aVal) {}
virtual ~DOMAnimatedNumber();
nsSVGNumber2* mVal; // kept alive because it belongs to content
SVGAnimatedNumber* mVal; // kept alive because it belongs to content
virtual float BaseVal() override { return mVal->GetBaseValue(); }
virtual void SetBaseVal(float aValue) override {
@ -91,13 +90,13 @@ class nsSVGNumber2 {
struct SMILNumber : public SMILAttr {
public:
SMILNumber(nsSVGNumber2* aVal, SVGElement* aSVGElement)
SMILNumber(SVGAnimatedNumber* aVal, SVGElement* aSVGElement)
: mVal(aVal), mSVGElement(aSVGElement) {}
// These will stay alive because a SMILAttr only lives as long
// as the Compositing step, and DOM elements don't get a chance to
// die during that.
nsSVGNumber2* mVal;
SVGAnimatedNumber* mVal;
SVGElement* mSVGElement;
// SMILAttr methods
@ -111,4 +110,6 @@ class nsSVGNumber2 {
};
};
#endif //__NS_SVGNUMBER2_H__
} // namespace mozilla
#endif // mozilla_SVGAnimatedNumber_h

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

@ -14,9 +14,9 @@
namespace mozilla {
/**
* Global hashmap to associate internal SVG data types (e.g. nsSVGLength2) with
* DOM tear-off objects (e.g. DOMSVGLength). This allows us to always return
* the same object for subsequent requests for DOM objects.
* Global hashmap to associate internal SVG data types (e.g. SVGAnimatedLength)
* with DOM tear-off objects (e.g. DOMSVGLength). This allows us to always
* return the same object for subsequent requests for DOM objects.
*
* We don't keep an owning reference to the tear-off objects so they are
* responsible for removing themselves from this table when they die.

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

@ -6,14 +6,14 @@
#include "SVGAttrValueWrapper.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedIntegerPair.h"
#include "nsSVGLength2.h"
#include "SVGLengthList.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedNumberPair.h"
#include "SVGNumberList.h"
#include "SVGAnimatedOrient.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedViewBox.h"
#include "SVGLengthList.h"
#include "SVGNumberList.h"
#include "SVGPathData.h"
#include "SVGPointList.h"
#include "SVGStringList.h"
@ -34,7 +34,7 @@ void SVGAttrValueWrapper::ToString(const SVGAnimatedIntegerPair* aIntegerPair,
}
/*static*/
void SVGAttrValueWrapper::ToString(const nsSVGLength2* aLength,
void SVGAttrValueWrapper::ToString(const SVGAnimatedLength* aLength,
nsAString& aResult) {
aLength->GetBaseValueString(aResult);
}

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

@ -14,10 +14,9 @@
#include "nsString.h"
class nsSVGLength2;
namespace mozilla {
class SVGAnimatedIntegerPair;
class SVGAnimatedLength;
class SVGAnimatedNumberPair;
class SVGAnimatedOrient;
class SVGAnimatedPreserveAspectRatio;
@ -33,18 +32,18 @@ class SVGAttrValueWrapper {
public:
static void ToString(const SVGAnimatedIntegerPair* aIntegerPair,
nsAString& aResult);
static void ToString(const SVGAnimatedLength* aLength, nsAString& aResult);
static void ToString(const SVGAnimatedNumberPair* aNumberPair,
nsAString& aResult);
static void ToString(const SVGAnimatedOrient* aOrient, nsAString& aResult);
static void ToString(const nsSVGLength2* aLength, nsAString& aResult);
static void ToString(
const SVGAnimatedPreserveAspectRatio* aPreserveAspectRatio,
nsAString& aResult);
static void ToString(const SVGAnimatedViewBox* aViewBox, nsAString& aResult);
static void ToString(const SVGLengthList* aLengthList, nsAString& aResult);
static void ToString(const SVGNumberList* aNumberList, nsAString& aResult);
static void ToString(const SVGPathData* aPathData, nsAString& aResult);
static void ToString(const SVGPointList* aPointList, nsAString& aResult);
static void ToString(
const SVGAnimatedPreserveAspectRatio* aPreserveAspectRatio,
nsAString& aResult);
static void ToString(const SVGStringList* aStringList, nsAString& aResult);
static void ToString(const SVGTransformList* aTransformList,
nsAString& aResult);

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

@ -8,7 +8,7 @@
#define mozilla_dom_SVGCircleElement_h
#include "SVGGeometryElement.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
nsresult NS_NewSVGCircleElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -50,7 +50,7 @@ class SVGCircleElement final : public SVGCircleElementBase {
virtual LengthAttributesInfo GetLengthInfo() override;
enum { ATTR_CX, ATTR_CY, ATTR_R };
nsSVGLength2 mLengthAttributes[3];
SVGAnimatedLength mLengthAttributes[3];
static LengthInfo sLengthInfo[3];
};

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

@ -7,10 +7,10 @@
#ifndef mozilla_dom_SVGComponentTransferFunctionElement_h
#define mozilla_dom_SVGComponentTransferFunctionElement_h
#include "SVGAnimatedNumberList.h"
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedNumberList.h"
#include "SVGFilters.h"
#include "nsSVGNumber2.h"
#define NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID \
{ \
@ -74,7 +74,7 @@ class SVGComponentTransferFunctionElement
static NumberListInfo sNumberListInfo[1];
enum { SLOPE, INTERCEPT, AMPLITUDE, EXPONENT, OFFSET };
nsSVGNumber2 mNumberAttributes[5];
SVGAnimatedNumber mNumberAttributes[5];
static NumberInfo sNumberInfo[5];
enum { TYPE };

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

@ -47,8 +47,8 @@
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedInteger.h"
#include "SVGAnimatedIntegerPair.h"
#include "nsSVGLength2.h"
#include "nsSVGNumber2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedNumberPair.h"
#include "SVGAnimatedOrient.h"
#include "SVGAnimatedString.h"
@ -301,7 +301,7 @@ bool SVGElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
bool didSetResult = false;
if (aNamespaceID == kNameSpaceID_None) {
// Check for nsSVGLength2 attribute
// Check for SVGAnimatedLength attribute
LengthAttributesInfo lengthInfo = GetLengthInfo();
uint32_t i;
@ -390,7 +390,7 @@ bool SVGElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
}
if (!foundMatch) {
// Check for nsSVGNumber2 attribute
// Check for SVGAnimatedNumber attribute
NumberAttributesInfo numberInfo = GetNumberInfo();
for (i = 0; i < numberInfo.mNumberCount; i++) {
if (aAttribute == numberInfo.mNumberInfo[i].mName) {
@ -1259,9 +1259,9 @@ nsAttrValue SVGElement::WillChangeValue(nsAtom* aName) {
// This is not strictly correct--the attribute value parameter for
// BeforeSetAttr should reflect the value that *will* be set but that implies
// allocating, e.g. an extra nsSVGLength2, and isn't necessary at the moment
// since no SVG elements overload BeforeSetAttr. For now we just pass the
// current value.
// allocating, e.g. an extra SVGAnimatedLength, and isn't necessary at the
// moment since no SVG elements overload BeforeSetAttr. For now we just pass
// the current value.
nsAttrValueOrString attrStringOrValue(attrValue ? *attrValue
: emptyOrOldAttrValue);
DebugOnly<nsresult> rv = BeforeSetAttr(
@ -1359,7 +1359,7 @@ void SVGElement::LengthAttributesInfo::Reset(uint8_t aAttrEnum) {
mLengthInfo[aAttrEnum].mDefaultUnitType);
}
void SVGElement::SetLength(nsAtom* aName, const nsSVGLength2& aLength) {
void SVGElement::SetLength(nsAtom* aName, const SVGAnimatedLength& aLength) {
LengthAttributesInfo lengthInfo = GetLengthInfo();
for (uint32_t i = 0; i < lengthInfo.mLengthCount; i++) {
@ -1403,7 +1403,7 @@ void SVGElement::DidAnimateLength(uint8_t aAttrEnum) {
}
}
nsSVGLength2* SVGElement::GetAnimatedLength(const nsAtom* aAttrName) {
SVGAnimatedLength* SVGElement::GetAnimatedLength(const nsAtom* aAttrName) {
LengthAttributesInfo lengthInfo = GetLengthInfo();
for (uint32_t i = 0; i < lengthInfo.mLengthCount; i++) {

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

@ -27,9 +27,6 @@
#include "nsStyledElement.h"
#include "gfxMatrix.h"
class nsSVGLength2;
class nsSVGNumber2;
nsresult NS_NewSVGElement(mozilla::dom::Element** aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -41,7 +38,9 @@ class SVGAnimatedBoolean;
class SVGAnimatedEnumeration;
class SVGAnimatedInteger;
class SVGAnimatedIntegerPair;
class SVGAnimatedLength;
class SVGAnimatedLengthList;
class SVGAnimatedNumber;
class SVGAnimatedNumberList;
class SVGAnimatedNumberPair;
class SVGAnimatedOrient;
@ -164,7 +163,7 @@ class SVGElement : public SVGElementBase // nsIContent
return GetNumberInfo().mNumberInfo[aAttrEnum].mPercentagesAllowed;
}
virtual bool HasValidDimensions() const { return true; }
void SetLength(nsAtom* aName, const nsSVGLength2& aLength);
void SetLength(nsAtom* aName, const SVGAnimatedLength& aLength);
nsAttrValue WillChangeLength(uint8_t aAttrEnum);
nsAttrValue WillChangeNumberPair(uint8_t aAttrEnum);
@ -231,7 +230,7 @@ class SVGElement : public SVGElementBase // nsIContent
DO_ALLOCATE = 0x1
};
nsSVGLength2* GetAnimatedLength(const nsAtom* aAttrName);
SVGAnimatedLength* GetAnimatedLength(const nsAtom* aAttrName);
void GetAnimatedLengthValues(float* aFirst, ...);
void GetAnimatedNumberValues(float* aFirst, ...);
void GetAnimatedIntegerValues(int32_t* aFirst, ...);
@ -336,11 +335,11 @@ class SVGElement : public SVGElementBase // nsIContent
};
struct LengthAttributesInfo {
nsSVGLength2* const mLengths;
SVGAnimatedLength* const mLengths;
const LengthInfo* const mLengthInfo;
const uint32_t mLengthCount;
LengthAttributesInfo(nsSVGLength2* aLengths, LengthInfo* aLengthInfo,
LengthAttributesInfo(SVGAnimatedLength* aLengths, LengthInfo* aLengthInfo,
uint32_t aLengthCount)
: mLengths(aLengths),
mLengthInfo(aLengthInfo),
@ -356,11 +355,11 @@ class SVGElement : public SVGElementBase // nsIContent
};
struct NumberAttributesInfo {
nsSVGNumber2* const mNumbers;
SVGAnimatedNumber* const mNumbers;
const NumberInfo* const mNumberInfo;
const uint32_t mNumberCount;
NumberAttributesInfo(nsSVGNumber2* aNumbers, NumberInfo* aNumberInfo,
NumberAttributesInfo(SVGAnimatedNumber* aNumbers, NumberInfo* aNumberInfo,
uint32_t aNumberCount)
: mNumbers(aNumbers),
mNumberInfo(aNumberInfo),

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

@ -7,8 +7,8 @@
#ifndef mozilla_dom_SVGEllipseElement_h
#define mozilla_dom_SVGEllipseElement_h
#include "SVGAnimatedLength.h"
#include "SVGGeometryElement.h"
#include "nsSVGLength2.h"
nsresult NS_NewSVGEllipseElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -51,7 +51,7 @@ class SVGEllipseElement final : public SVGEllipseElementBase {
virtual LengthAttributesInfo GetLengthInfo() override;
enum { CX, CY, RX, RY };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
};

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

@ -8,8 +8,8 @@
#define mozilla_dom_SVGFECompositeElement_h
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedNumber.h"
#include "SVGFilters.h"
#include "nsSVGNumber2.h"
nsresult NS_NewSVGFECompositeElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -61,7 +61,7 @@ class SVGFECompositeElement : public SVGFECompositeElementBase {
virtual StringAttributesInfo GetStringInfo() override;
enum { ATTR_K1, ATTR_K2, ATTR_K3, ATTR_K4 };
nsSVGNumber2 mNumberAttributes[4];
SVGAnimatedNumber mNumberAttributes[4];
static NumberInfo sNumberInfo[4];
enum { OPERATOR };

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

@ -12,10 +12,9 @@
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedInteger.h"
#include "SVGAnimatedIntegerPair.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedNumberList.h"
#include "nsSVGNumber2.h"
#include "SVGAnimatedString.h"
#include "SVGAnimatedNumberList.h"
#include "SVGFilters.h"
nsresult NS_NewSVGFEConvolveMatrixElement(
@ -80,7 +79,7 @@ class SVGFEConvolveMatrixElement : public SVGFEConvolveMatrixElementBase {
virtual NumberListAttributesInfo GetNumberListInfo() override;
enum { DIVISOR, BIAS };
nsSVGNumber2 mNumberAttributes[2];
SVGAnimatedNumber mNumberAttributes[2];
static NumberInfo sNumberInfo[2];
enum { KERNEL_UNIT_LENGTH };

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

@ -70,7 +70,7 @@ class SVGFEDisplacementMapElement : public SVGFEDisplacementMapElementBase {
virtual StringAttributesInfo GetStringInfo() override;
enum { SCALE };
nsSVGNumber2 mNumberAttributes[1];
SVGAnimatedNumber mNumberAttributes[1];
static NumberInfo sNumberInfo[1];
enum { CHANNEL_X, CHANNEL_Y };

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

@ -7,8 +7,8 @@
#ifndef mozilla_dom_SVGFEDistantLightElement_h
#define mozilla_dom_SVGFEDistantLightElement_h
#include "SVGAnimatedNumber.h"
#include "SVGFilters.h"
#include "nsSVGNumber2.h"
nsresult NS_NewSVGFEDistantLightElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -47,7 +47,7 @@ class SVGFEDistantLightElement : public SVGFEDistantLightElementBase {
virtual NumberAttributesInfo GetNumberInfo() override;
enum { AZIMUTH, ELEVATION };
nsSVGNumber2 mNumberAttributes[2];
SVGAnimatedNumber mNumberAttributes[2];
static NumberInfo sNumberInfo[2];
};

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

@ -7,7 +7,7 @@
#ifndef mozilla_dom_SVGFEDropShadowElement_h
#define mozilla_dom_SVGFEDropShadowElement_h
#include "nsSVGNumber2.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedNumberPair.h"
#include "SVGAnimatedString.h"
#include "SVGFilters.h"
@ -63,7 +63,7 @@ class SVGFEDropShadowElement : public SVGFEDropShadowElementBase {
virtual StringAttributesInfo GetStringInfo() override;
enum { DX, DY };
nsSVGNumber2 mNumberAttributes[2];
SVGAnimatedNumber mNumberAttributes[2];
static NumberInfo sNumberInfo[2];
enum { STD_DEV };

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

@ -7,7 +7,7 @@
#ifndef mozilla_dom_SVGFEOffsetElement_h
#define mozilla_dom_SVGFEOffsetElement_h
#include "nsSVGNumber2.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedString.h"
#include "SVGFilters.h"
@ -55,7 +55,7 @@ class SVGFEOffsetElement : public SVGFEOffsetElementBase {
virtual StringAttributesInfo GetStringInfo() override;
enum { DX, DY };
nsSVGNumber2 mNumberAttributes[2];
SVGAnimatedNumber mNumberAttributes[2];
static NumberInfo sNumberInfo[2];
enum { RESULT, IN1 };

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

@ -7,8 +7,8 @@
#ifndef mozilla_dom_SVGFEPointLightElement_h
#define mozilla_dom_SVGFEPointLightElement_h
#include "SVGAnimatedNumber.h"
#include "SVGFilters.h"
#include "nsSVGNumber2.h"
nsresult NS_NewSVGFEPointLightElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -48,7 +48,7 @@ class SVGFEPointLightElement : public SVGFEPointLightElementBase {
virtual NumberAttributesInfo GetNumberInfo() override;
enum { ATTR_X, ATTR_Y, ATTR_Z };
nsSVGNumber2 mNumberAttributes[3];
SVGAnimatedNumber mNumberAttributes[3];
static NumberInfo sNumberInfo[3];
};

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

@ -7,8 +7,8 @@
#ifndef mozilla_dom_SVGFESpotLightElement_h
#define mozilla_dom_SVGFESpotLightElement_h
#include "SVGAnimatedNumber.h"
#include "SVGFilters.h"
#include "nsSVGNumber2.h"
nsresult NS_NewSVGFESpotLightElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -63,7 +63,7 @@ class SVGFESpotLightElement : public SVGFESpotLightElementBase {
SPECULAR_EXPONENT,
LIMITING_CONE_ANGLE
};
nsSVGNumber2 mNumberAttributes[8];
SVGAnimatedNumber mNumberAttributes[8];
static NumberInfo sNumberInfo[8];
};

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

@ -9,7 +9,7 @@
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedInteger.h"
#include "nsSVGNumber2.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedString.h"
#include "SVGFilters.h"
@ -64,7 +64,7 @@ class SVGFETurbulenceElement : public SVGFETurbulenceElementBase {
virtual StringAttributesInfo GetStringInfo() override;
enum { SEED }; // floating point seed?!
nsSVGNumber2 mNumberAttributes[1];
SVGAnimatedNumber mNumberAttributes[1];
static NumberInfo sNumberInfo[1];
enum { BASE_FREQ };

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

@ -8,7 +8,7 @@
#define mozilla_dom_SVGFilterElement_h
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedString.h"
#include "mozilla/dom/SVGElement.h"
@ -60,7 +60,7 @@ class SVGFilterElement : public SVGFilterElementBase {
virtual StringAttributesInfo GetStringInfo() override;
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
enum { FILTERUNITS, PRIMITIVEUNITS };

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

@ -11,10 +11,10 @@
#include "mozilla/dom/SVGElement.h"
#include "FilterSupport.h"
#include "nsImageLoadingContent.h"
#include "SVGAnimatedString.h"
#include "nsSVGLength2.h"
#include "nsSVGNumber2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedNumberPair.h"
#include "SVGAnimatedString.h"
class nsSVGFilterInstance;
@ -149,7 +149,7 @@ class SVGFE : public SVGFEBase {
SVGAnimatedNumberPair* aKernelUnitLength);
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
};
@ -221,7 +221,7 @@ class SVGFELightingElement : public SVGFELightingElementBase {
SPECULAR_CONSTANT,
SPECULAR_EXPONENT
};
nsSVGNumber2 mNumberAttributes[4];
SVGAnimatedNumber mNumberAttributes[4];
static NumberInfo sNumberInfo[4];
enum { KERNEL_UNIT_LENGTH };

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

@ -8,7 +8,7 @@
#define mozilla_dom_SVGForeignObjectElement_h
#include "mozilla/dom/SVGGraphicsElement.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
nsresult NS_NewSVGForeignObjectElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -52,7 +52,7 @@ class SVGForeignObjectElement final : public SVGGraphicsElement {
virtual LengthAttributesInfo GetLengthInfo() override;
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
};

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

@ -10,7 +10,7 @@
#include "gfxPlatform.h"
#include "nsCOMPtr.h"
#include "nsComputedDOMStyle.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "nsSVGUtils.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/gfx/2D.h"
@ -57,7 +57,7 @@ bool SVGGeometryElement::AttributeDefinesGeometry(const nsAtom* aName) {
return true;
}
// Check for nsSVGLength2 attribute
// Check for SVGAnimatedLength attribute
LengthAttributesInfo info = GetLengthInfo();
for (uint32_t i = 0; i < info.mLengthCount; i++) {
if (aName == info.mLengthInfo[i].mName) {
@ -69,7 +69,7 @@ bool SVGGeometryElement::AttributeDefinesGeometry(const nsAtom* aName) {
}
bool SVGGeometryElement::GeometryDependsOnCoordCtx() {
// Check the nsSVGLength2 attribute
// Check the SVGAnimatedLength attribute
LengthAttributesInfo info =
const_cast<SVGGeometryElement*>(this)->GetLengthInfo();
for (uint32_t i = 0; i < info.mLengthCount; i++) {

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

@ -7,10 +7,10 @@
#ifndef mozilla_dom_SVGGeometryElement_h
#define mozilla_dom_SVGGeometryElement_h
#include "mozilla/dom/SVGGraphicsElement.h"
#include "mozilla/gfx/2D.h"
#include "SVGGraphicsElement.h"
#include "SVGAnimatedNumber.h"
#include "nsISVGPoint.h"
#include "nsSVGNumber2.h"
namespace mozilla {
@ -217,7 +217,7 @@ class SVGGeometryElement : public SVGGeometryElementBase {
// SVGElement method
virtual NumberAttributesInfo GetNumberInfo() override;
nsSVGNumber2 mPathLength;
SVGAnimatedNumber mPathLength;
static NumberInfo sNumberInfo;
mutable RefPtr<Path> mCachedPath;
};

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

@ -9,7 +9,7 @@
#include "nsAutoPtr.h"
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedString.h"
#include "SVGAnimatedTransformList.h"
#include "mozilla/dom/SVGElement.h"
@ -105,7 +105,7 @@ class SVGLinearGradientElement : public SVGLinearGradientElementBase {
virtual LengthAttributesInfo GetLengthInfo() override;
enum { ATTR_X1, ATTR_Y1, ATTR_X2, ATTR_Y2 };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
};
@ -140,7 +140,7 @@ class SVGRadialGradientElement : public SVGRadialGradientElementBase {
virtual LengthAttributesInfo GetLengthInfo() override;
enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY, ATTR_FR };
nsSVGLength2 mLengthAttributes[6];
SVGAnimatedLength mLengthAttributes[6];
static LengthInfo sLengthInfo[6];
};

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

@ -8,7 +8,7 @@
#define mozilla_dom_SVGImageElement_h
#include "nsImageLoadingContent.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedString.h"
#include "SVGGeometryElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
@ -106,7 +106,7 @@ class SVGImageElement : public SVGImageElementBase,
nsIContent* AsContent() override { return this; }
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;

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

@ -20,7 +20,8 @@ class SVGElement;
/**
* This SVGLength class is currently used for SVGLength *list* attributes only.
* The class that is currently used for <length> attributes is nsSVGLength2.
* The class that is currently used for <length> attributes is
* SVGAnimatedLength.
*
* The member mUnit should always be valid, but the member mValue may be
* numeric_limits<float>::quiet_NaN() under one circumstances (see the comment

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

@ -7,8 +7,8 @@
#ifndef mozilla_dom_SVGLineElement_h
#define mozilla_dom_SVGLineElement_h
#include "SVGAnimatedLength.h"
#include "SVGGeometryElement.h"
#include "nsSVGLength2.h"
nsresult NS_NewSVGLineElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -57,7 +57,7 @@ class SVGLineElement final : public SVGLineElementBase {
virtual LengthAttributesInfo GetLengthInfo() override;
enum { ATTR_X1, ATTR_Y1, ATTR_X2, ATTR_Y2 };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
};

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

@ -11,7 +11,7 @@
#include "DOMSVGAnimatedEnumeration.h"
#include "nsAutoPtr.h"
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedOrient.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedViewBox.h"
@ -84,7 +84,7 @@ class SVGMarkerElement : public SVGMarkerElementBase {
virtual SVGAnimatedViewBox* GetViewBox() override;
enum { REFX, REFY, MARKERWIDTH, MARKERHEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
enum { MARKERUNITS };

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

@ -8,7 +8,7 @@
#define mozilla_dom_SVGMaskElement_h
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "mozilla/dom/SVGElement.h"
class nsSVGMaskFrame;
@ -55,7 +55,7 @@ class SVGMaskElement final : public SVGMaskElementBase {
virtual EnumAttributesInfo GetEnumInfo() override;
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
enum { MASKUNITS, MASKCONTENTUNITS };

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

@ -9,7 +9,7 @@
#include "nsAutoPtr.h"
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedString.h"
#include "SVGAnimatedTransformList.h"
@ -77,7 +77,7 @@ class SVGPatternElement final : public SVGPatternElementBase {
virtual SVGAnimatedViewBox* GetViewBox() override;
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
enum { PATTERNUNITS, PATTERNCONTENTUNITS };

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

@ -7,7 +7,7 @@
#ifndef mozilla_dom_SVGRectElement_h
#define mozilla_dom_SVGRectElement_h
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGGeometryElement.h"
nsresult NS_NewSVGRectElement(
@ -54,7 +54,7 @@ class SVGRectElement final : public SVGRectElementBase {
virtual LengthAttributesInfo GetLengthInfo() override;
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT, ATTR_RX, ATTR_RY };
nsSVGLength2 mLengthAttributes[6];
SVGAnimatedLength mLengthAttributes[6];
static LengthInfo sLengthInfo[6];
};

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

@ -7,8 +7,8 @@
#ifndef mozilla_dom_SVGStopElement_h
#define mozilla_dom_SVGStopElement_h
#include "SVGElement.h"
#include "nsSVGNumber2.h"
#include "mozilla/dom/SVGElement.h"
#include "SVGAnimatedNumber.h"
nsresult NS_NewSVGStopElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -38,7 +38,7 @@ class SVGStopElement final : public SVGStopElementBase {
protected:
virtual NumberAttributesInfo GetNumberInfo() override;
nsSVGNumber2 mOffset;
SVGAnimatedNumber mOffset;
static NumberInfo sNumberInfo;
};

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

@ -42,8 +42,8 @@ class SVGTSpanElement final : public SVGTSpanElementBase {
return mEnumAttributes;
}
nsSVGLength2 mLengthAttributes[1];
virtual nsSVGLength2* LengthAttributes() override {
SVGAnimatedLength mLengthAttributes[1];
virtual SVGAnimatedLength* LengthAttributes() override {
return mLengthAttributes;
}
};

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

@ -10,7 +10,7 @@
#include "mozilla/dom/SVGGraphicsElement.h"
#include "DOMSVGAnimatedEnumeration.h"
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
class SVGTextFrame;
@ -65,7 +65,7 @@ class SVGTextContentElement : public SVGTextContentElementBase {
static EnumInfo sEnumInfo[1];
enum { TEXTLENGTH };
virtual nsSVGLength2* LengthAttributes() = 0;
virtual SVGAnimatedLength* LengthAttributes() = 0;
static LengthInfo sLengthInfo[1];
};

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

@ -42,8 +42,8 @@ class SVGTextElement final : public SVGTextElementBase {
return mEnumAttributes;
}
nsSVGLength2 mLengthAttributes[1];
virtual nsSVGLength2* LengthAttributes() override {
SVGAnimatedLength mLengthAttributes[1];
virtual SVGAnimatedLength* LengthAttributes() override {
return mLengthAttributes;
}
};

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

@ -8,7 +8,7 @@
#define mozilla_dom_SVGTextPathElement_h
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedPathSegList.h"
#include "SVGAnimatedString.h"
#include "mozilla/dom/SVGTextContentElement.h"
@ -65,8 +65,8 @@ class SVGTextPathElement final : public SVGTextPathElementBase {
virtual StringAttributesInfo GetStringInfo() override;
enum { /* TEXTLENGTH, */ STARTOFFSET = 1 };
nsSVGLength2 mLengthAttributes[2];
virtual nsSVGLength2* LengthAttributes() override {
SVGAnimatedLength mLengthAttributes[2];
virtual SVGAnimatedLength* LengthAttributes() override {
return mLengthAttributes;
}
static LengthInfo sLengthInfo[2];

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

@ -392,7 +392,7 @@ void SVGUseElement::SyncWidthOrHeight(nsAtom* aName) {
}
// Our width/height attribute is now no longer explicitly set, so we
// need to set the value to 100%
nsSVGLength2 length;
SVGAnimatedLength length;
length.Init(SVGContentUtils::XY, 0xff, 100,
SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE);
target->SetLength(aName, length);

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

@ -13,7 +13,7 @@
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsStubMutationObserver.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedString.h"
#include "nsTArray.h"
@ -140,7 +140,7 @@ class SVGUseElement final : public SVGUseElementBase,
void UnlinkSource();
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
enum { HREF, XLINK_HREF };

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

@ -118,7 +118,7 @@ SVGViewportElement::IsAttributeMapped(const nsAtom* name) const {
// resolve percentage lengths. (It can only be used to resolve
// 'em'/'ex'-valued units).
inline float ComputeSynthesizedViewBoxDimension(
const nsSVGLength2& aLength, float aViewportLength,
const SVGAnimatedLength& aLength, float aViewportLength,
const SVGViewportElement* aSelf) {
if (aLength.IsPercentage()) {
return aViewportLength * aLength.GetAnimValInSpecifiedUnits() / 100.0f;

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

@ -12,7 +12,7 @@
#include "nsAutoPtr.h"
#include "nsIContentInlines.h"
#include "SVGAnimatedEnumeration.h"
#include "nsSVGLength2.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedViewBox.h"
#include "SVGGraphicsElement.h"
@ -172,7 +172,7 @@ class SVGViewportElement : public SVGGraphicsElement {
virtual float GetCurrentScale() const { return 1.0f; }
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
SVGAnimatedLength mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
virtual LengthAttributesInfo GetLengthInfo() override;

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

@ -120,15 +120,15 @@ UNIFIED_SOURCES += [
'DOMSVGTransform.cpp',
'DOMSVGTransformList.cpp',
'nsISVGPoint.cpp',
'nsSVGLength2.cpp',
'nsSVGNumber2.cpp',
'SVGAElement.cpp',
'SVGAnimatedBoolean.cpp',
'SVGAnimatedClass.cpp',
'SVGAnimatedEnumeration.cpp',
'SVGAnimatedInteger.cpp',
'SVGAnimatedIntegerPair.cpp',
'SVGAnimatedLength.cpp',
'SVGAnimatedLengthList.cpp',
'SVGAnimatedNumber.cpp',
'SVGAnimatedNumberList.cpp',
'SVGAnimatedNumberPair.cpp',
'SVGAnimatedOrient.cpp',

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

@ -4653,7 +4653,7 @@ gfxFloat SVGTextFrame::GetOffsetScale(nsIFrame* aTextPathFrame) {
gfxFloat SVGTextFrame::GetStartOffset(nsIFrame* aTextPathFrame) {
SVGTextPathElement* tp =
static_cast<SVGTextPathElement*>(aTextPathFrame->GetContent());
nsSVGLength2* length =
SVGAnimatedLength* length =
&tp->mLengthAttributes[SVGTextPathElement::STARTOFFSET];
if (length->IsPercentage()) {
@ -4830,7 +4830,7 @@ void SVGTextFrame::DoGlyphPositioning() {
// to record that a new run starts with each glyph.
SVGTextContentElement* element =
static_cast<SVGTextContentElement*>(GetContent());
nsSVGLength2* textLengthAttr =
SVGAnimatedLength* textLengthAttr =
element->GetAnimatedLength(nsGkAtoms::textLength);
uint16_t lengthAdjust =
element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST]

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

@ -58,9 +58,9 @@ uint16_t nsSVGFilterFrame::GetEnumValue(uint32_t aIndex, nsIContent* aDefault) {
.GetAnimValue();
}
const nsSVGLength2* nsSVGFilterFrame::GetLengthValue(uint32_t aIndex,
nsIContent* aDefault) {
const nsSVGLength2* thisLength =
const SVGAnimatedLength* nsSVGFilterFrame::GetLengthValue(
uint32_t aIndex, nsIContent* aDefault) {
const SVGAnimatedLength* thisLength =
&static_cast<SVGFilterElement*>(GetContent())->mLengthAttributes[aIndex];
if (thisLength->IsExplicitlySet()) {

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

@ -17,11 +17,11 @@ class nsAtom;
class nsIContent;
class nsIFrame;
class nsIPresShell;
class nsSVGLength2;
struct nsRect;
namespace mozilla {
class SVGAnimatedLength;
namespace dom {
class SVGFilterElement;
} // namespace dom
@ -68,8 +68,9 @@ class nsSVGFilterFrame final : public nsSVGContainerFrame {
uint16_t GetEnumValue(uint32_t aIndex) {
return GetEnumValue(aIndex, mContent);
}
const nsSVGLength2* GetLengthValue(uint32_t aIndex, nsIContent* aDefault);
const nsSVGLength2* GetLengthValue(uint32_t aIndex) {
const mozilla::SVGAnimatedLength* GetLengthValue(uint32_t aIndex,
nsIContent* aDefault);
const mozilla::SVGAnimatedLength* GetLengthValue(uint32_t aIndex) {
return GetLengthValue(aIndex, mContent);
}
const mozilla::dom::SVGFilterElement* GetFilterContent(nsIContent* aDefault);

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

@ -74,7 +74,7 @@ bool nsSVGFilterInstance::ComputeBounds() {
// units). So really only percentage values should be used in this case.
// Set the user space bounds (i.e. the filter region in user space).
nsSVGLength2 XYWH[4];
SVGAnimatedLength XYWH[4];
static_assert(sizeof(mFilterElement->mLengthAttributes) == sizeof(XYWH),
"XYWH size incorrect");
memcpy(XYWH, mFilterElement->mLengthAttributes,
@ -168,7 +168,7 @@ nsSVGFilterFrame* nsSVGFilterInstance::GetFilterFrame(nsIFrame* aTargetFrame) {
float nsSVGFilterInstance::GetPrimitiveNumber(uint8_t aCtxType,
float aValue) const {
nsSVGLength2 val;
SVGAnimatedLength val;
val.Init(aCtxType, 0xff, aValue, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER);
float value;
@ -192,7 +192,7 @@ float nsSVGFilterInstance::GetPrimitiveNumber(uint8_t aCtxType,
}
Point3D nsSVGFilterInstance::ConvertLocation(const Point3D& aPoint) const {
nsSVGLength2 val[4];
SVGAnimatedLength val[4];
val[0].Init(SVGContentUtils::X, 0xff, aPoint.x,
SVGLength_Binding::SVG_LENGTHTYPE_NUMBER);
val[1].Init(SVGContentUtils::Y, 0xff, aPoint.y,

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

@ -9,7 +9,7 @@
#include "gfxMatrix.h"
#include "gfxRect.h"
#include "nsSVGNumber2.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedNumberPair.h"
#include "SVGFilters.h"
#include "nsTArray.h"
@ -65,6 +65,7 @@ class SVGFilterElement;
* "filter space point" = (20, 20)
*/
class nsSVGFilterInstance {
typedef mozilla::SVGAnimatedNumber SVGAnimatedNumber;
typedef mozilla::SVGAnimatedNumberPair SVGAnimatedNumberPair;
typedef mozilla::gfx::Point3D Point3D;
typedef mozilla::gfx::IntRect IntRect;
@ -111,7 +112,7 @@ class nsSVGFilterInstance {
nsTArray<RefPtr<SourceSurface>>& aInputImages, bool aInputIsTainted);
float GetPrimitiveNumber(uint8_t aCtxType,
const nsSVGNumber2* aNumber) const {
const SVGAnimatedNumber* aNumber) const {
return GetPrimitiveNumber(aCtxType, aNumber->GetAnimValue());
}
float GetPrimitiveNumber(uint8_t aCtxType,

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

@ -419,7 +419,7 @@ float nsSVGLinearGradientFrame::GetLengthValue(uint32_t aIndex) {
// return value should also be non-null.
MOZ_ASSERT(lengthElement,
"Got unexpected null element from GetLinearGradientWithLength");
const nsSVGLength2& length = lengthElement->mLengthAttributes[aIndex];
const SVGAnimatedLength& length = lengthElement->mLengthAttributes[aIndex];
// Object bounding box units are handled by setting the appropriate
// transform in GetGradientTransform, but we need to handle user
@ -441,7 +441,7 @@ nsSVGLinearGradientFrame::GetLinearGradientWithLength(
uint32_t aIndex, dom::SVGLinearGradientElement* aDefault) {
dom::SVGLinearGradientElement* thisElement =
static_cast<dom::SVGLinearGradientElement*>(GetContent());
const nsSVGLength2& length = thisElement->mLengthAttributes[aIndex];
const SVGAnimatedLength& length = thisElement->mLengthAttributes[aIndex];
if (length.IsExplicitlySet()) {
return thisElement;
@ -521,7 +521,7 @@ float nsSVGRadialGradientFrame::GetLengthValue(uint32_t aIndex,
float nsSVGRadialGradientFrame::GetLengthValueFromElement(
uint32_t aIndex, dom::SVGRadialGradientElement& aElement) {
const nsSVGLength2& length = aElement.mLengthAttributes[aIndex];
const SVGAnimatedLength& length = aElement.mLengthAttributes[aIndex];
// Object bounding box units are handled by setting the appropriate
// transform in GetGradientTransform, but we need to handle user
@ -543,7 +543,7 @@ nsSVGRadialGradientFrame::GetRadialGradientWithLength(
uint32_t aIndex, dom::SVGRadialGradientElement* aDefault) {
dom::SVGRadialGradientElement* thisElement =
static_cast<dom::SVGRadialGradientElement*>(GetContent());
const nsSVGLength2& length = thisElement->mLengthAttributes[aIndex];
const SVGAnimatedLength& length = thisElement->mLengthAttributes[aIndex];
if (length.IsExplicitlySet()) {
return thisElement;

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

@ -164,7 +164,7 @@ nscoord nsSVGOuterSVGFrame::GetPrefISize(gfxContext* aRenderingContext) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(GetContent());
WritingMode wm = GetWritingMode();
const nsSVGLength2& isize =
const SVGAnimatedLength& isize =
wm.IsVertical() ? svg->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT]
: svg->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
@ -206,9 +206,9 @@ IntrinsicSize nsSVGOuterSVGFrame::GetIntrinsicSize() {
IntrinsicSize intrinsicSize;
SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
const nsSVGLength2& width =
const SVGAnimatedLength& width =
content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
const nsSVGLength2& height =
const SVGAnimatedLength& height =
content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
if (!width.IsPercentage()) {
@ -238,9 +238,9 @@ nsSize nsSVGOuterSVGFrame::GetIntrinsicRatio() {
// values to work but really small or large numbers will fail.
SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
const nsSVGLength2& width =
const SVGAnimatedLength& width =
content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
const nsSVGLength2& height =
const SVGAnimatedLength& height =
content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
if (!width.IsPercentage() && !height.IsPercentage()) {
@ -319,7 +319,7 @@ LogicalSize nsSVGOuterSVGFrame::ComputeSize(
SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
const nsSVGLength2& width =
const SVGAnimatedLength& width =
content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
if (width.IsPercentage()) {
MOZ_ASSERT(intrinsicSize.width.GetUnit() == eStyleUnit_None,
@ -329,7 +329,7 @@ LogicalSize nsSVGOuterSVGFrame::ComputeSize(
intrinsicSize.width.SetCoordValue(val * cbSize.Width(aWM));
}
const nsSVGLength2& height =
const SVGAnimatedLength& height =
content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
NS_ASSERTION(aCBSize.BSize(aWM) != NS_AUTOHEIGHT,
"root should not have auto-height containing block");
@ -917,7 +917,7 @@ bool nsSVGOuterSVGFrame::IsRootOfImage() {
}
bool nsSVGOuterSVGFrame::VerticalScrollbarNotNeeded() const {
const nsSVGLength2& height =
const SVGAnimatedLength& height =
static_cast<SVGSVGElement*>(GetContent())
->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
return height.IsPercentage() && height.GetBaseValInSpecifiedUnits() <= 100;

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

@ -521,9 +521,9 @@ const SVGAnimatedPreserveAspectRatio &nsSVGPatternFrame::GetPreserveAspectRatio(
: static_cast<SVGPatternElement *>(aDefault)->mPreserveAspectRatio;
}
const nsSVGLength2 *nsSVGPatternFrame::GetLengthValue(uint32_t aIndex,
nsIContent *aDefault) {
const nsSVGLength2 *thisLength =
const SVGAnimatedLength *nsSVGPatternFrame::GetLengthValue(
uint32_t aIndex, nsIContent *aDefault) {
const SVGAnimatedLength *thisLength =
&static_cast<SVGPatternElement *>(GetContent())
->mLengthAttributes[aIndex];
@ -590,7 +590,7 @@ gfxRect nsSVGPatternFrame::GetPatternRect(uint16_t aPatternUnits,
float x, y, width, height;
// Get the pattern x,y,width, and height
const nsSVGLength2 *tmpX, *tmpY, *tmpHeight, *tmpWidth;
const SVGAnimatedLength *tmpX, *tmpY, *tmpHeight, *tmpWidth;
tmpX = GetLengthValue(SVGPatternElement::ATTR_X);
tmpY = GetLengthValue(SVGPatternElement::ATTR_Y);
tmpHeight = GetLengthValue(SVGPatternElement::ATTR_HEIGHT);

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

@ -15,9 +15,9 @@
#include "nsSVGPaintServerFrame.h"
class nsIFrame;
class nsSVGLength2;
namespace mozilla {
class SVGAnimatedLength;
class SVGAnimatedPreserveAspectRatio;
class SVGAnimatedTransformList;
class SVGAnimatedViewBox;
@ -87,8 +87,9 @@ class nsSVGPatternFrame final : public nsSVGPaintServerFrame {
const SVGAnimatedPreserveAspectRatio& GetPreserveAspectRatio() {
return GetPreserveAspectRatio(mContent);
}
const nsSVGLength2* GetLengthValue(uint32_t aIndex, nsIContent* aDefault);
const nsSVGLength2* GetLengthValue(uint32_t aIndex) {
const SVGAnimatedLength* GetLengthValue(uint32_t aIndex,
nsIContent* aDefault);
const SVGAnimatedLength* GetLengthValue(uint32_t aIndex) {
return GetLengthValue(aIndex, mContent);
}

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

@ -16,11 +16,6 @@
#include "gfxPlatform.h"
#include "gfxRect.h"
#include "gfxUtils.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PatternHelpers.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGContextPaint.h"
#include "nsCSSClipPathInstance.h"
#include "nsCSSFrameConstructor.h"
#include "nsDisplayList.h"
@ -28,34 +23,38 @@
#include "nsFrameList.h"
#include "nsGkAtoms.h"
#include "nsIContent.h"
#include "mozilla/dom/Document.h"
#include "nsIFrame.h"
#include "nsSVGDisplayableFrame.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
#include "nsStyleCoord.h"
#include "nsStyleStruct.h"
#include "SVGAnimatedLength.h"
#include "nsSVGClipPathFrame.h"
#include "nsSVGContainerFrame.h"
#include "SVGObserverUtils.h"
#include "SVGContentUtils.h"
#include "nsSVGDisplayableFrame.h"
#include "nsSVGFilterPaintCallback.h"
#include "nsSVGForeignObjectFrame.h"
#include "SVGGeometryFrame.h"
#include "nsSVGInnerSVGFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGLength2.h"
#include "nsSVGMaskFrame.h"
#include "SVGObserverUtils.h"
#include "nsSVGOuterSVGFrame.h"
#include "nsSVGPaintServerFrame.h"
#include "SVGTextFrame.h"
#include "nsTextFrame.h"
#include "mozilla/Preferences.h"
#include "mozilla/SVGContextPaint.h"
#include "mozilla/Unused.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PatternHelpers.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "mozilla/dom/SVGGeometryElement.h"
#include "mozilla/dom/SVGPathElement.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
#include "nsSVGPaintServerFrame.h"
#include "mozilla/dom/SVGViewportElement.h"
#include "nsTextFrame.h"
#include "SVGContentUtils.h"
#include "SVGTextFrame.h"
#include "mozilla/Unused.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -251,7 +250,7 @@ Size nsSVGUtils::GetContextSize(const nsIFrame* aFrame) {
}
float nsSVGUtils::ObjectSpace(const gfxRect& aRect,
const nsSVGLength2* aLength) {
const SVGAnimatedLength* aLength) {
float axis;
switch (aLength->GetCtxType()) {
@ -279,17 +278,17 @@ float nsSVGUtils::ObjectSpace(const gfxRect& aRect,
}
float nsSVGUtils::UserSpace(SVGElement* aSVGElement,
const nsSVGLength2* aLength) {
const SVGAnimatedLength* aLength) {
return aLength->GetAnimValue(aSVGElement);
}
float nsSVGUtils::UserSpace(nsIFrame* aNonSVGContext,
const nsSVGLength2* aLength) {
const SVGAnimatedLength* aLength) {
return aLength->GetAnimValue(aNonSVGContext);
}
float nsSVGUtils::UserSpace(const UserSpaceMetrics& aMetrics,
const nsSVGLength2* aLength) {
const SVGAnimatedLength* aLength) {
return aLength->GetAnimValue(aMetrics);
}
@ -1162,7 +1161,7 @@ gfxPoint nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(nsIFrame* aFrame) {
return gfxPoint();
}
static gfxRect GetBoundingBoxRelativeRect(const nsSVGLength2* aXYWH,
static gfxRect GetBoundingBoxRelativeRect(const SVGAnimatedLength* aXYWH,
const gfxRect& aBBox) {
return gfxRect(aBBox.x + nsSVGUtils::ObjectSpace(aBBox, &aXYWH[0]),
aBBox.y + nsSVGUtils::ObjectSpace(aBBox, &aXYWH[1]),
@ -1170,7 +1169,8 @@ static gfxRect GetBoundingBoxRelativeRect(const nsSVGLength2* aXYWH,
nsSVGUtils::ObjectSpace(aBBox, &aXYWH[3]));
}
gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits, const nsSVGLength2* aXYWH,
gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits,
const SVGAnimatedLength* aXYWH,
const gfxRect& aBBox,
const UserSpaceMetrics& aMetrics) {
if (aUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
@ -1181,7 +1181,8 @@ gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits, const nsSVGLength2* aXYWH,
UserSpace(aMetrics, &aXYWH[3]));
}
gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits, const nsSVGLength2* aXYWH,
gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits,
const SVGAnimatedLength* aXYWH,
const gfxRect& aBBox, nsIFrame* aFrame) {
if (aUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
return GetBoundingBoxRelativeRect(aXYWH, aBBox);

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

@ -36,7 +36,6 @@ class nsIFrame;
class nsPresContext;
class nsStyleSVGPaint;
class nsSVGDisplayContainerFrame;
class nsSVGLength2;
class nsSVGOuterSVGFrame;
class nsTextFrame;
@ -45,6 +44,7 @@ struct nsRect;
namespace mozilla {
class SVGAnimatedEnumeration;
class SVGAnimatedLength;
class SVGContextPaint;
struct SVGContextPaintImpl;
class SVGGeometryFrame;
@ -160,6 +160,7 @@ class nsSVGUtils {
typedef mozilla::gfx::FillRule FillRule;
typedef mozilla::gfx::GeneralPattern GeneralPattern;
typedef mozilla::gfx::Size Size;
typedef mozilla::SVGAnimatedLength SVGAnimatedLength;
typedef mozilla::SVGContextPaint SVGContextPaint;
typedef mozilla::SVGContextPaintImpl SVGContextPaintImpl;
typedef mozilla::SVGGeometryFrame SVGGeometryFrame;
@ -225,16 +226,18 @@ class nsSVGUtils {
Input: rect - bounding box
length - length to be converted
*/
static float ObjectSpace(const gfxRect& aRect, const nsSVGLength2* aLength);
static float ObjectSpace(const gfxRect& aRect,
const SVGAnimatedLength* aLength);
/* Computes the input length in terms of user space coordinates.
Input: content - object to be used for determining user space
Input: length - length to be converted
*/
static float UserSpace(SVGElement* aSVGElement, const nsSVGLength2* aLength);
static float UserSpace(nsIFrame* aFrame, const nsSVGLength2* aLength);
static float UserSpace(SVGElement* aSVGElement,
const SVGAnimatedLength* aLength);
static float UserSpace(nsIFrame* aFrame, const SVGAnimatedLength* aLength);
static float UserSpace(const mozilla::dom::UserSpaceMetrics& aMetrics,
const nsSVGLength2* aLength);
const SVGAnimatedLength* aLength);
/* Find the outermost SVG frame of the passed frame */
static nsSVGOuterSVGFrame* GetOuterSVGFrame(nsIFrame* aFrame);
@ -412,20 +415,22 @@ class nsSVGUtils {
/**
* Convert a userSpaceOnUse/objectBoundingBoxUnits rectangle that's specified
* using four nsSVGLength2 values into a user unit rectangle in user space.
* using four SVGAnimatedLength values into a user unit rectangle in user
* space.
*
* @param aXYWH pointer to 4 consecutive nsSVGLength2 objects containing
* @param aXYWH pointer to 4 consecutive SVGAnimatedLength objects containing
* the x, y, width and height values in that order
* @param aBBox the bounding box of the object the rect is relative to;
* may be null if aUnits is not SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
* @param aFrame the object in which to interpret user-space units;
* may be null if aUnits is SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
*/
static gfxRect GetRelativeRect(uint16_t aUnits, const nsSVGLength2* aXYWH,
static gfxRect GetRelativeRect(uint16_t aUnits,
const SVGAnimatedLength* aXYWH,
const gfxRect& aBBox, nsIFrame* aFrame);
static gfxRect GetRelativeRect(
uint16_t aUnits, const nsSVGLength2* aXYWH, const gfxRect& aBBox,
uint16_t aUnits, const SVGAnimatedLength* aXYWH, const gfxRect& aBBox,
const mozilla::dom::UserSpaceMetrics& aMetrics);
/**