Bug 890756 - Remove nsSVGTextFrame2::AutoCanvasTMForMarker. r=longsonr

This commit is contained in:
Cameron McCormack 2013-07-08 17:39:50 +10:00
parent 4c2ae44923
commit 4308bf4c66
2 changed files with 2 additions and 44 deletions

View File

@ -3408,8 +3408,6 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext,
gfxContext *gfx = aContext->ThebesContext(); gfxContext *gfx = aContext->ThebesContext();
gfxMatrix initialMatrix = gfx->CurrentMatrix(); gfxMatrix initialMatrix = gfx->CurrentMatrix();
AutoCanvasTMForMarker autoCanvasTMFor(this, FOR_PAINTING);
if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) {
// If we are in a canvas DrawWindow call that used the // If we are in a canvas DrawWindow call that used the
// DRAWWINDOW_DO_NOT_FLUSH flag, then we may still have out // DRAWWINDOW_DO_NOT_FLUSH flag, then we may still have out
@ -3531,8 +3529,6 @@ nsSVGTextFrame2::GetFrameForPoint(const nsPoint& aPoint)
{ {
NS_ASSERTION(GetFirstPrincipalChild(), "must have a child frame"); NS_ASSERTION(GetFirstPrincipalChild(), "must have a child frame");
AutoCanvasTMForMarker autoCanvasTMFor(this, FOR_HIT_TESTING);
if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) {
// Text frames inside <clipPath> will never have had ReflowSVG called on // Text frames inside <clipPath> will never have had ReflowSVG called on
// them, so call UpdateGlyphPositioning to do this now. (Text frames // them, so call UpdateGlyphPositioning to do this now. (Text frames
@ -5073,7 +5069,7 @@ nsSVGTextFrame2::UpdateFontSizeScaleFactor()
// frame happens to reflow first. // frame happens to reflow first.
double contextScale = 1.0; double contextScale = 1.0;
if (!(mState & NS_STATE_SVG_NONDISPLAY_CHILD)) { if (!(mState & NS_STATE_SVG_NONDISPLAY_CHILD)) {
gfxMatrix m(GetCanvasTM(mGetCanvasTMForFlag)); gfxMatrix m(GetCanvasTM(FOR_OUTERSVG_TM));
if (!m.IsSingular()) { if (!m.IsSingular()) {
contextScale = GetContextScale(m); contextScale = GetContextScale(m);
} }

View File

@ -182,7 +182,6 @@ class nsSVGTextFrame2 : public nsSVGTextFrame2Base
friend class mozilla::TextNodeCorrespondenceRecorder; friend class mozilla::TextNodeCorrespondenceRecorder;
friend struct mozilla::TextRenderedRun; friend struct mozilla::TextRenderedRun;
friend class mozilla::TextRenderedRunIterator; friend class mozilla::TextRenderedRunIterator;
friend class AutoCanvasTMForMarker;
friend class MutationObserver; friend class MutationObserver;
friend class nsDisplaySVGText; friend class nsDisplaySVGText;
@ -191,8 +190,7 @@ protected:
: nsSVGTextFrame2Base(aContext), : nsSVGTextFrame2Base(aContext),
mFontSizeScaleFactor(1.0f), mFontSizeScaleFactor(1.0f),
mLastContextScale(1.0f), mLastContextScale(1.0f),
mLengthAdjustScaleFactor(1.0f), mLengthAdjustScaleFactor(1.0f)
mGetCanvasTMForFlag(FOR_OUTERSVG_TM)
{ {
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY); AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
} }
@ -353,28 +351,6 @@ public:
nsIFrame* aChildFrame); nsIFrame* aChildFrame);
private: private:
/**
* This class exists purely because it would be too messy to pass the "for"
* flag for GetCanvasTM through the call chains to the GetCanvasTM() call in
* UpdateFontSizeScaleFactor.
*/
class AutoCanvasTMForMarker {
public:
AutoCanvasTMForMarker(nsSVGTextFrame2* aFrame, uint32_t aFor)
: mFrame(aFrame)
{
mOldFor = mFrame->mGetCanvasTMForFlag;
mFrame->mGetCanvasTMForFlag = aFor;
}
~AutoCanvasTMForMarker()
{
mFrame->mGetCanvasTMForFlag = mOldFor;
}
private:
nsSVGTextFrame2* mFrame;
uint32_t mOldFor;
};
/** /**
* Mutation observer used to watch for text positioning attribute changes * Mutation observer used to watch for text positioning attribute changes
* on descendent text content elements (like <tspan>s). * on descendent text content elements (like <tspan>s).
@ -656,20 +632,6 @@ private:
* lengthAdjust="spacingAndGlyphs". * lengthAdjust="spacingAndGlyphs".
*/ */
float mLengthAdjustScaleFactor; float mLengthAdjustScaleFactor;
/**
* The flag to pass to GetCanvasTM from UpdateFontSizeScaleFactor. This is
* normally FOR_OUTERSVG_TM, but while painting or hit testing a pattern or
* marker, we set it to FOR_PAINTING or FOR_HIT_TESTING appropriately.
*
* This flag is also used to determine whether in UpdateFontSizeScaleFactor
* GetCanvasTM should be called at all. When the nsSVGTextFrame2 is a
* non-display child, and we are not painting or hit testing, there is
* no sensible CTM stack to use. Additionally, when inside a <marker>,
* calling GetCanvasTM on the nsSVGMarkerFrame would crash due to not
* having a current mMarkedFrame.
*/
uint32_t mGetCanvasTMForFlag;
}; };
#endif #endif