diff --git a/mozilla/layout/base/nsBidiPresUtils.cpp b/mozilla/layout/base/nsBidiPresUtils.cpp index 575d1a55c1a..b5e5b5115d4 100644 --- a/mozilla/layout/base/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/nsBidiPresUtils.cpp @@ -216,12 +216,10 @@ CreateBidiContinuation(nsPresContext* aPresContext, */ nsresult nsBidiPresUtils::Resolve(nsPresContext* aPresContext, - nsIFrame* aBlockFrame, + nsBlockFrame* aBlockFrame, nsIFrame* aFirstChild, - PRBool& aForceReflow, PRBool aIsVisualFormControl) { - aForceReflow = PR_FALSE; mLogicalFrames.Clear(); mContentToFrameIndex.Clear(); @@ -309,6 +307,9 @@ nsBidiPresUtils::Resolve(nsPresContext* aPresContext, nsPropertyTable *propTable = aPresContext->PropertyTable(); + nsBlockFrame::line_iterator line = aBlockFrame->begin_lines(); + nsBlockFrame::line_iterator endLines = aBlockFrame->end_lines(); + for (; ;) { if (fragmentLength <= 0) { if (++frameIndex >= frameCount) { @@ -318,6 +319,20 @@ nsBidiPresUtils::Resolve(nsPresContext* aPresContext, frame = (nsIFrame*) (mLogicalFrames[frameIndex]); frameType = frame->GetType(); + if (nsLayoutAtoms::directionalFrame != frameType) { + // Advance the line iterator to the line containing frame + nsIFrame* child = frame; + nsIFrame* parent = child->GetParent(); + while (parent && parent != aBlockFrame) { + child = parent; + parent = child->GetParent(); + } + NS_ASSERTION (parent, "frame is not a descendent of aBlockFrame"); + while (line != endLines && !line->Contains(child)) { + ++line; + } + NS_ASSERTION (line != endLines, "frame not found on any line"); + } if (nsLayoutAtoms::textFrame == frameType) { content = frame->GetContent(); if (!content) { @@ -380,6 +395,7 @@ nsBidiPresUtils::Resolve(nsPresContext* aPresContext, &nextBidi, frameIndex) ) { break; } + line->MarkDirty(); frame->AdjustOffsetsForBidi(contentOffset, contentOffset + runLength); frame = nextBidi; contentOffset += runLength; @@ -391,7 +407,7 @@ nsBidiPresUtils::Resolve(nsPresContext* aPresContext, if (newIndex > frameIndex) { RemoveBidiContinuation(aPresContext, frame, frameIndex, newIndex, temp); - aForceReflow = PR_TRUE; + line->MarkDirty(); runLength -= temp; fragmentLength -= temp; lineOffset += temp; diff --git a/mozilla/layout/base/nsBidiPresUtils.h b/mozilla/layout/base/nsBidiPresUtils.h index 3ea8a854420..6a34f8044b2 100644 --- a/mozilla/layout/base/nsBidiPresUtils.h +++ b/mozilla/layout/base/nsBidiPresUtils.h @@ -48,6 +48,7 @@ #include "nsBidiUtils.h" #include "nsCOMPtr.h" #include "nsDataHashtable.h" +#include "nsBlockFrame.h" /** * A structure representing a logical position which should be resolved @@ -79,8 +80,6 @@ public: * @param aPresContext The presContext * @param aBlockFrame The block frame * @param aFirstChild The first child frame of aBlockFrame - * @param aForceReflow [OUT] Set if we delete frames and will need to - * reflow the block frame * @param aIsVisualFormControl [IN] Set if we are in a form control on a * visual page. * @see nsHTMLReflowState::IsBidiFormControl @@ -88,9 +87,8 @@ public: * @lina 06/18/2000 */ nsresult Resolve(nsPresContext* aPresContext, - nsIFrame* aBlockFrame, + nsBlockFrame* aBlockFrame, nsIFrame* aFirstChild, - PRBool& aForceReflow, PRBool aIsVisualFormControl); /** diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 8f903107aef..7cf44e0fed8 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -782,21 +782,9 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, if (aPresContext->BidiEnabled()) { nsBidiPresUtils* bidiUtils = aPresContext->GetBidiUtils(); if (bidiUtils) { - PRBool forceReflow; - nsresult rc = bidiUtils->Resolve(aPresContext, this, - mLines.front()->mFirstChild, - forceReflow, - aReflowState.mFlags.mVisualBidiFormControl); - if (NS_SUCCEEDED(rc) && forceReflow) { - // Mark everything dirty - // XXXldb This should be done right. - for (line_iterator line = begin_lines(), line_end = end_lines(); - line != line_end; - ++line) - { - line->MarkDirty(); - } - } + bidiUtils->Resolve(aPresContext, this, + mLines.front()->mFirstChild, + aReflowState.mFlags.mVisualBidiFormControl); } } }