зеркало из https://github.com/mozilla/gecko-dev.git
Bug 776747 - Talos Regression :( SVG, Opacity Row Major increase 4.54%. r=roc.
This commit is contained in:
Родитель
d81fe2c80e
Коммит
b82eee1846
|
@ -544,17 +544,18 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
}
|
||||
// Check for SVGAnimatedTransformList attribute
|
||||
} else if (GetTransformListAttrName() == aAttribute) {
|
||||
SVGAnimatedTransformList *transformList = GetAnimatedTransformList();
|
||||
if (transformList) {
|
||||
rv = transformList->SetBaseValueString(aValue);
|
||||
if (NS_FAILED(rv)) {
|
||||
transformList->ClearBaseValue();
|
||||
} else {
|
||||
aResult.SetTo(transformList->GetBaseValue(), &aValue);
|
||||
didSetResult = true;
|
||||
}
|
||||
foundMatch = true;
|
||||
// The transform attribute is being set, so we must ensure that the
|
||||
// SVGAnimatedTransformList is/has been allocated:
|
||||
SVGAnimatedTransformList *transformList =
|
||||
GetAnimatedTransformList(DO_ALLOCATE);
|
||||
rv = transformList->SetBaseValueString(aValue);
|
||||
if (NS_FAILED(rv)) {
|
||||
transformList->ClearBaseValue();
|
||||
} else {
|
||||
aResult.SetTo(transformList->GetBaseValue(), &aValue);
|
||||
didSetResult = true;
|
||||
}
|
||||
foundMatch = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2277,8 +2278,10 @@ nsSVGElement::DidChangeTransformList(const nsAttrValue& aEmptyOrOldValue)
|
|||
NS_ABORT_IF_FALSE(GetTransformListAttrName(),
|
||||
"Changing non-existent transform list?");
|
||||
|
||||
// The transform attribute is being set, so we must ensure that the
|
||||
// SVGAnimatedTransformList is/has been allocated:
|
||||
nsAttrValue newValue;
|
||||
newValue.SetTo(GetAnimatedTransformList()->GetBaseValue(), nsnull);
|
||||
newValue.SetTo(GetAnimatedTransformList(DO_ALLOCATE)->GetBaseValue(), nsnull);
|
||||
|
||||
DidChangeValue(GetTransformListAttrName(), aEmptyOrOldValue, newValue);
|
||||
}
|
||||
|
@ -2466,8 +2469,9 @@ nsSVGElement::GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName)
|
|||
|
||||
// Transforms:
|
||||
if (GetTransformListAttrName() == aName) {
|
||||
SVGAnimatedTransformList* transformList = GetAnimatedTransformList();
|
||||
return transformList ? transformList->ToSMILAttr(this) : nsnull;
|
||||
// The transform attribute is being animated, so we must ensure that the
|
||||
// SVGAnimatedTransformList is/has been allocated:
|
||||
return GetAnimatedTransformList(DO_ALLOCATE)->ToSMILAttr(this);
|
||||
}
|
||||
|
||||
// Motion (fake 'attribute' for animateMotion)
|
||||
|
|
|
@ -222,6 +222,16 @@ public:
|
|||
void DidAnimateTransformList();
|
||||
void DidAnimateString(PRUint8 aAttrEnum);
|
||||
|
||||
enum {
|
||||
/**
|
||||
* Flag to indicate to GetAnimatedXxx() methods that the object being
|
||||
* requested should be allocated if it hasn't already been allocated, and
|
||||
* that the method should not return null. Only applicable to methods that
|
||||
* need to allocate the object that they return.
|
||||
*/
|
||||
DO_ALLOCATE = 0x1
|
||||
};
|
||||
|
||||
nsSVGLength2* GetAnimatedLength(const nsIAtom *aAttrName);
|
||||
void GetAnimatedLengthValues(float *aFirst, ...);
|
||||
void GetAnimatedNumberValues(float *aFirst, ...);
|
||||
|
@ -240,9 +250,20 @@ public:
|
|||
// NS_DECL_NSIDOMSVGANIMATEDPATHDATA.
|
||||
return nsnull;
|
||||
}
|
||||
// Despite the fact that animated transform lists are used for a variety of
|
||||
// attributes, no SVG element uses more than one.
|
||||
virtual SVGAnimatedTransformList* GetAnimatedTransformList() {
|
||||
/**
|
||||
* Get the SVGAnimatedTransformList for this element.
|
||||
*
|
||||
* Despite the fact that animated transform lists are used for a variety of
|
||||
* attributes, no SVG element uses more than one.
|
||||
*
|
||||
* It's relatively uncommon for elements to have their transform attribute
|
||||
* set, so to save memory the SVGAnimatedTransformList is not allocated until
|
||||
* the attribute is set/animated or its DOM wrapper is created. Callers that
|
||||
* require the SVGAnimatedTransformList to be allocated and for this method
|
||||
* to return non-null must pass the DO_ALLOCATE flag.
|
||||
*/
|
||||
virtual SVGAnimatedTransformList* GetAnimatedTransformList(
|
||||
PRUint32 aFlags = 0) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,10 @@ NS_IMETHODIMP nsSVGGradientElement::GetGradientUnits(nsIDOMSVGAnimatedEnumeratio
|
|||
/* readonly attribute nsIDOMSVGAnimatedTransformList gradientTransform; */
|
||||
NS_IMETHODIMP nsSVGGradientElement::GetGradientTransform(nsIDOMSVGAnimatedTransformList * *aGradientTransform)
|
||||
{
|
||||
*aGradientTransform =
|
||||
DOMSVGAnimatedTransformList::GetDOMWrapper(GetAnimatedTransformList(), this)
|
||||
.get();
|
||||
// We're creating a DOM wrapper, so we must tell GetAnimatedTransformList
|
||||
// to allocate the SVGAnimatedTransformList if it hasn't already done so:
|
||||
*aGradientTransform = DOMSVGAnimatedTransformList::GetDOMWrapper(
|
||||
GetAnimatedTransformList(DO_ALLOCATE), this).get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -203,9 +204,9 @@ NS_IMETHODIMP nsSVGLinearGradientElement::GetY2(nsIDOMSVGAnimatedLength * *aY2)
|
|||
// nsSVGElement methods
|
||||
|
||||
SVGAnimatedTransformList*
|
||||
nsSVGGradientElement::GetAnimatedTransformList()
|
||||
nsSVGGradientElement::GetAnimatedTransformList(PRUint32 aFlags)
|
||||
{
|
||||
if (!mGradientTransform) {
|
||||
if (!mGradientTransform && (aFlags & DO_ALLOCATE)) {
|
||||
mGradientTransform = new SVGAnimatedTransformList();
|
||||
}
|
||||
return mGradientTransform;
|
||||
|
|
|
@ -43,7 +43,8 @@ public:
|
|||
// nsIContent
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
||||
virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
|
||||
virtual mozilla::SVGAnimatedTransformList*
|
||||
GetAnimatedTransformList(PRUint32 aFlags = 0);
|
||||
virtual nsIAtom* GetTransformListAttrName() const {
|
||||
return nsGkAtoms::gradientTransform;
|
||||
}
|
||||
|
|
|
@ -124,9 +124,10 @@ NS_IMETHODIMP nsSVGGraphicElement::GetTransformToElement(nsIDOMSVGElement *eleme
|
|||
NS_IMETHODIMP nsSVGGraphicElement::GetTransform(
|
||||
nsIDOMSVGAnimatedTransformList **aTransform)
|
||||
{
|
||||
*aTransform =
|
||||
DOMSVGAnimatedTransformList::GetDOMWrapper(GetAnimatedTransformList(), this)
|
||||
.get();
|
||||
// We're creating a DOM wrapper, so we must tell GetAnimatedTransformList
|
||||
// to allocate the SVGAnimatedTransformList if it hasn't already done so:
|
||||
*aTransform = DOMSVGAnimatedTransformList::GetDOMWrapper(
|
||||
GetAnimatedTransformList(DO_ALLOCATE), this).get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -237,9 +238,9 @@ nsSVGGraphicElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
|
|||
}
|
||||
|
||||
SVGAnimatedTransformList*
|
||||
nsSVGGraphicElement::GetAnimatedTransformList()
|
||||
nsSVGGraphicElement::GetAnimatedTransformList(PRUint32 aFlags)
|
||||
{
|
||||
if (!mTransforms) {
|
||||
if (!mTransforms && (aFlags & DO_ALLOCATE)) {
|
||||
mTransforms = new SVGAnimatedTransformList();
|
||||
}
|
||||
return mTransforms;
|
||||
|
|
|
@ -37,7 +37,8 @@ public:
|
|||
virtual const gfxMatrix* GetAnimateMotionTransform() const;
|
||||
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix);
|
||||
|
||||
virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
|
||||
virtual mozilla::SVGAnimatedTransformList*
|
||||
GetAnimatedTransformList(PRUint32 aFlags = 0);
|
||||
virtual nsIAtom* GetTransformListAttrName() const {
|
||||
return nsGkAtoms::transform;
|
||||
}
|
||||
|
|
|
@ -107,9 +107,10 @@ NS_IMETHODIMP nsSVGPatternElement::GetPatternContentUnits(nsIDOMSVGAnimatedEnume
|
|||
/* readonly attribute nsIDOMSVGAnimatedTransformList patternTransform; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetPatternTransform(nsIDOMSVGAnimatedTransformList * *aPatternTransform)
|
||||
{
|
||||
*aPatternTransform =
|
||||
DOMSVGAnimatedTransformList::GetDOMWrapper(GetAnimatedTransformList(), this)
|
||||
.get();
|
||||
// We're creating a DOM wrapper, so we must tell GetAnimatedTransformList
|
||||
// to allocate the SVGAnimatedTransformList if it hasn't already done so:
|
||||
*aPatternTransform = DOMSVGAnimatedTransformList::GetDOMWrapper(
|
||||
GetAnimatedTransformList(DO_ALLOCATE), this).get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -173,9 +174,9 @@ nsSVGPatternElement::IsAttributeMapped(const nsIAtom* name) const
|
|||
// nsSVGElement methods
|
||||
|
||||
SVGAnimatedTransformList*
|
||||
nsSVGPatternElement::GetAnimatedTransformList()
|
||||
nsSVGPatternElement::GetAnimatedTransformList(PRUint32 aFlags)
|
||||
{
|
||||
if (!mPatternTransform) {
|
||||
if (!mPatternTransform && (aFlags & DO_ALLOCATE)) {
|
||||
mPatternTransform = new SVGAnimatedTransformList();
|
||||
}
|
||||
return mPatternTransform;
|
||||
|
|
|
@ -68,7 +68,8 @@ public:
|
|||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
|
||||
virtual mozilla::SVGAnimatedTransformList*
|
||||
GetAnimatedTransformList(PRUint32 aFlags = 0);
|
||||
virtual nsIAtom* GetTransformListAttrName() const {
|
||||
return nsGkAtoms::patternTransform;
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ nsSVGGradientFrame::GetGradientTransformList(nsIContent* aDefault)
|
|||
SVGAnimatedTransformList *thisTransformList =
|
||||
static_cast<nsSVGGradientElement *>(mContent)->GetAnimatedTransformList();
|
||||
|
||||
if (thisTransformList->IsExplicitlySet())
|
||||
if (thisTransformList && thisTransformList->IsExplicitlySet())
|
||||
return thisTransformList;
|
||||
|
||||
AutoGradientReferencer gradientRef(this);
|
||||
|
|
|
@ -364,7 +364,7 @@ nsSVGPatternFrame::GetPatternTransformList(nsIContent* aDefault)
|
|||
SVGAnimatedTransformList *thisTransformList =
|
||||
static_cast<nsSVGPatternElement *>(mContent)->GetAnimatedTransformList();
|
||||
|
||||
if (thisTransformList->IsExplicitlySet())
|
||||
if (thisTransformList && thisTransformList->IsExplicitlySet())
|
||||
return thisTransformList;
|
||||
|
||||
AutoPatternReferencer patternRef(this);
|
||||
|
|
Загрузка…
Ссылка в новой задаче