Backout b04bd18e5692 for reftest failure

This commit is contained in:
David Zbarsky 2013-12-26 15:13:57 -05:00
Родитель 7460be5255
Коммит 80f65de35f
25 изменённых файлов: 112 добавлений и 120 удалений

Просмотреть файл

@ -18,7 +18,6 @@
#include "SVGAnimationElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "nsContentUtils.h"
#include "gfx2DGlue.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla;
@ -181,7 +180,7 @@ SVGContentUtils::GetNearestViewportElement(nsIContent *aContent)
static gfxMatrix
GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
{
gfx::Matrix matrix = aElement->PrependLocalTransformsTo(gfx::Matrix(),
gfxMatrix matrix = aElement->PrependLocalTransformsTo(gfxMatrix(),
aHaveRecursed ? nsSVGElement::eAllTransforms : nsSVGElement::eUserSpaceToParent);
nsSVGElement *element = aElement;
nsIContent *ancestor = aElement->GetFlattenedTreeParent();
@ -189,7 +188,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
while (ancestor && ancestor->IsSVG() &&
ancestor->Tag() != nsGkAtoms::foreignObject) {
element = static_cast<nsSVGElement*>(ancestor);
matrix *= element->PrependLocalTransformsTo(gfx::Matrix()); // i.e. *A*ppend
matrix *= element->PrependLocalTransformsTo(gfxMatrix()); // i.e. *A*ppend
if (!aScreenCTM && SVGContentUtils::EstablishesViewport(element)) {
if (!element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG) &&
!element->NodeInfo()->Equals(nsGkAtoms::symbol, kNameSpaceID_SVG)) {
@ -197,7 +196,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
return gfxMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
}
// XXX spec seems to say x,y translation should be undone for IsInnerSVG
return ThebesMatrix(matrix);
return matrix;
}
ancestor = ancestor->GetFlattenedTreeParent();
}
@ -216,14 +215,14 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
// transforms in this case since that's what we've been doing for
// a while, and it keeps us consistent with WebKit and Opera (if not
// really with the ambiguous spec).
matrix = aElement->PrependLocalTransformsTo(gfx::Matrix());
matrix = aElement->PrependLocalTransformsTo(gfxMatrix());
}
if (!ancestor || !ancestor->IsElement()) {
return ThebesMatrix(matrix);
return matrix;
}
if (ancestor->IsSVG()) {
return
ThebesMatrix(matrix) * GetCTMInternal(static_cast<nsSVGElement*>(ancestor), true, true);
matrix * GetCTMInternal(static_cast<nsSVGElement*>(ancestor), true, true);
}
// XXX this does not take into account CSS transform, or that the non-SVG
@ -242,7 +241,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
}
}
}
return ThebesMatrix(matrix * gfx::Matrix().Translate(x, y));
return matrix * gfxMatrix().Translate(gfxPoint(x, y));
}
gfxMatrix

Просмотреть файл

@ -70,15 +70,15 @@ SVGForeignObjectElement::Height()
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ gfx::Matrix
SVGForeignObjectElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
/* virtual */ gfxMatrix
SVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
// 'transform' attribute:
gfx::Matrix fromUserSpace =
gfxMatrix fromUserSpace =
SVGGraphicsElement::PrependLocalTransformsTo(aMatrix, aWhich);
if (aWhich == eUserSpaceToParent) {
return fromUserSpace;
@ -87,7 +87,7 @@ SVGForeignObjectElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
float x, y;
const_cast<SVGForeignObjectElement*>(this)->
GetAnimatedLengthValues(&x, &y, nullptr);
gfx::Matrix toUserSpace = gfx::Matrix().Translate(x, y);
gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
if (aWhich == eChildToUserSpace) {
return toUserSpace;
}

Просмотреть файл

@ -30,7 +30,7 @@ protected:
public:
// nsSVGElement specializations:
virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE;
virtual bool HasValidDimensions() const MOZ_OVERRIDE;

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsSMILValue.h"
#include "nsDebug.h"
#include "nsSVGElement.h"
#include "gfx2DGlue.h"
namespace mozilla {
@ -41,7 +40,7 @@ SVGMotionSMILAttr::ClearAnimValue()
nsresult
SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue)
{
gfx::Matrix matrix = gfx::ToMatrix(SVGMotionSMILType::CreateMatrix(aValue));
gfxMatrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
mSVGElement->SetAnimateMotionTransform(&matrix);
return NS_OK;
}

Просмотреть файл

@ -348,9 +348,10 @@ SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor)
// For textPath, a transform on the referenced path affects the
// textPath layout, so when calculating the actual path length
// we need to take that into account.
gfx::Matrix matrix = PrependLocalTransformsTo(gfx::Matrix());
gfxMatrix matrix = PrependLocalTransformsTo(gfxMatrix());
if (!matrix.IsIdentity()) {
RefPtr<PathBuilder> builder = path->TransformedCopyToBuilder(matrix);
RefPtr<PathBuilder> builder =
path->TransformedCopyToBuilder(ToMatrix(matrix));
path = builder->Finish();
}
}

