зеркало из https://github.com/mozilla/gecko-dev.git
Bug 345488 - transform from path applied to textPath at wrong time.
r=longson, sr=roc
This commit is contained in:
Родитель
1a321870f1
Коммит
ee7ced5968
|
@ -47,6 +47,7 @@
|
|||
#include "nsISVGValueUtils.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsSVGPoint.h"
|
||||
#include "nsSVGMatrix.h"
|
||||
|
||||
nsSVGElement::NumberInfo nsSVGPathElement::sNumberInfo =
|
||||
{ &nsGkAtoms::pathLength, 0 };
|
||||
|
@ -103,7 +104,7 @@ nsSVGPathElement::GetTotalLength(float *_retval)
|
|||
{
|
||||
*_retval = 0;
|
||||
|
||||
nsAutoPtr<nsSVGFlattenedPath> flat(GetFlattenedPath());
|
||||
nsAutoPtr<nsSVGFlattenedPath> flat(GetFlattenedPath(nsnull));
|
||||
|
||||
if (!flat)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -117,7 +118,7 @@ nsSVGPathElement::GetTotalLength(float *_retval)
|
|||
NS_IMETHODIMP
|
||||
nsSVGPathElement::GetPointAtLength(float distance, nsIDOMSVGPoint **_retval)
|
||||
{
|
||||
nsAutoPtr<nsSVGFlattenedPath> flat(GetFlattenedPath());
|
||||
nsAutoPtr<nsSVGFlattenedPath> flat(GetFlattenedPath(nsnull));
|
||||
if (!flat)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -402,7 +403,7 @@ nsSVGPathElement::DidModifySVGObservable(nsISVGValue* observable,
|
|||
}
|
||||
|
||||
nsSVGFlattenedPath *
|
||||
nsSVGPathElement::GetFlattenedPath()
|
||||
nsSVGPathElement::GetFlattenedPath(nsIDOMSVGMatrix *aMatrix)
|
||||
{
|
||||
cairo_surface_t *dummySurface =
|
||||
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1);
|
||||
|
@ -415,8 +416,15 @@ nsSVGPathElement::GetFlattenedPath()
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
if (aMatrix) {
|
||||
cairo_matrix_t matrix = NS_ConvertSVGMatrixToCairo(aMatrix);
|
||||
cairo_set_matrix(ctx, &matrix);
|
||||
}
|
||||
|
||||
mPathData.Playback(ctx);
|
||||
|
||||
cairo_identity_matrix(ctx);
|
||||
|
||||
cairo_path_t *path = cairo_copy_path_flat(ctx);
|
||||
|
||||
cairo_destroy(ctx);
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
|
||||
virtual void ConstructPath(cairo_t *aCtx);
|
||||
|
||||
virtual nsSVGFlattenedPath *GetFlattenedPath();
|
||||
virtual nsSVGFlattenedPath *GetFlattenedPath(nsIDOMSVGMatrix *aMatrix);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ nsSVGPathGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
|||
}
|
||||
|
||||
nsSVGFlattenedPath *
|
||||
nsSVGPathGeometryElement::GetFlattenedPath()
|
||||
nsSVGPathGeometryElement::GetFlattenedPath(nsIDOMSVGMatrix *aMatrix)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ struct nsSVGMark {
|
|||
};
|
||||
|
||||
class nsSVGFlattenedPath;
|
||||
class nsIDOMSVGMatrix;
|
||||
|
||||
typedef nsSVGGraphicElement nsSVGPathGeometryElementBase;
|
||||
|
||||
|
@ -60,7 +61,7 @@ public:
|
|||
virtual PRBool IsMarkable();
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
|
||||
virtual void ConstructPath(cairo_t *aCtx) = 0;
|
||||
virtual nsSVGFlattenedPath *GetFlattenedPath();
|
||||
virtual nsSVGFlattenedPath *GetFlattenedPath(nsIDOMSVGMatrix *aMatrix);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -205,8 +205,9 @@ nsSVGTextPathFrame::GetFlattenedPath() {
|
|||
|
||||
nsSVGPathGeometryElement *element = NS_STATIC_CAST(nsSVGPathGeometryElement*,
|
||||
path->GetContent());
|
||||
nsCOMPtr<nsIDOMSVGMatrix> localTM = element->GetLocalTransformMatrix();
|
||||
|
||||
return element->GetFlattenedPath();
|
||||
return element->GetFlattenedPath(localTM);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -251,29 +252,3 @@ nsSVGTextPathFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGContainerFrame methods:
|
||||
|
||||
already_AddRefed<nsIDOMSVGMatrix>
|
||||
nsSVGTextPathFrame::GetCanvasTM()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGMatrix> transform = nsSVGTextPathFrameBase::GetCanvasTM();
|
||||
|
||||
nsIFrame *path = GetPathFrame();
|
||||
if (path) {
|
||||
nsSVGGraphicElement *element =
|
||||
NS_STATIC_CAST(nsSVGGraphicElement*, path->GetContent());
|
||||
nsCOMPtr<nsIDOMSVGMatrix> localTM = element->GetLocalTransformMatrix();
|
||||
|
||||
if (localTM) {
|
||||
nsCOMPtr<nsIDOMSVGMatrix> tmp;
|
||||
transform->Multiply(localTM, getter_AddRefs(tmp));
|
||||
transform = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMSVGMatrix* retval = nsnull;
|
||||
transform.swap(retval);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -87,9 +87,6 @@ public:
|
|||
nsSVGFlattenedPath *GetFlattenedPath();
|
||||
nsIFrame *GetPathFrame();
|
||||
|
||||
// nsSVGContainerFrame methods:
|
||||
virtual already_AddRefed<nsIDOMSVGMatrix> GetCanvasTM();
|
||||
|
||||
// nsISupports interface:
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче