зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1396776 - Move mCanvasTM from the sub classes of nsSVGDisplayContainerFrame to nsSVGDisplayContainerFrame. r=longsonr+218550
All classes which have mCanvasTM declared as a member object are inherited from nsSVGDisplayContainerFrame. We should just declare a protected member in the base class and then remove mCanvasTM and duplicated implementaion of GetCanvasTM & NotifySVGChanged in those derived classes. MozReview-Commit-ID: 8f8EgFNEXHJ --HG-- extra : rebase_source : 593e16d7b701061ca37b8ca8a6fe1de2292ea62d
This commit is contained in:
Родитель
bcfdcffe4f
Коммит
c4131f69bd
|
@ -3913,27 +3913,6 @@ SVGTextFrame::GetBBoxContribution(const gfx::Matrix &aToBBoxUserspace,
|
||||||
return bbox;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// nsSVGContainerFrame methods
|
|
||||||
|
|
||||||
gfxMatrix
|
|
||||||
SVGTextFrame::GetCanvasTM()
|
|
||||||
{
|
|
||||||
if (!mCanvasTM) {
|
|
||||||
NS_ASSERTION(GetParent(), "null parent");
|
|
||||||
NS_ASSERTION(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
|
|
||||||
"should not call GetCanvasTM() when we are non-display");
|
|
||||||
|
|
||||||
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
|
|
||||||
dom::SVGTextContentElement *content = static_cast<dom::SVGTextContentElement*>(GetContent());
|
|
||||||
|
|
||||||
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
|
||||||
|
|
||||||
mCanvasTM = new gfxMatrix(tm);
|
|
||||||
}
|
|
||||||
return *mCanvasTM;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// SVGTextFrame SVG DOM methods
|
// SVGTextFrame SVG DOM methods
|
||||||
|
|
||||||
|
|
|
@ -257,9 +257,6 @@ public:
|
||||||
virtual SVGBBox GetBBoxContribution(const Matrix& aToBBoxUserspace,
|
virtual SVGBBox GetBBoxContribution(const Matrix& aToBBoxUserspace,
|
||||||
uint32_t aFlags) override;
|
uint32_t aFlags) override;
|
||||||
|
|
||||||
// nsSVGContainerFrame methods:
|
|
||||||
virtual gfxMatrix GetCanvasTM() override;
|
|
||||||
|
|
||||||
// SVG DOM text methods:
|
// SVG DOM text methods:
|
||||||
uint32_t GetNumberOfChars(nsIContent* aContent);
|
uint32_t GetNumberOfChars(nsIContent* aContent);
|
||||||
float GetComputedTextLength(nsIContent* aContent);
|
float GetComputedTextLength(nsIContent* aContent);
|
||||||
|
@ -533,11 +530,6 @@ private:
|
||||||
*/
|
*/
|
||||||
RefPtr<MutationObserver> mMutationObserver;
|
RefPtr<MutationObserver> mMutationObserver;
|
||||||
|
|
||||||
/**
|
|
||||||
* Cached canvasTM value.
|
|
||||||
*/
|
|
||||||
nsAutoPtr<gfxMatrix> mCanvasTM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of characters in the DOM after the final nsTextFrame. For
|
* The number of characters in the DOM after the final nsTextFrame. For
|
||||||
* example, with
|
* example, with
|
||||||
|
|
|
@ -44,14 +44,6 @@ public:
|
||||||
return MakeFrameName(NS_LITERAL_STRING("SVGA"), aResult);
|
return MakeFrameName(NS_LITERAL_STRING("SVGA"), aResult);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// nsSVGDisplayableFrame interface:
|
|
||||||
virtual void NotifySVGChanged(uint32_t aFlags) override;
|
|
||||||
|
|
||||||
// nsSVGContainerFrame methods:
|
|
||||||
virtual gfxMatrix GetCanvasTM() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsAutoPtr<gfxMatrix> mCanvasTM;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -111,41 +103,4 @@ nsSVGAFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// nsSVGDisplayableFrame methods
|
|
||||||
|
|
||||||
void
|
|
||||||
nsSVGAFrame::NotifySVGChanged(uint32_t aFlags)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
|
||||||
"Invalidation logic may need adjusting");
|
|
||||||
|
|
||||||
if (aFlags & TRANSFORM_CHANGED) {
|
|
||||||
// make sure our cached transform matrix gets (lazily) updated
|
|
||||||
mCanvasTM = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// nsSVGContainerFrame methods:
|
|
||||||
|
|
||||||
gfxMatrix
|
|
||||||
nsSVGAFrame::GetCanvasTM()
|
|
||||||
{
|
|
||||||
if (!mCanvasTM) {
|
|
||||||
NS_ASSERTION(GetParent(), "null parent");
|
|
||||||
|
|
||||||
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
|
|
||||||
dom::SVGAElement *content = static_cast<dom::SVGAElement*>(GetContent());
|
|
||||||
|
|
||||||
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
|
||||||
|
|
||||||
mCanvasTM = new gfxMatrix(tm);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *mCanvasTM;
|
|
||||||
}
|
|
|
@ -401,6 +401,11 @@ nsSVGDisplayContainerFrame::NotifySVGChanged(uint32_t aFlags)
|
||||||
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
||||||
"Invalidation logic may need adjusting");
|
"Invalidation logic may need adjusting");
|
||||||
|
|
||||||
|
if (aFlags & TRANSFORM_CHANGED) {
|
||||||
|
// make sure our cached transform matrix gets (lazily) updated
|
||||||
|
mCanvasTM = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
|
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,3 +438,20 @@ nsSVGDisplayContainerFrame::GetBBoxContribution(
|
||||||
|
|
||||||
return bboxUnion;
|
return bboxUnion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gfxMatrix
|
||||||
|
nsSVGDisplayContainerFrame::GetCanvasTM()
|
||||||
|
{
|
||||||
|
if (!mCanvasTM) {
|
||||||
|
NS_ASSERTION(GetParent(), "null parent");
|
||||||
|
|
||||||
|
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
|
||||||
|
nsSVGElement *content = static_cast<nsSVGElement*>(GetContent());
|
||||||
|
|
||||||
|
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
||||||
|
|
||||||
|
mCanvasTM = new gfxMatrix(tm);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *mCanvasTM;
|
||||||
|
}
|
||||||
|
|
|
@ -147,6 +147,13 @@ public:
|
||||||
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
uint32_t aFlags) override;
|
uint32_t aFlags) override;
|
||||||
virtual bool IsDisplayContainer() override { return true; }
|
virtual bool IsDisplayContainer() override { return true; }
|
||||||
|
virtual gfxMatrix GetCanvasTM() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Cached canvasTM value.
|
||||||
|
*/
|
||||||
|
nsAutoPtr<gfxMatrix> mCanvasTM;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,36 +44,6 @@ nsSVGGFrame::Init(nsIContent* aContent,
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGDisplayableFrame methods
|
// nsSVGDisplayableFrame methods
|
||||||
|
|
||||||
void
|
|
||||||
nsSVGGFrame::NotifySVGChanged(uint32_t aFlags)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
|
||||||
"Invalidation logic may need adjusting");
|
|
||||||
|
|
||||||
if (aFlags & TRANSFORM_CHANGED) {
|
|
||||||
// make sure our cached transform matrix gets (lazily) updated
|
|
||||||
mCanvasTM = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
gfxMatrix
|
|
||||||
nsSVGGFrame::GetCanvasTM()
|
|
||||||
{
|
|
||||||
if (!mCanvasTM) {
|
|
||||||
NS_ASSERTION(GetParent(), "null parent");
|
|
||||||
|
|
||||||
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
|
|
||||||
SVGGraphicsElement *content = static_cast<SVGGraphicsElement*>(GetContent());
|
|
||||||
|
|
||||||
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
|
||||||
|
|
||||||
mCanvasTM = new gfxMatrix(tm);
|
|
||||||
}
|
|
||||||
return *mCanvasTM;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGGFrame::AttributeChanged(int32_t aNameSpaceID,
|
nsSVGGFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
|
|
|
@ -43,14 +43,6 @@ public:
|
||||||
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
int32_t aModType) override;
|
int32_t aModType) override;
|
||||||
|
|
||||||
// nsSVGDisplayableFrame interface:
|
|
||||||
virtual void NotifySVGChanged(uint32_t aFlags) override;
|
|
||||||
|
|
||||||
// nsSVGContainerFrame methods:
|
|
||||||
virtual gfxMatrix GetCanvasTM() override;
|
|
||||||
|
|
||||||
nsAutoPtr<gfxMatrix> mCanvasTM;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -187,8 +187,6 @@ protected:
|
||||||
// subtree if we were to use a list (see bug 381285 comment 20).
|
// subtree if we were to use a list (see bug 381285 comment 20).
|
||||||
nsAutoPtr<nsTHashtable<nsPtrHashKey<nsSVGForeignObjectFrame> > > mForeignObjectHash;
|
nsAutoPtr<nsTHashtable<nsPtrHashKey<nsSVGForeignObjectFrame> > > mForeignObjectHash;
|
||||||
|
|
||||||
nsAutoPtr<gfxMatrix> mCanvasTM;
|
|
||||||
|
|
||||||
nsRegion mInvalidRegion;
|
nsRegion mInvalidRegion;
|
||||||
|
|
||||||
float mFullZoom;
|
float mFullZoom;
|
||||||
|
|
|
@ -125,11 +125,6 @@ nsSVGViewportFrame::NotifySVGChanged(uint32_t aFlags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFlags & TRANSFORM_CHANGED) {
|
|
||||||
// make sure our cached transform matrix gets (lazily) updated
|
|
||||||
mCanvasTM = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags);
|
nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,22 +272,6 @@ nsSVGViewportFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGContainerFrame methods:
|
// nsSVGContainerFrame methods:
|
||||||
|
|
||||||
gfxMatrix
|
|
||||||
nsSVGViewportFrame::GetCanvasTM()
|
|
||||||
{
|
|
||||||
if (!mCanvasTM) {
|
|
||||||
NS_ASSERTION(GetParent(), "null parent");
|
|
||||||
|
|
||||||
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
|
|
||||||
SVGViewportElement *content = static_cast<SVGViewportElement*>(GetContent());
|
|
||||||
|
|
||||||
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
|
||||||
|
|
||||||
mCanvasTM = new gfxMatrix(tm);
|
|
||||||
}
|
|
||||||
return *mCanvasTM;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGViewportFrame::HasChildrenOnlyTransform(gfx::Matrix *aTransform) const
|
nsSVGViewportFrame::HasChildrenOnlyTransform(gfx::Matrix *aTransform) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,16 +43,10 @@ public:
|
||||||
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
|
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
|
||||||
|
|
||||||
// nsSVGContainerFrame methods:
|
// nsSVGContainerFrame methods:
|
||||||
virtual gfxMatrix GetCanvasTM() override;
|
|
||||||
|
|
||||||
virtual bool HasChildrenOnlyTransform(Matrix *aTransform) const override;
|
virtual bool HasChildrenOnlyTransform(Matrix *aTransform) const override;
|
||||||
|
|
||||||
// nsISVGSVGFrame interface:
|
// nsISVGSVGFrame interface:
|
||||||
virtual void NotifyViewportOrTransformChanged(uint32_t aFlags) override;
|
virtual void NotifyViewportOrTransformChanged(uint32_t aFlags) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
nsAutoPtr<gfxMatrix> mCanvasTM;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __NS_SVGVIEWPORTFRAME_H__
|
#endif // __NS_SVGVIEWPORTFRAME_H__
|
||||||
|
|
Загрузка…
Ссылка в новой задаче