Просмотреть файл

@ -946,15 +946,15 @@ SVGSVGElement::GetLength(uint8_t aCtxType)
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ gfx::Matrix
SVGSVGElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
/* virtual */ gfxMatrix
SVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
// 'transform' attribute:
gfx::Matrix fromUserSpace =
gfxMatrix fromUserSpace =
SVGSVGElementBase::PrependLocalTransformsTo(aMatrix, aWhich);
if (aWhich == eUserSpaceToParent) {
return fromUserSpace;
@ -965,21 +965,21 @@ SVGSVGElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
const_cast<SVGSVGElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr);
if (aWhich == eAllTransforms) {
// the common case
return gfx::ToMatrix(GetViewBoxTransform()) * gfx::Matrix().Translate(x, y) * fromUserSpace;
return GetViewBoxTransform() * gfxMatrix().Translate(gfxPoint(x, y)) * fromUserSpace;
}
NS_ABORT_IF_FALSE(aWhich == eChildToUserSpace, "Unknown TransformTypes");
return gfx::ToMatrix(GetViewBoxTransform()) * gfx::Matrix().Translate(x, y);
return GetViewBoxTransform() * gfxMatrix().Translate(gfxPoint(x, y));
}
if (IsRoot()) {
gfx::Matrix zoomPanTM;
zoomPanTM.Translate(mCurrentTranslate.GetX(), mCurrentTranslate.GetY());
gfxMatrix zoomPanTM;
zoomPanTM.Translate(gfxPoint(mCurrentTranslate.GetX(), mCurrentTranslate.GetY()));
zoomPanTM.Scale(mCurrentScale, mCurrentScale);
return gfx::ToMatrix(GetViewBoxTransform()) * zoomPanTM * fromUserSpace;
return GetViewBoxTransform() * zoomPanTM * fromUserSpace;
}
// outer-<svg>, but inline in some other content:
return gfx::ToMatrix(GetViewBoxTransform()) * fromUserSpace;
return GetViewBoxTransform() * fromUserSpace;
}
/* virtual */ bool

Просмотреть файл

@ -132,7 +132,7 @@ public:
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
// nsSVGElement specializations:
virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE;
virtual bool HasValidDimensions() const MOZ_OVERRIDE;

Просмотреть файл

