From c9d6c50b04f171822f4e52520901ee3fdd653d3e Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Wed, 30 Jul 2008 20:28:12 +0100 Subject: [PATCH] Bug 445685 - Improve performance with large numbers of text fragments. r=jwatt,sr=roc --- layout/svg/base/src/nsSVGGlyphFrame.cpp | 9 +++++---- layout/svg/base/src/nsSVGTextFrame.cpp | 10 ++++++++++ layout/svg/base/src/nsSVGTextFrame.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index ed5b3533729..56bed7e8e1b 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -229,8 +229,11 @@ NS_IMETHODIMP nsSVGGlyphFrame::DidSetStyleContext() { nsSVGGlyphFrameBase::DidSetStyleContext(); - ClearTextRun(); - NotifyGlyphMetricsChange(); + + if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) { + ClearTextRun(); + NotifyGlyphMetricsChange(); + } return NS_OK; } @@ -459,8 +462,6 @@ nsSVGGlyphFrame::InitialUpdate() NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW), "We don't actually participate in reflow"); - NotifyGlyphMetricsChange(); - // Do unset the various reflow bits, though. mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN); diff --git a/layout/svg/base/src/nsSVGTextFrame.cpp b/layout/svg/base/src/nsSVGTextFrame.cpp index 31d3c2e2bf1..e0220437c4e 100644 --- a/layout/svg/base/src/nsSVGTextFrame.cpp +++ b/layout/svg/base/src/nsSVGTextFrame.cpp @@ -266,6 +266,16 @@ nsSVGTextFrame::UpdateCoveredRegion() return nsSVGTextFrameBase::UpdateCoveredRegion(); } +NS_IMETHODIMP +nsSVGTextFrame::InitialUpdate() +{ + nsresult rv = nsSVGTextFrameBase::InitialUpdate(); + + UpdateGlyphPositioning(PR_FALSE); + + return rv; +} + NS_IMETHODIMP nsSVGTextFrame::GetBBox(nsIDOMSVGRect **_retval) { diff --git a/layout/svg/base/src/nsSVGTextFrame.h b/layout/svg/base/src/nsSVGTextFrame.h index f51834364d9..75f2de75fd4 100644 --- a/layout/svg/base/src/nsSVGTextFrame.h +++ b/layout/svg/base/src/nsSVGTextFrame.h @@ -87,6 +87,7 @@ public: NS_IMETHOD PaintSVG(nsSVGRenderState* aContext, nsRect *aDirtyRect); NS_IMETHOD GetFrameForPointSVG(float x, float y, nsIFrame** hit); NS_IMETHOD UpdateCoveredRegion(); + NS_IMETHOD InitialUpdate(); NS_IMETHOD GetBBox(nsIDOMSVGRect **_retval); // nsSVGContainerFrame methods: