зеркало из https://github.com/mozilla/gecko-dev.git
Bug 758505, Part 3: Avoid unnecessary invalidations on repeated calls to set the same animated value (for SMIL animations of CSS, mapped attrs, and motion). r=dholbert
This commit is contained in:
Родитель
d5b5f12a6e
Коммит
fefd1ff8c2
|
@ -166,6 +166,11 @@ nsSMILCSSProperty::SetAnimValue(const nsSMILValue& aValue)
|
|||
nsCOMPtr<nsICSSDeclaration> overrideDecl =
|
||||
do_QueryInterface(mElement->GetSMILOverrideStyle());
|
||||
if (overrideDecl) {
|
||||
nsAutoString oldValStr;
|
||||
overrideDecl->GetPropertyValue(mPropID, oldValStr);
|
||||
if (valStr.Equals(oldValStr)) {
|
||||
return NS_OK;
|
||||
}
|
||||
overrideDecl->SetPropertyValue(mPropID, valStr);
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
/* representation of a SMIL-animatable mapped attribute on an element */
|
||||
#include "nsSMILMappedAttribute.h"
|
||||
#include "nsAttrValue.h"
|
||||
#include "nsPropertyTable.h"
|
||||
#include "nsContentErrors.h" // For NS_PROPTABLE_PROP_OVERWRITTEN
|
||||
#include "nsSMILValue.h"
|
||||
|
@ -92,10 +93,16 @@ nsSMILMappedAttribute::SetAnimValue(const nsSMILValue& aValue)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<nsIAtom> attrName = GetAttrNameAtom();
|
||||
nsStringBuffer* oldValStrBuf = static_cast<nsStringBuffer*>
|
||||
(mElement->GetProperty(SMIL_MAPPED_ATTR_ANIMVAL, attrName));
|
||||
if (oldValStrBuf && valStr.Equals(nsCheapString(oldValStrBuf))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Set the string as this mapped attribute's animated value.
|
||||
nsStringBuffer* valStrBuf =
|
||||
nsCSSValue::BufferFromString(nsString(valStr)).get();
|
||||
nsRefPtr<nsIAtom> attrName = GetAttrNameAtom();
|
||||
nsresult rv = mElement->SetProperty(SMIL_MAPPED_ATTR_ANIMVAL,
|
||||
attrName, valStrBuf,
|
||||
ReleaseStringBufferPropertyValue);
|
||||
|
|
|
@ -229,6 +229,10 @@ nsSVGGraphicElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
|||
void
|
||||
nsSVGGraphicElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
|
||||
{
|
||||
if ((!aMatrix && !mAnimateMotionTransform) ||
|
||||
aMatrix && mAnimateMotionTransform && *aMatrix == *mAnimateMotionTransform) {
|
||||
return;
|
||||
}
|
||||
mAnimateMotionTransform = aMatrix ? new gfxMatrix(*aMatrix) : nsnull;
|
||||
DidAnimateTransformList();
|
||||
}
|
||||
|
|
|
@ -65,6 +65,21 @@ public:
|
|||
return gfxMatrix(*this).Multiply(m);
|
||||
}
|
||||
|
||||
/* Returns true if the other matrix is fuzzy-equal to this matrix.
|
||||
* Note that this isn't a cheap comparison!
|
||||
*/
|
||||
bool operator==(const gfxMatrix& other) const
|
||||
{
|
||||
return FuzzyEqual(xx, other.xx) && FuzzyEqual(yx, other.yx) &&
|
||||
FuzzyEqual(xy, other.xy) && FuzzyEqual(yy, other.yy) &&
|
||||
FuzzyEqual(x0, other.x0) && FuzzyEqual(y0, other.y0);
|
||||
}
|
||||
|
||||
bool operator!=(const gfxMatrix& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
// matrix operations
|
||||
/**
|
||||
* Resets this matrix to the identity matrix.
|
||||
|
|
Загрузка…
Ссылка в новой задаче