@ -85,14 +85,14 @@ SVGTransformableElement::IsEventAttributeName(nsIAtom* aName)
//----------------------------------------------------------------------
// nsSVGElement overrides
gfx::Matrix
SVGTransformableElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
gfxMatrix
SVGTransformableElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
gfx::Matrix result(aMatrix);
gfxMatrix result(aMatrix);
if (aWhich == eChildToUserSpace) {
// We don't have anything to prepend.
@ -109,30 +109,30 @@ SVGTransformableElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
// any transformations from the |transform| attribute. So since we're
// PRE-multiplying, we need to apply the animateMotion transform *first*.
if (mAnimateMotionTransform) {
result = *mAnimateMotionTransform * result;
result.PreMultiply(*mAnimateMotionTransform);
}
if (mTransforms) {
result = gfx::ToMatrix(mTransforms->GetAnimValue().GetConsolidationMatrix()) * result;
result.PreMultiply(mTransforms->GetAnimValue().GetConsolidationMatrix());
}
return result;
}
const gfx::Matrix*
const gfxMatrix*
SVGTransformableElement::GetAnimateMotionTransform() const
{
return mAnimateMotionTransform.get();
}
void
SVGTransformableElement::SetAnimateMotionTransform(const gfx::Matrix* aMatrix)
SVGTransformableElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
{
if ((!aMatrix && !mAnimateMotionTransform) ||
(aMatrix && mAnimateMotionTransform && *aMatrix == *mAnimateMotionTransform)) {
return;
}
mAnimateMotionTransform = aMatrix ? new gfx::Matrix(*aMatrix) : nullptr;
mAnimateMotionTransform = aMatrix ? new gfxMatrix(*aMatrix) : nullptr;
DidAnimateTransformList();
nsIFrame* frame = GetPrimaryFrame();
if (frame) {

Просмотреть файл

@ -9,7 +9,7 @@
#include "mozilla/Attributes.h"
#include "nsSVGAnimatedTransformList.h"
#include "nsSVGElement.h"
#include "mozilla/gfx/Matrix.h"
#include "gfxMatrix.h"
namespace mozilla {
namespace dom {
@ -48,10 +48,10 @@ public:
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE;
virtual const gfx::Matrix* GetAnimateMotionTransform() const MOZ_OVERRIDE;
virtual void SetAnimateMotionTransform(const gfx::Matrix* aMatrix) MOZ_OVERRIDE;
virtual const gfxMatrix* GetAnimateMotionTransform() const MOZ_OVERRIDE;
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix) MOZ_OVERRIDE;
virtual nsSVGAnimatedTransformList*
GetAnimatedTransformList(uint32_t aFlags = 0) MOZ_OVERRIDE;
@ -67,7 +67,7 @@ protected:
nsAutoPtr<nsSVGAnimatedTransformList> mTransforms;
// XXX maybe move this to property table, to save space on un-animated elems?
nsAutoPtr<gfx::Matrix> mAnimateMotionTransform;
nsAutoPtr<gfxMatrix> mAnimateMotionTransform;
};
} // namespace dom

Просмотреть файл

@ -421,15 +421,15 @@ SVGUseElement::UnlinkSource()
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ gfx::Matrix
SVGUseElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
/* virtual */ gfxMatrix
SVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
// 'transform' attribute:
gfx::Matrix fromUserSpace =
gfxMatrix fromUserSpace =
SVGUseElementBase::PrependLocalTransformsTo(aMatrix, aWhich);
if (aWhich == eUserSpaceToParent) {
return fromUserSpace;
@ -437,7 +437,7 @@ SVGUseElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
// our 'x' and 'y' attributes:
float x, y;
const_cast<SVGUseElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr);
gfx::Matrix toUserSpace = gfx::Matrix().Translate(x, y);
gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
if (aWhich == eChildToUserSpace) {
return toUserSpace;
}

Просмотреть файл

@ -61,7 +61,7 @@ public:
void DestroyAnonymousContent();
// nsSVGElement specializations:
virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE;
virtual bool HasValidDimensions() const MOZ_OVERRIDE;

Просмотреть файл

@ -1560,8 +1560,8 @@ nsSVGElement::GetCtx() const
return nullptr;
}
/* virtual */ gfx::Matrix
nsSVGElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix,
/* virtual */ gfxMatrix
nsSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
return aMatrix;

Просмотреть файл

@ -57,13 +57,9 @@ class SVGAnimatedPreserveAspectRatio;
class nsSVGAnimatedTransformList;
class SVGStringList;
class DOMSVGStringList;
namespace gfx {
class Matrix;
}
}
struct gfxMatrix;
struct nsSVGEnumMapping;
typedef nsStyledElementNotElementCSSInlineStyle nsSVGElementBase;
@ -166,14 +162,14 @@ public:
* 'x'/'y' attributes, and any transform due to a 'viewBox' attribute, but
* does not include any transforms due to the 'transform' attribute.
*/
virtual mozilla::gfx::Matrix PrependLocalTransformsTo(const mozilla::gfx::Matrix &aMatrix,
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const;
// Setter for to set the current <animateMotion> transformation
// Only visible for nsSVGGraphicElement, so it's a no-op here, and that
// subclass has the useful implementation.
virtual void SetAnimateMotionTransform(const mozilla::gfx::Matrix* aMatrix) {/*no-op*/}
virtual const mozilla::gfx::Matrix* GetAnimateMotionTransform() const { return nullptr; }
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix) {/*no-op*/}
virtual const gfxMatrix* GetAnimateMotionTransform() const { return nullptr; }
bool IsStringAnimatable(uint8_t aAttrEnum) {
return GetStringInfo().mStringInfo[aAttrEnum].mIsAnimatable;

Просмотреть файл

@ -3845,11 +3845,11 @@ SVGTextFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
dom::SVGTextContentElement *content = static_cast<dom::SVGTextContentElement*>(mContent);
gfx::Matrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfx::Matrix() :
gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot)));
gfxMatrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfxMatrix() :
parent->GetCanvasTM(aFor, aTransformRoot));
mCanvasTM = new gfxMatrix(ThebesMatrix(tm));
mCanvasTM = new gfxMatrix(tm);
}
return *mCanvasTM;
}
@ -4731,9 +4731,10 @@ SVGTextFrame::GetTextPath(nsIFrame* aTextPathFrame)
return nullptr;
}
gfx::Matrix matrix = element->PrependLocalTransformsTo(gfx::Matrix());
gfxMatrix matrix = element->PrependLocalTransformsTo(gfxMatrix());
if (!matrix.IsIdentity()) {
RefPtr<PathBuilder> builder = path->TransformedCopyToBuilder(matrix);
RefPtr<PathBuilder> builder =
path->TransformedCopyToBuilder(ToMatrix(matrix));
path = builder->Finish();
}

