Backed out changeset aac6762777be (bug 886416) for mochitest ABORTs; CLOSED TREE

This commit is contained in:
Ed Morley 2014-04-11 17:07:42 +01:00
parent 40cb1aee21
commit 13b0b45b74
18 changed files with 323 additions and 431 deletions

View File

@ -9,21 +9,14 @@
#include "SVGLength.h"
#include "SVGAnimatedLengthList.h"
#include "nsSVGElement.h"
#include "nsSVGLength2.h"
#include "nsIDOMSVGLength.h"
#include "nsError.h"
#include "nsMathUtils.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "nsSVGAttrTearoffTable.h"
// See the architecture comment in DOMSVGAnimatedLengthList.h.
namespace mozilla {
static nsSVGAttrTearoffTable<nsSVGLength2, DOMSVGLength>
sBaseSVGLengthTearOffTable,
sAnimSVGLengthTearOffTable;
// We could use NS_IMPL_CYCLE_COLLECTION_1, except that in Unlink() we need to
// clear our list's weak ref to us to be safe. (The other option would be to
// not unlink and rely on the breaking of the other edges in the cycle, as
@ -36,28 +29,23 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGLength)
tmp->mList->mItems[tmp->mListIndex] = nullptr;
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mList)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSVGElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGLength)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSVGElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGLength)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGLength)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGLength)
}
DOMCI_DATA(SVGLength, mozilla::DOMSVGLength)
namespace mozilla {
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGLength)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(mozilla::DOMSVGLength) // pseudo-interface
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGLength)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
@ -103,7 +91,6 @@ DOMSVGLength::DOMSVGLength(DOMSVGLengthList *aList,
, mIsAnimValItem(aIsAnimValItem)
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
, mValue(0.0f)
, mVal(nullptr)
{
// These shifts are in sync with the members in the header.
NS_ABORT_IF_FALSE(aList &&
@ -111,8 +98,6 @@ DOMSVGLength::DOMSVGLength(DOMSVGLengthList *aList,
aListIndex <= MaxListIndex(), "bad arg");
NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!");
SetIsDOMBinding();
}
DOMSVGLength::DOMSVGLength()
@ -122,126 +107,49 @@ DOMSVGLength::DOMSVGLength()
, mIsAnimValItem(false)
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
, mValue(0.0f)
, mVal(nullptr)
{
SetIsDOMBinding();
}
DOMSVGLength::DOMSVGLength(nsSVGLength2* aVal, nsSVGElement* aSVGElement,
bool aAnimVal)
: mList(nullptr)
, mListIndex(0)
, mAttrEnum(0)
, mIsAnimValItem(aAnimVal)
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
, mValue(0.0f)
, mVal(aVal)
, mSVGElement(aSVGElement)
{
SetIsDOMBinding();
}
DOMSVGLength::~DOMSVGLength()
{
// Our mList's weak ref to us must be nulled out when we die. If GC has
// unlinked us using the cycle collector code, then that has already
// happened, and mList is null.
if (mList) {
mList->mItems[mListIndex] = nullptr;
}
if (mVal) {
auto table = mIsAnimValItem ? sAnimSVGLengthTearOffTable : sBaseSVGLengthTearOffTable;
table.RemoveTearoff(mVal);
}
}
already_AddRefed<DOMSVGLength>
DOMSVGLength::GetTearOff(nsSVGLength2* aVal, nsSVGElement* aSVGElement,
bool aAnimVal)
{
auto table = aAnimVal ? sAnimSVGLengthTearOffTable : sBaseSVGLengthTearOffTable;
nsRefPtr<DOMSVGLength> domLength = table.GetTearoff(aVal);
if (!domLength) {
domLength = new DOMSVGLength(aVal, aSVGElement, aAnimVal);
table.AddTearoff(aVal, domLength);
}
return domLength.forget();
}
uint16_t
DOMSVGLength::UnitType()
{
if (mVal) {
if (mIsAnimValItem) {
mSVGElement->FlushAnimations();
}
return mVal->mSpecifiedUnitType;
}
if (mIsAnimValItem && HasOwner()) {
Element()->FlushAnimations(); // May make HasOwner() == false
}
return HasOwner() ? InternalItem().GetUnit() : mUnit;
}
NS_IMETHODIMP
DOMSVGLength::GetUnitType(uint16_t* aUnit)
{
*aUnit = UnitType();
return NS_OK;
}
float
DOMSVGLength::GetValue(ErrorResult& aRv)
{
if (mVal) {
if (mIsAnimValItem) {
mSVGElement->FlushAnimations();
return mVal->GetAnimValue(mSVGElement);
}
return mVal->GetBaseValue(mSVGElement);
}
if (mIsAnimValItem && HasOwner()) {
Element()->FlushAnimations(); // May make HasOwner() == false
}
if (HasOwner()) {
float value = InternalItem().GetValueInUserUnits(Element(), Axis());
if (!NS_finite(value)) {
aRv.Throw(NS_ERROR_FAILURE);
}
return value;
} else if (mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER ||
mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PX) {
return mValue;
}
// else [SVGWG issue] Can't convert this length's value to user units
// ReportToConsole
aRv.Throw(NS_ERROR_FAILURE);
return 0.0f;
*aUnit = HasOwner() ? InternalItem().GetUnit() : mUnit;
return NS_OK;
}
NS_IMETHODIMP
DOMSVGLength::GetValue(float* aValue)
{
ErrorResult rv;
*aValue = GetValue(rv);
return rv.ErrorCode();
if (mIsAnimValItem && HasOwner()) {
Element()->FlushAnimations(); // May make HasOwner() == false
}
if (HasOwner()) {
*aValue = InternalItem().GetValueInUserUnits(Element(), Axis());
if (NS_finite(*aValue)) {
return NS_OK;
}
} else if (mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER ||
mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PX) {
*aValue = mValue;
return NS_OK;
}
// else [SVGWG issue] Can't convert this length's value to user units
// ReportToConsole
return NS_ERROR_FAILURE;
}
void
DOMSVGLength::SetValue(float aUserUnitValue, ErrorResult& aRv)
NS_IMETHODIMP
DOMSVGLength::SetValue(float aUserUnitValue)
{
if (mIsAnimValItem) {
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (mVal) {
mVal->SetBaseValue(aUserUnitValue, mSVGElement, true);
return;
if (!NS_finite(aUserUnitValue)) {
return NS_ERROR_ILLEGAL_VALUE;
}
// Although the value passed in is in user units, this method does not turn
@ -252,7 +160,7 @@ DOMSVGLength::SetValue(float aUserUnitValue, ErrorResult& aRv)
if (HasOwner()) {
if (InternalItem().GetValueInUserUnits(Element(), Axis()) ==
aUserUnitValue) {
return;
return NS_OK;
}
float uuPerUnit = InternalItem().GetUserUnitsPerUnit(Element(), Axis());
if (uuPerUnit > 0) {
@ -260,142 +168,79 @@ DOMSVGLength::SetValue(float aUserUnitValue, ErrorResult& aRv)
if (NS_finite(newValue)) {
AutoChangeLengthNotifier notifier(this);
InternalItem().SetValueAndUnit(newValue, InternalItem().GetUnit());
return;
return NS_OK;
}
}
} else if (mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER ||
mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PX) {
mValue = aUserUnitValue;
return;
return NS_OK;
}
// else [SVGWG issue] Can't convert user unit value to this length's unit
// ReportToConsole
aRv.Throw(NS_ERROR_FAILURE);
}
NS_IMETHODIMP
DOMSVGLength::SetValue(float aUserUnitValue)
{
if (!NS_finite(aUserUnitValue)) {
return NS_ERROR_ILLEGAL_VALUE;
}
ErrorResult rv;
SetValue(aUserUnitValue, rv);
return rv.ErrorCode();
}
float
DOMSVGLength::ValueInSpecifiedUnits()
{
if (mVal) {
if (mIsAnimValItem) {
mSVGElement->FlushAnimations();
return mVal->mAnimVal;
}
return mVal->mBaseVal;
}
if (mIsAnimValItem && HasOwner()) {
Element()->FlushAnimations(); // May make HasOwner() == false
}
return HasOwner() ? InternalItem().GetValueInCurrentUnits() : mValue;
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
DOMSVGLength::GetValueInSpecifiedUnits(float* aValue)
{
*aValue = ValueInSpecifiedUnits();
if (mIsAnimValItem && HasOwner()) {
Element()->FlushAnimations(); // May make HasOwner() == false
}
*aValue = HasOwner() ? InternalItem().GetValueInCurrentUnits() : mValue;
return NS_OK;
}
void
DOMSVGLength::SetValueInSpecifiedUnits(float aValue, ErrorResult& aRv)
{
if (mIsAnimValItem) {
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
}
if (mVal) {
mVal->SetBaseValueInSpecifiedUnits(aValue, mSVGElement, true);
return;
}
if (HasOwner()) {
if (InternalItem().GetValueInCurrentUnits() == aValue) {
return;
}
AutoChangeLengthNotifier notifier(this);
InternalItem().SetValueInCurrentUnits(aValue);
return;
}
mValue = aValue;
}
NS_IMETHODIMP
DOMSVGLength::SetValueInSpecifiedUnits(float aValue)
{
if (mIsAnimValItem) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (!NS_finite(aValue)) {
return NS_ERROR_ILLEGAL_VALUE;
}
ErrorResult rv;
SetValueInSpecifiedUnits(aValue, rv);
return rv.ErrorCode();
}
void
DOMSVGLength::SetValueAsString(const nsAString& aValue, ErrorResult& aRv)
{
if (mIsAnimValItem) {
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
}
if (mVal) {
mVal->SetBaseValueString(aValue, mSVGElement, true);
return;
}
SVGLength value;
if (!value.SetValueFromString(aValue)) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
}
if (HasOwner()) {
if (InternalItem() == value) {
return;
if (InternalItem().GetValueInCurrentUnits() == aValue) {
return NS_OK;
}
AutoChangeLengthNotifier notifier(this);
InternalItem() = value;
return;
InternalItem().SetValueInCurrentUnits(aValue);
return NS_OK;
}
mValue = value.GetValueInCurrentUnits();
mUnit = value.GetUnit();
mValue = aValue;
return NS_OK;
}
NS_IMETHODIMP
DOMSVGLength::SetValueAsString(const nsAString& aValue)
{
ErrorResult rv;
SetValueAsString(aValue, rv);
return rv.ErrorCode();
if (mIsAnimValItem) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
SVGLength value;
if (!value.SetValueFromString(aValue)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
if (HasOwner()) {
if (InternalItem() == value) {
return NS_OK;
}
AutoChangeLengthNotifier notifier(this);
InternalItem() = value;
return NS_OK;
}
mValue = value.GetValueInCurrentUnits();
mUnit = value.GetUnit();
return NS_OK;
}
NS_IMETHODIMP
DOMSVGLength::GetValueAsString(nsAString& aValue)
{
if (mVal) {
if (mIsAnimValItem) {
mSVGElement->FlushAnimations();
mVal->GetAnimValueString(aValue);
} else {
mVal->GetBaseValueString(aValue);
}
return NS_OK;
}
if (mIsAnimValItem && HasOwner()) {
Element()->FlushAnimations(); // May make HasOwner() == false
}
@ -407,76 +252,54 @@ DOMSVGLength::GetValueAsString(nsAString& aValue)
return NS_OK;
}
void
DOMSVGLength::NewValueSpecifiedUnits(uint16_t aUnit, float aValue,
ErrorResult& aRv)
{
if (mIsAnimValItem) {
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
}
if (mVal) {
mVal->NewValueSpecifiedUnits(aUnit, aValue, mSVGElement);
return;
}
if (!SVGLength::IsValidUnitType(aUnit)) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}
if (HasOwner()) {
if (InternalItem().GetUnit() == aUnit &&
InternalItem().GetValueInCurrentUnits() == aValue) {
return;
}
AutoChangeLengthNotifier notifier(this);
InternalItem().SetValueAndUnit(aValue, uint8_t(aUnit));
return;
}
mUnit = uint8_t(aUnit);
mValue = aValue;
}
NS_IMETHODIMP
DOMSVGLength::NewValueSpecifiedUnits(uint16_t aUnit, float aValue)
{
if (mIsAnimValItem) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (!NS_finite(aValue)) {
return NS_ERROR_ILLEGAL_VALUE;
}
ErrorResult rv;
NewValueSpecifiedUnits(aUnit, aValue, rv);
return rv.ErrorCode();
if (!SVGLength::IsValidUnitType(aUnit)) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
if (HasOwner()) {
if (InternalItem().GetUnit() == aUnit &&
InternalItem().GetValueInCurrentUnits() == aValue) {
return NS_OK;
}
AutoChangeLengthNotifier notifier(this);
InternalItem().SetValueAndUnit(aValue, uint8_t(aUnit));
return NS_OK;
}
mUnit = uint8_t(aUnit);
mValue = aValue;
return NS_OK;
}
void
DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit, ErrorResult& aRv)
NS_IMETHODIMP
DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit)
{
if (mIsAnimValItem) {
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
}
if (mVal) {
mVal->ConvertToSpecifiedUnits(aUnit, mSVGElement);
return;
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (!SVGLength::IsValidUnitType(aUnit)) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
if (HasOwner()) {
if (InternalItem().GetUnit() == aUnit) {
return;
return NS_OK;
}
float val = InternalItem().GetValueInSpecifiedUnit(
aUnit, Element(), Axis());
if (NS_finite(val)) {
AutoChangeLengthNotifier notifier(this);
InternalItem().SetValueAndUnit(val, aUnit);
return;
return NS_OK;
}
} else {
SVGLength len(mValue, mUnit);
@ -484,26 +307,12 @@ DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit, ErrorResult& aRv)
if (NS_finite(val)) {
mValue = val;
mUnit = aUnit;
return;
return NS_OK;
}
}
// else [SVGWG issue] Can't convert unit
// ReportToConsole
aRv.Throw(NS_ERROR_FAILURE);
}
NS_IMETHODIMP
DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit)
{
ErrorResult rv;
ConvertToSpecifiedUnits(aUnit, rv);
return rv.ErrorCode();
}
JSObject*
DOMSVGLength::WrapObject(JSContext* aCx)
{
return dom::SVGLengthBinding::Wrap(aCx, this);
return NS_ERROR_FAILURE;
}
void

View File

@ -14,7 +14,6 @@
#include "nsTArray.h"
#include "SVGLength.h"
#include "mozilla/Attributes.h"
#include "nsWrapperCache.h"
class nsSVGElement;
@ -30,8 +29,6 @@ class nsSVGElement;
namespace mozilla {
class ErrorResult;
/**
* Class DOMSVGLength
*
@ -69,20 +66,14 @@ class ErrorResult;
* if-else as appropriate. The bug for doing that work is:
* https://bugzilla.mozilla.org/show_bug.cgi?id=571734
*/
class DOMSVGLength MOZ_FINAL : public nsIDOMSVGLength,
public nsWrapperCache
class DOMSVGLength MOZ_FINAL : public nsIDOMSVGLength
{
friend class AutoChangeLengthNotifier;
/**
* Ctor for creating the object returned by nsSVGLength2::ToDOMBaseVal/ToDOMAnimVal
*/
DOMSVGLength(nsSVGLength2* aVal, nsSVGElement* aSVGElement, bool aAnimVal);
public:
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGLENGTH_IID)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGLength)
NS_DECL_CYCLE_COLLECTION_CLASS(DOMSVGLength)
NS_DECL_NSIDOMSVGLENGTH
/**
@ -99,11 +90,14 @@ public:
*/
DOMSVGLength();
~DOMSVGLength();
static already_AddRefed<DOMSVGLength> GetTearOff(nsSVGLength2* aVal,
nsSVGElement* aSVGElement,
bool aAnimVal);
~DOMSVGLength() {
// Our mList's weak ref to us must be nulled out when we die. If GC has
// unlinked us using the cycle collector code, then that has already
// happened, and mList is null.
if (mList) {
mList->mItems[mListIndex] = nullptr;
}
}
/**
* Create an unowned copy of an owned length. The caller is responsible for
@ -162,28 +156,9 @@ public:
SVGLength ToSVGLength();
// WebIDL
uint16_t UnitType();
float GetValue(ErrorResult& aRv);
void SetValue(float aValue, ErrorResult& aRv);
float ValueInSpecifiedUnits();
void SetValueInSpecifiedUnits(float aValue, ErrorResult& aRv);
// The XPCOM GetValueAsString is good
void SetValueAsString(const nsAString& aValue, ErrorResult& aRv);
void NewValueSpecifiedUnits(uint16_t aUnit, float aValue,
ErrorResult& aRv);
void ConvertToSpecifiedUnits(uint16_t aUnit, ErrorResult& aRv);
nsISupports* GetParentObject() const {
auto svgElement = mList ? Element() : mSVGElement.get();
return static_cast<nsIDOMSVGElement*> (svgElement);
}
JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
private:
nsSVGElement* Element() const {
nsSVGElement* Element() {
return mList->Element();
}
@ -226,10 +201,6 @@ private:
// The following members are only used when we're not in a list:
uint32_t mUnit:5; // can handle 31 units (the 10 SVG 1.1 units + rem, vw, 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
nsRefPtr<nsSVGElement> mSVGElement;
};
NS_DEFINE_STATIC_IID_ACCESSOR(DOMSVGLength, MOZILLA_DOMSVGLENGTH_IID)

View File

@ -172,8 +172,8 @@ DOMSVGLengthList::Clear(ErrorResult& aError)
}
}
already_AddRefed<DOMSVGLength>
DOMSVGLengthList::Initialize(DOMSVGLength& newItem,
already_AddRefed<nsIDOMSVGLength>
DOMSVGLengthList::Initialize(nsIDOMSVGLength *newItem,
ErrorResult& error)
{
if (IsAnimValList()) {
@ -189,33 +189,33 @@ DOMSVGLengthList::Initialize(DOMSVGLength& newItem,
// clone of newItem, it would actually insert newItem. To prevent that from
// happening we have to do the clone here, if necessary.
nsRefPtr<DOMSVGLength> domItem = &newItem;
nsCOMPtr<DOMSVGLength> domItem = do_QueryInterface(newItem);
if (!domItem) {
error.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
return nullptr;
}
if (domItem->HasOwner()) {
domItem = domItem->Copy();
newItem = domItem->Copy();
}
ErrorResult rv;
Clear(rv);
MOZ_ASSERT(!rv.Failed());
return InsertItemBefore(*domItem, 0, error);
return InsertItemBefore(newItem, 0, error);
}
already_AddRefed<DOMSVGLength>
already_AddRefed<nsIDOMSVGLength>
DOMSVGLengthList::GetItem(uint32_t index, ErrorResult& error)
{
bool found;
nsRefPtr<DOMSVGLength> item = IndexedGetter(index, found, error);
nsRefPtr<nsIDOMSVGLength> item = IndexedGetter(index, found, error);
if (!found) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
}
return item.forget();
}
already_AddRefed<DOMSVGLength>
already_AddRefed<nsIDOMSVGLength>
DOMSVGLengthList::IndexedGetter(uint32_t index, bool& found, ErrorResult& error)
{
if (IsAnimValList()) {
@ -228,8 +228,8 @@ DOMSVGLengthList::IndexedGetter(uint32_t index, bool& found, ErrorResult& error)
return nullptr;
}
already_AddRefed<DOMSVGLength>
DOMSVGLengthList::InsertItemBefore(DOMSVGLength& newItem,
already_AddRefed<nsIDOMSVGLength>
DOMSVGLengthList::InsertItemBefore(nsIDOMSVGLength *newItem,
uint32_t index,
ErrorResult& error)
{
@ -244,7 +244,7 @@ DOMSVGLengthList::InsertItemBefore(DOMSVGLength& newItem,
return nullptr;
}
nsRefPtr<DOMSVGLength> domItem = &newItem;
nsCOMPtr<DOMSVGLength> domItem = do_QueryInterface(newItem);
if (!domItem) {
error.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
return nullptr;
@ -277,8 +277,8 @@ DOMSVGLengthList::InsertItemBefore(DOMSVGLength& newItem,
return domItem.forget();
}
already_AddRefed<DOMSVGLength>
DOMSVGLengthList::ReplaceItem(DOMSVGLength& newItem,
already_AddRefed<nsIDOMSVGLength>
DOMSVGLengthList::ReplaceItem(nsIDOMSVGLength *newItem,
uint32_t index,
ErrorResult& error)
{
@ -287,7 +287,7 @@ DOMSVGLengthList::ReplaceItem(DOMSVGLength& newItem,
return nullptr;
}
nsRefPtr<DOMSVGLength> domItem = &newItem;
nsCOMPtr<DOMSVGLength> domItem = do_QueryInterface(newItem);
if (!domItem) {
error.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
return nullptr;
@ -317,7 +317,7 @@ DOMSVGLengthList::ReplaceItem(DOMSVGLength& newItem,
return domItem.forget();
}
already_AddRefed<DOMSVGLength>
already_AddRefed<nsIDOMSVGLength>
DOMSVGLengthList::RemoveItem(uint32_t index,
ErrorResult& error)
{
@ -338,7 +338,7 @@ DOMSVGLengthList::RemoveItem(uint32_t index,
MaybeRemoveItemFromAnimValListAt(index);
// We have to return the removed item, so get it, creating it if necessary:
nsCOMPtr<DOMSVGLength> result = GetItemAt(index);
nsCOMPtr<nsIDOMSVGLength> result = GetItemAt(index);
// Notify the DOM item of removal *before* modifying the lists so that the
// DOM item can copy its *old* value:
@ -352,7 +352,7 @@ DOMSVGLengthList::RemoveItem(uint32_t index,
return result.forget();
}
already_AddRefed<DOMSVGLength>
already_AddRefed<nsIDOMSVGLength>
DOMSVGLengthList::GetItemAt(uint32_t aIndex)
{
MOZ_ASSERT(aIndex < mItems.Length());
@ -360,7 +360,7 @@ DOMSVGLengthList::GetItemAt(uint32_t aIndex)
if (!mItems[aIndex]) {
mItems[aIndex] = new DOMSVGLength(this, AttrEnum(), aIndex, IsAnimValList());
}
nsRefPtr<DOMSVGLength> result = mItems[aIndex];
nsRefPtr<nsIDOMSVGLength> result = mItems[aIndex];
return result.forget();
}

View File

@ -15,6 +15,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
class nsIDOMSVGLength;
class nsSVGElement;
namespace mozilla {
@ -108,22 +109,22 @@ public:
return LengthNoFlush();
}
void Clear(ErrorResult& aError);
already_AddRefed<DOMSVGLength> Initialize(DOMSVGLength& newItem,
ErrorResult& error);
already_AddRefed<DOMSVGLength> GetItem(uint32_t index,
ErrorResult& error);
already_AddRefed<DOMSVGLength> IndexedGetter(uint32_t index, bool& found,
already_AddRefed<nsIDOMSVGLength> Initialize(nsIDOMSVGLength *newItem,
ErrorResult& error);
already_AddRefed<DOMSVGLength> InsertItemBefore(DOMSVGLength& newItem,
uint32_t index,
ErrorResult& error);
already_AddRefed<DOMSVGLength> ReplaceItem(DOMSVGLength& newItem,
uint32_t index,
ErrorResult& error);
already_AddRefed<DOMSVGLength> RemoveItem(uint32_t index,
already_AddRefed<nsIDOMSVGLength> GetItem(uint32_t index,
ErrorResult& error);
already_AddRefed<DOMSVGLength> AppendItem(DOMSVGLength& newItem,
ErrorResult& error)
already_AddRefed<nsIDOMSVGLength> IndexedGetter(uint32_t index, bool& found,
ErrorResult& error);
already_AddRefed<nsIDOMSVGLength> InsertItemBefore(nsIDOMSVGLength *newItem,
uint32_t index,
ErrorResult& error);
already_AddRefed<nsIDOMSVGLength> ReplaceItem(nsIDOMSVGLength *newItem,
uint32_t index,
ErrorResult& error);
already_AddRefed<nsIDOMSVGLength> RemoveItem(uint32_t index,
ErrorResult& error);
already_AddRefed<nsIDOMSVGLength> AppendItem(nsIDOMSVGLength *newItem,
ErrorResult& error)
{
return InsertItemBefore(newItem, LengthNoFlush(), error);
}
@ -163,8 +164,8 @@ private:
*/
SVGLengthList& InternalList() const;
/// Returns the DOMSVGLength at aIndex, creating it if necessary.
already_AddRefed<DOMSVGLength> GetItemAt(uint32_t aIndex);
/// Returns the nsIDOMSVGLength at aIndex, creating it if necessary.
already_AddRefed<nsIDOMSVGLength> GetItemAt(uint32_t aIndex);
void MaybeInsertNullInAnimValListAt(uint32_t aIndex);
void MaybeRemoveItemFromAnimValListAt(uint32_t aIndex);

View File

@ -6,7 +6,6 @@
#include "mozilla/dom/SVGAnimatedLength.h"
#include "mozilla/dom/SVGAnimatedLengthBinding.h"
#include "nsSVGLength2.h"
#include "DOMSVGLength.h"
namespace mozilla {
namespace dom {
@ -22,18 +21,18 @@ SVGAnimatedLength::WrapObject(JSContext* aCx)
return SVGAnimatedLengthBinding::Wrap(aCx, this);
}
already_AddRefed<DOMSVGLength>
already_AddRefed<nsIDOMSVGLength>
SVGAnimatedLength::BaseVal()
{
nsRefPtr<DOMSVGLength> angle;
nsRefPtr<nsIDOMSVGLength> angle;
mVal->ToDOMBaseVal(getter_AddRefs(angle), mSVGElement);
return angle.forget();
}
already_AddRefed<DOMSVGLength>
already_AddRefed<nsIDOMSVGLength>
SVGAnimatedLength::AnimVal()
{
nsRefPtr<DOMSVGLength> angle;
nsRefPtr<nsIDOMSVGLength> angle;
mVal->ToDOMAnimVal(getter_AddRefs(angle), mSVGElement);
return angle.forget();
}

View File

@ -10,11 +10,9 @@
#include "nsSVGElement.h"
class nsSVGLength2;
class nsIDOMSVGLength;
namespace mozilla {
class DOMSVGLength;
namespace dom {
class SVGAnimatedLength MOZ_FINAL : public nsWrapperCache
@ -32,8 +30,8 @@ public:
// WebIDL
nsSVGElement* GetParentObject() { return mSVGElement; }
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
already_AddRefed<DOMSVGLength> BaseVal();
already_AddRefed<DOMSVGLength> AnimVal();
already_AddRefed<nsIDOMSVGLength> BaseVal();
already_AddRefed<nsIDOMSVGLength> AnimVal();
protected:
nsSVGLength2* mVal; // kept alive because it belongs to content

View File

@ -387,10 +387,10 @@ SVGSVGElement::CreateSVGNumber()
return number.forget();
}
already_AddRefed<DOMSVGLength>
already_AddRefed<nsIDOMSVGLength>
SVGSVGElement::CreateSVGLength()
{
nsCOMPtr<DOMSVGLength> length = new DOMSVGLength();
nsCOMPtr<nsIDOMSVGLength> length = new DOMSVGLength();
return length.forget();
}

View File

@ -30,7 +30,6 @@ class nsSVGImageFrame;
namespace mozilla {
class AutoSVGRenderingState;
class DOMSVGAnimatedPreserveAspectRatio;
class DOMSVGLength;
class EventChainPreVisitor;
class SVGFragmentIdentifier;
@ -240,7 +239,7 @@ public:
void SetCurrentTime(float seconds);
void DeselectAll();
already_AddRefed<nsIDOMSVGNumber> CreateSVGNumber();
already_AddRefed<DOMSVGLength> CreateSVGLength();
already_AddRefed<nsIDOMSVGLength> CreateSVGLength();
already_AddRefed<SVGAngle> CreateSVGAngle();
already_AddRefed<nsISVGPoint> CreateSVGPoint();
already_AddRefed<SVGMatrix> CreateSVGMatrix();

View File

@ -15,11 +15,32 @@
#include "nsSVGAttrTearoffTable.h"
#include "nsSVGIntegrationUtils.h"
#include "nsTextFormatter.h"
#include "DOMSVGLength.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGLength2::DOMBaseVal, mSVGElement)
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGLength2::DOMAnimVal, mSVGElement)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGLength2::DOMBaseVal)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGLength2::DOMBaseVal)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGLength2::DOMAnimVal)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGLength2::DOMAnimVal)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGLength2::DOMBaseVal)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGLength)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGLength2::DOMAnimVal)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGLength)
NS_INTERFACE_MAP_END
static nsIAtom** const unitMap[] =
{
nullptr, /* SVG_LENGTHTYPE_UNKNOWN */
@ -37,6 +58,10 @@ static nsIAtom** const unitMap[] =
static nsSVGAttrTearoffTable<nsSVGLength2, SVGAnimatedLength>
sSVGAnimatedLengthTearoffTable;
static nsSVGAttrTearoffTable<nsSVGLength2, nsSVGLength2::DOMBaseVal>
sBaseSVGLengthTearoffTable;
static nsSVGAttrTearoffTable<nsSVGLength2, nsSVGLength2::DOMAnimVal>
sAnimSVGLengthTearoffTable;
/* Helper functions */
@ -320,25 +345,43 @@ nsSVGLength2::NewValueSpecifiedUnits(uint16_t unitType,
}
nsresult
nsSVGLength2::ToDOMBaseVal(DOMSVGLength **aResult, nsSVGElement *aSVGElement)
nsSVGLength2::ToDOMBaseVal(nsIDOMSVGLength **aResult, nsSVGElement *aSVGElement)
{
nsRefPtr<DOMSVGLength> domBaseVal =
DOMSVGLength::GetTearOff(this, aSVGElement, false);
nsRefPtr<DOMBaseVal> domBaseVal =
sBaseSVGLengthTearoffTable.GetTearoff(this);
if (!domBaseVal) {
domBaseVal = new DOMBaseVal(this, aSVGElement);
sBaseSVGLengthTearoffTable.AddTearoff(this, domBaseVal);
}
domBaseVal.forget(aResult);
return NS_OK;
}
nsresult
nsSVGLength2::ToDOMAnimVal(DOMSVGLength **aResult, nsSVGElement *aSVGElement)
nsSVGLength2::DOMBaseVal::~DOMBaseVal()
{
nsRefPtr<DOMSVGLength> domAnimVal =
DOMSVGLength::GetTearOff(this, aSVGElement, true);
sBaseSVGLengthTearoffTable.RemoveTearoff(mVal);
}
nsresult
nsSVGLength2::ToDOMAnimVal(nsIDOMSVGLength **aResult, nsSVGElement *aSVGElement)
{
nsRefPtr<DOMAnimVal> domAnimVal =
sAnimSVGLengthTearoffTable.GetTearoff(this);
if (!domAnimVal) {
domAnimVal = new DOMAnimVal(this, aSVGElement);
sAnimSVGLengthTearoffTable.AddTearoff(this, domAnimVal);
}
domAnimVal.forget(aResult);
return NS_OK;
}
nsSVGLength2::DOMAnimVal::~DOMAnimVal()
{
sAnimSVGLengthTearoffTable.RemoveTearoff(mVal);
}
/* Implementation */
nsresult

View File

@ -21,7 +21,6 @@ class nsIFrame;
class nsSMILValue;
namespace mozilla {
class DOMSVGLength;
namespace dom {
class SVGAnimatedLength;
class SVGAnimationElement;
@ -32,7 +31,6 @@ class SVGSVGElement;
class nsSVGLength2
{
friend class mozilla::dom::SVGAnimatedLength;
friend class mozilla::DOMSVGLength;
public:
void Init(uint8_t aCtxType = SVGContentUtils::XY,
uint8_t aAttrEnum = 0xff,
@ -133,10 +131,118 @@ private:
nsresult NewValueSpecifiedUnits(uint16_t aUnitType, float aValue,
nsSVGElement *aSVGElement);
nsresult ConvertToSpecifiedUnits(uint16_t aUnitType, nsSVGElement *aSVGElement);
nsresult ToDOMBaseVal(mozilla::DOMSVGLength **aResult, nsSVGElement* aSVGElement);
nsresult ToDOMAnimVal(mozilla::DOMSVGLength **aResult, nsSVGElement* aSVGElement);
nsresult ToDOMBaseVal(nsIDOMSVGLength **aResult, nsSVGElement* aSVGElement);
nsresult ToDOMAnimVal(nsIDOMSVGLength **aResult, nsSVGElement* aSVGElement);
public:
struct DOMBaseVal : public nsIDOMSVGLength
{
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal)
DOMBaseVal(nsSVGLength2* aVal, nsSVGElement *aSVGElement)
: mVal(aVal), mSVGElement(aSVGElement) {}
virtual ~DOMBaseVal();
nsSVGLength2* mVal; // kept alive because it belongs to mSVGElement
nsRefPtr<nsSVGElement> mSVGElement;
NS_IMETHOD GetUnitType(uint16_t* aResult) MOZ_OVERRIDE
{ *aResult = mVal->mSpecifiedUnitType; return NS_OK; }
NS_IMETHOD GetValue(float* aResult) MOZ_OVERRIDE
{ *aResult = mVal->GetBaseValue(mSVGElement); return NS_OK; }
NS_IMETHOD SetValue(float aValue) MOZ_OVERRIDE
{
if (!NS_finite(aValue)) {
return NS_ERROR_ILLEGAL_VALUE;
}
mVal->SetBaseValue(aValue, mSVGElement, true);
return NS_OK;
}
NS_IMETHOD GetValueInSpecifiedUnits(float* aResult) MOZ_OVERRIDE
{ *aResult = mVal->mBaseVal; return NS_OK; }
NS_IMETHOD SetValueInSpecifiedUnits(float aValue) MOZ_OVERRIDE
{
if (!NS_finite(aValue)) {
return NS_ERROR_ILLEGAL_VALUE;
}
mVal->SetBaseValueInSpecifiedUnits(aValue, mSVGElement, true);
return NS_OK;
}
NS_IMETHOD SetValueAsString(const nsAString& aValue) MOZ_OVERRIDE
{ return mVal->SetBaseValueString(aValue, mSVGElement, true); }
NS_IMETHOD GetValueAsString(nsAString& aValue) MOZ_OVERRIDE
{ mVal->GetBaseValueString(aValue); return NS_OK; }
NS_IMETHOD NewValueSpecifiedUnits(uint16_t unitType,
float valueInSpecifiedUnits) MOZ_OVERRIDE
{
return mVal->NewValueSpecifiedUnits(unitType, valueInSpecifiedUnits,
mSVGElement); }
NS_IMETHOD ConvertToSpecifiedUnits(uint16_t unitType) MOZ_OVERRIDE
{ return mVal->ConvertToSpecifiedUnits(unitType, mSVGElement); }
};
struct DOMAnimVal : public nsIDOMSVGLength
{
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal)
DOMAnimVal(nsSVGLength2* aVal, nsSVGElement *aSVGElement)
: mVal(aVal), mSVGElement(aSVGElement) {}
virtual ~DOMAnimVal();
nsSVGLength2* mVal; // kept alive because it belongs to mSVGElement
nsRefPtr<nsSVGElement> mSVGElement;
// Script may have modified animation parameters or timeline -- DOM getters
// need to flush any resample requests to reflect these modifications.
NS_IMETHOD GetUnitType(uint16_t* aResult) MOZ_OVERRIDE
{
mSVGElement->FlushAnimations();
*aResult = mVal->mSpecifiedUnitType;
return NS_OK;
}
NS_IMETHOD GetValue(float* aResult) MOZ_OVERRIDE
{
mSVGElement->FlushAnimations();
*aResult = mVal->GetAnimValue(mSVGElement);
return NS_OK;
}
NS_IMETHOD SetValue(float aValue) MOZ_OVERRIDE
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
NS_IMETHOD GetValueInSpecifiedUnits(float* aResult) MOZ_OVERRIDE
{
mSVGElement->FlushAnimations();
*aResult = mVal->mAnimVal;
return NS_OK;
}
NS_IMETHOD SetValueInSpecifiedUnits(float aValue) MOZ_OVERRIDE
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
NS_IMETHOD SetValueAsString(const nsAString& aValue) MOZ_OVERRIDE
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
NS_IMETHOD GetValueAsString(nsAString& aValue) MOZ_OVERRIDE
{
mSVGElement->FlushAnimations();
mVal->GetAnimValueString(aValue);
return NS_OK;
}
NS_IMETHOD NewValueSpecifiedUnits(uint16_t unitType,
float valueInSpecifiedUnits) MOZ_OVERRIDE
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
NS_IMETHOD ConvertToSpecifiedUnits(uint16_t unitType) MOZ_OVERRIDE
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
};
struct SMILLength : public nsISMILAttr
{
public:

View File

@ -122,6 +122,7 @@
#include "nsIDOMXPathNSResolver.h"
#include "nsIDOMXPathResult.h"
#include "nsIDOMSVGLength.h"
#include "nsIDOMSVGNumber.h"
// Storage includes
@ -364,6 +365,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
// other SVG classes
NS_DEFINE_CLASSINFO_DATA(SVGLength, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGNumber, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -1015,6 +1018,10 @@ nsDOMClassInfo::Init()
// The SVG document
// other SVG classes
DOM_CLASSINFO_MAP_BEGIN(SVGLength, nsIDOMSVGLength)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLength)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGNumber, nsIDOMSVGNumber)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGNumber)
DOM_CLASSINFO_MAP_END

View File

@ -46,6 +46,7 @@ DOMCI_CLASS(CSSMozDocumentRule)
DOMCI_CLASS(CSSSupportsRule)
// other SVG classes
DOMCI_CLASS(SVGLength)
DOMCI_CLASS(SVGNumber)
// WindowUtils

View File

@ -1055,11 +1055,6 @@ DOMInterfaces = {
'concrete': False,
},
'SVGLength': {
'nativeType': 'mozilla::DOMSVGLength',
'headerFile': 'DOMSVGLength.h'
},
'SVGLengthList': {
'nativeType': 'mozilla::DOMSVGLengthList',
'headerFile': 'DOMSVGLengthList.h'
@ -1921,6 +1916,7 @@ addExternalIface('Principal', nativeType='nsIPrincipal',
addExternalIface('StackFrame', nativeType='nsIStackFrame',
headerFile='nsIException.h', notflattened=True)
addExternalIface('StyleSheetList')
addExternalIface('SVGLength')
addExternalIface('SVGNumber')
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
notflattened=True)

View File

@ -10,6 +10,8 @@
* liability, trademark and document use rules apply.
*/
interface SVGLength;
interface SVGAnimatedLength {
[Constant]
readonly attribute SVGLength baseVal;

View File

@ -1,40 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/SVG2/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGLength {
// Length Unit Types
const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0;
const unsigned short SVG_LENGTHTYPE_NUMBER = 1;
const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2;
const unsigned short SVG_LENGTHTYPE_EMS = 3;
const unsigned short SVG_LENGTHTYPE_EXS = 4;
const unsigned short SVG_LENGTHTYPE_PX = 5;
const unsigned short SVG_LENGTHTYPE_CM = 6;
const unsigned short SVG_LENGTHTYPE_MM = 7;
const unsigned short SVG_LENGTHTYPE_IN = 8;
const unsigned short SVG_LENGTHTYPE_PT = 9;
const unsigned short SVG_LENGTHTYPE_PC = 10;
readonly attribute unsigned short unitType;
[Throws]
attribute float value;
[SetterThrows]
attribute float valueInSpecifiedUnits;
[SetterThrows]
attribute DOMString valueAsString;
[Throws]
void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
[Throws]
void convertToSpecifiedUnits(unsigned short unitType);
};

View File

@ -10,6 +10,8 @@
* liability, trademark and document use rules apply.
*/
interface SVGLength;
interface SVGLengthList {
readonly attribute unsigned long numberOfItems;
[Throws]

View File

@ -365,7 +365,6 @@ WEBIDL_FILES = [
'SVGGradientElement.webidl',
'SVGGraphicsElement.webidl',
'SVGImageElement.webidl',
'SVGLength.webidl',
'SVGLengthList.webidl',
'SVGLinearGradientElement.webidl',
'SVGLineElement.webidl',

View File

@ -27,7 +27,6 @@
#include "nsSVGEffects.h"
#include "mozilla/dom/SVGAnimatedLength.h"
#include "nsMimeTypes.h"
#include "DOMSVGLength.h"
// undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
#undef GetCurrentTime
@ -86,7 +85,7 @@ SVGDocumentWrapper::GetWidthOrHeight(Dimension aDimension,
NS_ENSURE_TRUE(domAnimLength, false);
// Get the animated value from the object
nsRefPtr<DOMSVGLength> domLength = domAnimLength->AnimVal();
nsRefPtr<nsIDOMSVGLength> domLength = domAnimLength->AnimVal();
NS_ENSURE_TRUE(domLength, false);
// Check if it's a percent value (and fail if so)