Mark lines for which bidi continuations were created or removed dirty, instead of marking everything dirty when continuations removed. bug=330373 r=roc sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@192444 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
uriber%gmail.com
2006-03-15 20:52:02 +00:00
parent cef29f7794
commit 83e152722a
3 changed files with 25 additions and 23 deletions

View File

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

View File

@@ -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);
/**

View File

@@ -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);
}
}
}