Просмотреть файл

@ -146,11 +146,11 @@ nsSVGAFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
dom::SVGAElement *content = static_cast<dom::SVGAElement*>(mContent);
gfx::Matrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfx::Matrix() :
gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot)));
gfxMatrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfxMatrix() :
parent->GetCanvasTM(aFor, aTransformRoot));
mCanvasTM = new gfxMatrix(ThebesMatrix(tm));
mCanvasTM = new gfxMatrix(tm);
}
return *mCanvasTM;

Просмотреть файл

@ -14,7 +14,6 @@
#include "nsSVGEffects.h"
#include "nsSVGUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
//----------------------------------------------------------------------
@ -318,11 +317,11 @@ nsSVGClipPathFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
{
SVGClipPathElement *content = static_cast<SVGClipPathElement*>(mContent);
gfx::Matrix tm =
gfxMatrix tm =
content->PrependLocalTransformsTo(mClipParentMatrix ?
gfx::ToMatrix(*mClipParentMatrix) : gfx::Matrix());
*mClipParentMatrix : gfxMatrix());
return nsSVGUtils::AdjustMatrixForUnits(ThebesMatrix(tm),
return nsSVGUtils::AdjustMatrixForUnits(tm,
&content->mEnumAttributes[SVGClipPathElement::CLIPPATHUNITS],
mClipParent);
}

Просмотреть файл

@ -240,8 +240,8 @@ nsSVGDisplayContainerFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
if ((transformList && transformList->HasTransform()) ||
content->GetAnimateMotionTransform()) {
if (aOwnTransform) {
*aOwnTransform = ThebesMatrix(content->PrependLocalTransformsTo(gfx::Matrix(),
nsSVGElement::eUserSpaceToParent));
*aOwnTransform = content->PrependLocalTransformsTo(gfxMatrix(),
nsSVGElement::eUserSpaceToParent);
}
foundTransform = true;
}
@ -401,14 +401,15 @@ nsSVGDisplayContainerFrame::GetBBoxContribution(
while (kid) {
nsISVGChildFrame* svgKid = do_QueryFrame(kid);
if (svgKid) {
gfx::Matrix transform = gfx::ToMatrix(aToBBoxUserspace);
gfxMatrix transform = aToBBoxUserspace;
nsIContent *content = kid->GetContent();
if (content->IsSVG()) {
transform = static_cast<nsSVGElement*>(content)->PrependLocalTransformsTo(transform);
transform = static_cast<nsSVGElement*>(content)->
PrependLocalTransformsTo(aToBBoxUserspace);
}
// We need to include zero width/height vertical/horizontal lines, so we have
// to use UnionEdges.
bboxUnion.UnionEdges(svgKid->GetBBoxContribution(ThebesMatrix(transform), aFlags));
bboxUnion.UnionEdges(svgKid->GetBBoxContribution(transform, aFlags));
}
kid = kid->GetNextSibling();
}

Просмотреть файл

@ -19,9 +19,7 @@
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "nsContentUtils.h"
#include "mozilla/gfx/Matrix.h"
using namespace mozilla;
using namespace mozilla::dom;
nsIFrame*
@ -71,7 +69,7 @@ MapFrameRectToFilterSpace(const nsRect* aRect,
static gfxMatrix
GetUserToFrameSpaceInCSSPxTransform(nsIFrame *aFrame)
{
gfx::Matrix userToFrameSpaceInCSSPx;
gfxMatrix userToFrameSpaceInCSSPx;
if ((aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
int32_t appUnitsPerCSSPx = aFrame->PresContext()->AppUnitsPerCSSPixel();
@ -88,17 +86,16 @@ GetUserToFrameSpaceInCSSPxTransform(nsIFrame *aFrame)
if (aFrame->GetType() == nsGkAtoms::svgInnerSVGFrame) {
userToFrameSpaceInCSSPx =
static_cast<nsSVGElement*>(aFrame->GetContent())->
PrependLocalTransformsTo(gfx::Matrix());
PrependLocalTransformsTo(gfxMatrix());
} else {
gfxPoint targetsUserSpaceOffset =
nsLayoutUtils::RectToGfxRect(aFrame->GetRect(), appUnitsPerCSSPx).
TopLeft();
userToFrameSpaceInCSSPx.Translate(-targetsUserSpaceOffset.x,
-targetsUserSpaceOffset.y);
userToFrameSpaceInCSSPx.Translate(-targetsUserSpaceOffset);
}
}
// else, for all other frames, leave as the identity matrix
return ThebesMatrix(userToFrameSpaceInCSSPx);
return userToFrameSpaceInCSSPx;
}
class MOZ_STACK_CLASS nsSVGFilterFrame::AutoFilterReferencer

Просмотреть файл

@ -184,8 +184,8 @@ nsSVGForeignObjectFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
if ((transformList && transformList->HasTransform()) ||
content->GetAnimateMotionTransform()) {
if (aOwnTransform) {
*aOwnTransform = ThebesMatrix(content->PrependLocalTransformsTo(gfx::Matrix(),
nsSVGElement::eUserSpaceToParent));
*aOwnTransform = content->PrependLocalTransformsTo(gfxMatrix(),
nsSVGElement::eUserSpaceToParent);
}
foundTransform = true;
}
@ -502,11 +502,11 @@ nsSVGForeignObjectFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
SVGForeignObjectElement *content =
static_cast<SVGForeignObjectElement*>(mContent);
gfx::Matrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfx::Matrix() :
gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot)));
gfxMatrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfxMatrix() :
parent->GetCanvasTM(aFor, aTransformRoot));
mCanvasTM = new gfxMatrix(ThebesMatrix(tm));
mCanvasTM = new gfxMatrix(tm);
}
return *mCanvasTM;
}

