Bug 363583 - remove non-standard getConsolidationMatrix function from SVG DOM r=jwatt,sr=roc
git-svn-id: svn://10.0.0.236/trunk@217679 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -124,8 +124,8 @@ nsSVGGraphicElement::AppendLocalTransform(nsIDOMSVGMatrix *aCTM,
|
||||
nsCOMPtr<nsIDOMSVGTransformList> transforms;
|
||||
mTransforms->GetAnimVal(getter_AddRefs(transforms));
|
||||
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIDOMSVGMatrix> matrix;
|
||||
transforms->GetConsolidationMatrix(getter_AddRefs(matrix));
|
||||
nsCOMPtr<nsIDOMSVGMatrix> matrix =
|
||||
nsSVGTransformList::GetConsolidationMatrix(transforms);
|
||||
if (!matrix) {
|
||||
*_retval = aCTM;
|
||||
NS_ADDREF(*_retval);
|
||||
@@ -293,13 +293,7 @@ nsSVGGraphicElement::GetLocalTransformMatrix()
|
||||
rv = mTransforms->GetAnimVal(getter_AddRefs(transforms));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> localTM;
|
||||
rv = transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsIDOMSVGMatrix *retval = localTM.get();
|
||||
NS_IF_ADDREF(retval);
|
||||
return retval;
|
||||
return nsSVGTransformList::GetConsolidationMatrix(transforms);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
||||
@@ -103,6 +103,43 @@ nsSVGTransformList::AppendElement(nsIDOMSVGTransform* aElement)
|
||||
return rv;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGMatrix>
|
||||
nsSVGTransformList::GetConsolidationMatrix(nsIDOMSVGTransformList *transforms)
|
||||
{
|
||||
PRUint32 count;
|
||||
transforms->GetNumberOfItems(&count);
|
||||
|
||||
if (!count)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMSVGTransform> transform;
|
||||
nsCOMPtr<nsIDOMSVGMatrix> conmatrix;
|
||||
|
||||
// single transform common case - shortcut
|
||||
if (count == 1) {
|
||||
transforms->GetItem(0, getter_AddRefs(transform));
|
||||
transform->GetMatrix(getter_AddRefs(conmatrix));
|
||||
} else {
|
||||
nsresult rv = NS_NewSVGMatrix(getter_AddRefs(conmatrix));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> temp1, temp2;
|
||||
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
transforms->GetItem(i, getter_AddRefs(transform));
|
||||
transform->GetMatrix(getter_AddRefs(temp1));
|
||||
conmatrix->Multiply(temp1, getter_AddRefs(temp2));
|
||||
if (!temp2)
|
||||
return nsnull;
|
||||
conmatrix = temp2;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMSVGMatrix *_retval = nsnull;
|
||||
conmatrix.swap(_retval);
|
||||
return _retval;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// XPConnect interface list
|
||||
NS_CLASSINFO_MAP_BEGIN(SVGTransformList)
|
||||
@@ -376,13 +413,13 @@ NS_IMETHODIMP nsSVGTransformList::Consolidate(nsIDOMSVGTransform **_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> conmatrix;
|
||||
nsresult rv = GetConsolidationMatrix(getter_AddRefs(conmatrix));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsCOMPtr<nsIDOMSVGMatrix> conmatrix = GetConsolidationMatrix(this);
|
||||
if (!conmatrix)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsIDOMSVGTransform> consolidation;
|
||||
rv = CreateSVGTransformFromMatrix(conmatrix, getter_AddRefs(consolidation));
|
||||
nsresult rv = CreateSVGTransformFromMatrix(conmatrix,
|
||||
getter_AddRefs(consolidation));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@@ -392,46 +429,9 @@ NS_IMETHODIMP nsSVGTransformList::Consolidate(nsIDOMSVGTransform **_retval)
|
||||
|
||||
*_retval = consolidation;
|
||||
NS_ADDREF(*_retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* nsIDOMSVGMatrix getConsolidation (); */
|
||||
NS_IMETHODIMP nsSVGTransformList::GetConsolidationMatrix(nsIDOMSVGMatrix **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
PRInt32 count = mTransforms.Count();
|
||||
|
||||
if (!count)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> conmatrix;
|
||||
|
||||
// single transform common case - shortcut
|
||||
if (count == 1) {
|
||||
ElementAt(0)->GetMatrix(getter_AddRefs(conmatrix));
|
||||
} else {
|
||||
nsresult rv = NS_NewSVGMatrix(getter_AddRefs(conmatrix));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> temp1, temp2;
|
||||
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsIDOMSVGTransform* transform = ElementAt(i);
|
||||
transform->GetMatrix(getter_AddRefs(temp1));
|
||||
conmatrix->Multiply(temp1, getter_AddRefs(temp2));
|
||||
if (!temp2)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
conmatrix = temp2;
|
||||
}
|
||||
}
|
||||
|
||||
*_retval = conmatrix;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ public:
|
||||
// other methods:
|
||||
nsIDOMSVGTransform* ElementAt(PRInt32 index);
|
||||
PRBool AppendElement(nsIDOMSVGTransform* aElement);
|
||||
static already_AddRefed<nsIDOMSVGMatrix>
|
||||
GetConsolidationMatrix(nsIDOMSVGTransformList *transforms);
|
||||
|
||||
protected:
|
||||
PRInt32 ParseParameterList(char *paramstr, float *vars, PRInt32 nvars);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
interface nsIDOMSVGTransform;
|
||||
interface nsIDOMSVGMatrix;
|
||||
|
||||
[scriptable, uuid(df41474c-a4f8-4ec3-ae79-4342e6f56d8e)]
|
||||
[scriptable, uuid(cee0a9d4-8554-4bf6-bf9b-7d0cebb4269d)]
|
||||
interface nsIDOMSVGTransformList : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long numberOfItems;
|
||||
@@ -64,7 +64,4 @@ interface nsIDOMSVGTransformList : nsISupports
|
||||
// raises( DOMException, SVGException );
|
||||
nsIDOMSVGTransform createSVGTransformFromMatrix(in nsIDOMSVGMatrix matrix);
|
||||
nsIDOMSVGTransform consolidate();
|
||||
|
||||
// Mozilla extension, not part of W3 SVG DOM:
|
||||
nsIDOMSVGMatrix getConsolidationMatrix();
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "nsIDOMSVGAnimatedNumber.h"
|
||||
#include "nsIDOMSVGAnimatedString.h"
|
||||
#include "nsIDOMSVGAnimTransformList.h"
|
||||
#include "nsIDOMSVGTransformList.h"
|
||||
#include "nsSVGTransformList.h"
|
||||
#include "nsSVGMatrix.h"
|
||||
#include "nsIDOMSVGStopElement.h"
|
||||
#include "nsSVGGradientElement.h"
|
||||
@@ -295,8 +295,8 @@ nsSVGGradientFrame::GetGradientTransform(nsIDOMSVGMatrix **aGradientTransform,
|
||||
gradElement->GetGradientTransform(getter_AddRefs(animTrans));
|
||||
nsCOMPtr<nsIDOMSVGTransformList> trans;
|
||||
animTrans->GetAnimVal(getter_AddRefs(trans));
|
||||
nsCOMPtr<nsIDOMSVGMatrix> gradientTransform;
|
||||
trans->GetConsolidationMatrix(getter_AddRefs(gradientTransform));
|
||||
nsCOMPtr<nsIDOMSVGMatrix> gradientTransform =
|
||||
nsSVGTransformList::GetConsolidationMatrix(trans);
|
||||
|
||||
if (!gradientTransform) {
|
||||
*aGradientTransform = bboxTransform;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "nsIDOMSVGAnimatedEnum.h"
|
||||
#include "nsIDOMSVGAnimatedRect.h"
|
||||
#include "nsIDOMSVGAnimTransformList.h"
|
||||
#include "nsIDOMSVGTransformList.h"
|
||||
#include "nsSVGTransformList.h"
|
||||
#include "nsSVGAnimatedPreserveAspectRatio.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@@ -379,7 +379,7 @@ nsresult
|
||||
nsSVGPatternFrame::GetPatternTransform(nsIDOMSVGMatrix **aPatternTransform)
|
||||
{
|
||||
*aPatternTransform = nsnull;
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// See if we need to get the value from another pattern
|
||||
if (!checkURITarget(nsGkAtoms::patternTransform)) {
|
||||
@@ -390,9 +390,14 @@ nsSVGPatternFrame::GetPatternTransform(nsIDOMSVGMatrix **aPatternTransform)
|
||||
patternElement->GetPatternTransform(getter_AddRefs(trans));
|
||||
nsCOMPtr<nsIDOMSVGTransformList> lTrans;
|
||||
trans->GetAnimVal(getter_AddRefs(lTrans));
|
||||
rv = lTrans->GetConsolidationMatrix(aPatternTransform);
|
||||
if (NS_FAILED(rv) || !*aPatternTransform)
|
||||
nsCOMPtr<nsIDOMSVGMatrix> patternTransform =
|
||||
nsSVGTransformList::GetConsolidationMatrix(lTrans);
|
||||
if (patternTransform) {
|
||||
*aPatternTransform = patternTransform;
|
||||
NS_ADDREF(*aPatternTransform);
|
||||
} else {
|
||||
rv = NS_NewSVGMatrix(aPatternTransform);
|
||||
}
|
||||
} else {
|
||||
// Yes, get it from the target
|
||||
rv = mNextPattern->GetPatternTransform(aPatternTransform);
|
||||
|
||||
Reference in New Issue
Block a user