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
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
--- 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