From 04aabc2fcd45564db81effb2643d33ecbddbc0fc Mon Sep 17 00:00:00 2001 From: "reed%reedloden.com" Date: Thu, 8 Nov 2007 03:52:33 +0000 Subject: [PATCH] Bug 400826 - We shouldn't build the styles array for transformed textruns assuming every frame in a flow has the same style; instead we should build it frame by frame. [p=roc r=smontagu a=blocking1.9+] git-svn-id: svn://10.0.0.236/trunk@238946 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsTextFrameThebes.cpp | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mozilla/layout/generic/nsTextFrameThebes.cpp b/mozilla/layout/generic/nsTextFrameThebes.cpp index d1cfd87a478..6643cd06790 100644 --- a/mozilla/layout/generic/nsTextFrameThebes.cpp +++ b/mozilla/layout/generic/nsTextFrameThebes.cpp @@ -1510,16 +1510,21 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) iter.SetOriginalOffset(0); for (i = 0; i < mMappedFlows.Length(); ++i) { MappedFlow* mappedFlow = &mMappedFlows[i]; - PRUint32 offset = iter.GetSkippedOffset(); - iter.AdvanceOriginal(mappedFlow->GetContentEnd() - - mappedFlow->mStartFrame->GetContentOffset()); - PRUint32 end = iter.GetSkippedOffset(); - nsStyleContext* sc = mappedFlow->mStartFrame->GetStyleContext(); - PRUint32 j; - for (j = offset; j < end; ++j) { - styles.AppendElement(sc); + nsTextFrame* f; + for (f = mappedFlow->mStartFrame; f != mappedFlow->mEndFrame; + f = static_cast(f->GetNextInFlow())) { + PRUint32 offset = iter.GetSkippedOffset(); + iter.AdvanceOriginal(f->GetContentLength()); + PRUint32 end = iter.GetSkippedOffset(); + nsStyleContext* sc = f->GetStyleContext(); + PRUint32 j; + for (j = offset; j < end; ++j) { + styles.AppendElement(sc); + } } } + NS_ASSERTION(iter.GetSkippedOffset() == transformedLength, + "We didn't cover all the characters in the text run!"); } gfxTextRun* textRun;