Просмотреть файл

@ -14,7 +14,6 @@
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
//----------------------------------------------------------------------
@ -79,11 +78,11 @@ nsSVGGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
SVGGraphicsElement *content = static_cast<SVGGraphicsElement*>(mContent);
gfx::Matrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfx::Matrix() :
gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot)));
gfxMatrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfxMatrix() :
parent->GetCanvasTM(aFor, aTransformRoot));
mCanvasTM = new gfxMatrix(ThebesMatrix(tm));
mCanvasTM = new gfxMatrix(tm);
}
return *mCanvasTM;
}

Просмотреть файл

@ -283,11 +283,11 @@ nsSVGInnerSVGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
gfx::Matrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfx::Matrix() :
gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot)));
gfxMatrix tm = content->PrependLocalTransformsTo(
this == aTransformRoot ? gfxMatrix() :
parent->GetCanvasTM(aFor, aTransformRoot));
mCanvasTM = new gfxMatrix(ThebesMatrix(tm));
mCanvasTM = new gfxMatrix(tm);
}
return *mCanvasTM;
}

Просмотреть файл

@ -839,9 +839,9 @@ nsSVGOuterSVGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
1.0f / PresContext()->AppUnitsToFloatCSSPixels(
PresContext()->AppUnitsPerDevPixel());
gfx::Matrix tm = content->PrependLocalTransformsTo(
gfx::Matrix().Scale(devPxPerCSSPx, devPxPerCSSPx));
mCanvasTM = new gfxMatrix(ThebesMatrix(tm));
gfxMatrix tm = content->PrependLocalTransformsTo(
gfxMatrix().Scale(devPxPerCSSPx, devPxPerCSSPx));
mCanvasTM = new gfxMatrix(tm);
}
return *mCanvasTM;
}
@ -943,9 +943,10 @@ nsSVGOuterSVGAnonChildFrame::HasChildrenOnlyTransform(gfxMatrix *aTransform) con
if (hasTransform && aTransform) {
// Outer-<svg> doesn't use x/y, so we can pass eChildToUserSpace here.
*aTransform = ThebesMatrix(
content->PrependLocalTransformsTo(gfx::Matrix(),
nsSVGElement::eChildToUserSpace));
gfxMatrix identity;
*aTransform =
content->PrependLocalTransformsTo(identity,
nsSVGElement::eChildToUserSpace);
}
return hasTransform;

