зеркало из https://github.com/mozilla/gecko-dev.git
Bug 653571 - Add IsIdentity() function to SVG{Length,Point}ListAndInfo. r=dholbert
This commit is contained in:
Родитель
90315d8451
Коммит
1f7fe699e1
|
@ -196,6 +196,19 @@ public:
|
|||
return static_cast<nsSVGElement*>(e.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this object is an "identity" value, from the perspective
|
||||
* of SMIL. In other words, returns true until the initial value set up in
|
||||
* SVGLengthListSMILType::Init() has been changed with a SetInfo() call.
|
||||
*/
|
||||
bool IsIdentity() const {
|
||||
if (!mElement) {
|
||||
NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Axis() const {
|
||||
NS_ABORT_IF_FALSE(mElement, "Axis() isn't valid");
|
||||
return mAxis;
|
||||
|
|
|
@ -93,15 +93,11 @@ SVGLengthListSMILType::Add(nsSMILValue& aDest,
|
|||
// should be, not zeros, and those values are not explicit or otherwise
|
||||
// available.
|
||||
|
||||
if (!valueToAdd.Element()) { // Adding identity value - no-op
|
||||
NS_ABORT_IF_FALSE(valueToAdd.IsEmpty(),
|
||||
"Identity values should be empty");
|
||||
if (valueToAdd.IsIdentity()) { // Adding identity value - no-op
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!dest.Element()) { // Adding *to* an identity value
|
||||
NS_ABORT_IF_FALSE(dest.IsEmpty(),
|
||||
"Identity values should be empty");
|
||||
if (dest.IsIdentity()) { // Adding *to* an identity value
|
||||
if (!dest.SetLength(valueToAdd.Length())) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -253,6 +253,11 @@ public:
|
|||
return SVGPathData::CopyFrom(rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this object is an "identity" value, from the perspective
|
||||
* of SMIL. In other words, returns true until the initial value set up in
|
||||
* SVGPathSegListSMILType::Init() has been changed with a SetInfo() call.
|
||||
*/
|
||||
bool IsIdentity() const {
|
||||
if (!mElement) {
|
||||
NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure");
|
||||
|
|
|
@ -174,6 +174,19 @@ public:
|
|||
return static_cast<nsSVGElement*>(e.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this object is an "identity" value, from the perspective
|
||||
* of SMIL. In other words, returns true until the initial value set up in
|
||||
* SVGPointListSMILType::Init() has been changed with a SetInfo() call.
|
||||
*/
|
||||
bool IsIdentity() const {
|
||||
if (!mElement) {
|
||||
NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult CopyFrom(const SVGPointListAndInfo& rhs) {
|
||||
mElement = rhs.mElement;
|
||||
return SVGPointList::CopyFrom(rhs);
|
||||
|
|
|
@ -78,14 +78,10 @@ SVGPointListSMILType::Add(nsSMILValue& aDest,
|
|||
NS_ABORT_IF_FALSE(dest.Element() || valueToAdd.Element(),
|
||||
"Target element propagation failure");
|
||||
|
||||
if (!valueToAdd.Element()) {
|
||||
NS_ABORT_IF_FALSE(valueToAdd.Length() == 0,
|
||||
"Not identity value - target element propagation failure");
|
||||
if (valueToAdd.IsIdentity()) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!dest.Element()) {
|
||||
NS_ABORT_IF_FALSE(dest.Length() == 0,
|
||||
"Not identity value - target element propagation failure");
|
||||
if (dest.IsIdentity()) {
|
||||
if (!dest.SetLength(valueToAdd.Length())) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче