Make sure that the offsets in a textframe are up-to-date before creating a bidi continuation. Bug 406675, r=uriber, sr=roc, blocking1.9=schrep
authorsmontagu@smontagu.org
Wed, 12 Dec 2007 23:51:27 -0800
changeset 9001 12cfd2bc217a2bc8d9a1bca3a339dd65aa10bc92
parent 9000 296166f1c2a7d43c6667f02264fb51df98b8545c
child 9002 f627f96a3217577f1bae7808426bc3176fb5466e
push idunknown
push userunknown
push dateunknown
reviewersuriber, roc
bugs406675
milestone1.9b3pre
Make sure that the offsets in a textframe are up-to-date before creating a bidi continuation. Bug 406675, r=uriber, sr=roc, blocking1.9=schrep
layout/base/nsBidiPresUtils.cpp
layout/generic/nsTextFrameThebes.cpp
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -406,27 +406,27 @@ nsBidiPresUtils::Resolve(nsBlockFrame*  
         CalculateCharType(lineOffset, typeLimit, logicalLimit, runLength,
                            runCount, charType, prevType);
         // IBMBIDI - Egypt - Start
         propTable->SetProperty(frame, nsGkAtoms::charType,
                                NS_INT32_TO_PTR(charType), nsnull, nsnull);
         // IBMBIDI - Egypt - End
 
         if ( (runLength > 0) && (runLength < fragmentLength) ) {
+          frame->AdjustOffsetsForBidi(contentOffset, contentOffset + runLength);
           if (!EnsureBidiContinuation(frame, &nextBidi, frameIndex) ) {
             break;
           }
           if (lineNeedsUpdate) {
             if (AdvanceLineIteratorToFrame(frame, aBlockFrame, line,
                                            prevFrame, endLines)) {
               lineNeedsUpdate = PR_FALSE;
             }
           }
           line->MarkDirty();
-          frame->AdjustOffsetsForBidi(contentOffset, contentOffset + runLength);
           frame = nextBidi;
           contentOffset += runLength;
         } // if (runLength < fragmentLength)
         else {
           PRInt32 newIndex = 0;
           mContentToFrameIndex.Get(content, &newIndex);
           if (newIndex > frameIndex) {
             RemoveBidiContinuation(frame, frameIndex, newIndex, temp);
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -3156,16 +3156,18 @@ nsContinuingTextFrame::Init(nsIContent* 
   nsresult rv = nsFrame::Init(aContent, aParent, aPrevInFlow);
 
   nsIFrame* nextContinuation = aPrevInFlow->GetNextContinuation();
   // Hook the frame into the flow
   SetPrevInFlow(aPrevInFlow);
   aPrevInFlow->SetNextInFlow(this);
   nsTextFrame* prev = static_cast<nsTextFrame*>(aPrevInFlow);
   mContentOffset = prev->GetContentOffset() + prev->GetContentLengthHint();
+  NS_ASSERTION(mContentOffset < aContent->GetText()->GetLength(),
+               "Creating ContinuingTextFrame, but there is no more content");
   if (prev->GetStyleContext() != GetStyleContext()) {
     // We're taking part of prev's text, and its style may be different
     // so clear its textrun which may no longer be valid (and don't set ours)
     prev->ClearTextRun();
   } else {
     mTextRun = prev->GetTextRun();
   }
 #ifdef IBMBIDI