Просмотреть файл

@ -163,8 +163,8 @@ nsSVGPathGeometryFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
if ((transformList && transformList->HasTransform()) ||
content->GetAnimateMotionTransform()) {
if (aOwnTransform) {
*aOwnTransform = ThebesMatrix(content->PrependLocalTransformsTo(gfx::Matrix(),
nsSVGElement::eUserSpaceToParent));
*aOwnTransform = content->PrependLocalTransformsTo(gfxMatrix(),
nsSVGElement::eUserSpaceToParent);
}
foundTransform = true;
}
@ -512,9 +512,9 @@ nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
dom::SVGGraphicsElement *content = static_cast<dom::SVGGraphicsElement*>(mContent);
return ThebesMatrix(content->PrependLocalTransformsTo(
this == aTransformRoot ? gfx::Matrix() :
gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot))));
return content->PrependLocalTransformsTo(
this == aTransformRoot ? gfxMatrix() :
parent->GetCanvasTM(aFor, aTransformRoot));
}
//----------------------------------------------------------------------

Просмотреть файл

@ -13,8 +13,6 @@
class nsRenderingContext;
using namespace mozilla;
typedef nsSVGGFrame nsSVGSwitchFrameBase;
class nsSVGSwitchFrame : public nsSVGSwitchFrameBase
@ -232,12 +230,12 @@ nsSVGSwitchFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
nsISVGChildFrame* svgKid = do_QueryFrame(kid);
if (svgKid) {
nsIContent *content = kid->GetContent();
gfx::Matrix transform = gfx::ToMatrix(aToBBoxUserspace);
gfxMatrix transform = aToBBoxUserspace;
if (content->IsSVG()) {
transform = static_cast<nsSVGElement*>(content)->
PrependLocalTransformsTo(transform);
PrependLocalTransformsTo(aToBBoxUserspace);
}
return svgKid->GetBBoxContribution(ThebesMatrix(transform), aFlags);
return svgKid->GetBBoxContribution(transform, aFlags);
}
}
return SVGBBox();

Просмотреть файл

@ -646,14 +646,14 @@ nsSVGUtils::GetUserToCanvasTM(nsIFrame *aFrame, uint32_t aFor)
nsISVGChildFrame* svgFrame = do_QueryFrame(aFrame);
NS_ASSERTION(svgFrame, "bad frame");
gfx::Matrix tm;
gfxMatrix tm;
if (svgFrame) {
nsSVGElement *content = static_cast<nsSVGElement*>(aFrame->GetContent());
tm = content->PrependLocalTransformsTo(
gfx::ToMatrix(GetCanvasTM(aFrame->GetParent(), aFor)),
GetCanvasTM(aFrame->GetParent(), aFor),
nsSVGElement::eUserSpaceToParent);
}
return ThebesMatrix(tm);
return tm;
}
void
@ -1187,7 +1187,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
!static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
return bbox;
}
gfx::Matrix matrix;
gfxMatrix matrix;
if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
// The spec says getBBox "Returns the tight bounding box in *current user
// space*". So we should really be doing this for all elements, but that
@ -1197,7 +1197,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
matrix = element->PrependLocalTransformsTo(matrix,
nsSVGElement::eChildToUserSpace);
}
return svg->GetBBoxContribution(ThebesMatrix(matrix), aFlags).ToThebesRect();
return svg->GetBBoxContribution(matrix, aFlags).ToThebesRect();
}
return nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(aFrame);
}
@ -1799,13 +1799,14 @@ nsSVGUtils::GetSVGGlyphExtents(Element* aElement,
return false;
}
gfx::Matrix transform = gfx::ToMatrix(aSVGToAppSpace);
gfxMatrix transform(aSVGToAppSpace);
nsIContent* content = frame->GetContent();
if (content->IsSVG()) {
transform = static_cast<nsSVGElement*>(content)->PrependLocalTransformsTo(transform);
transform = static_cast<nsSVGElement*>(content)->
PrependLocalTransformsTo(aSVGToAppSpace);
}
*aResult = svgFrame->GetBBoxContribution(ThebesMatrix(transform),
*aResult = svgFrame->GetBBoxContribution(transform,
nsSVGUtils::eBBoxIncludeFill | nsSVGUtils::eBBoxIncludeFillGeometry |
nsSVGUtils::eBBoxIncludeStroke | nsSVGUtils::eBBoxIncludeStrokeGeometry |
nsSVGUtils::eBBoxIncludeMarkers).ToThebesRect();