Bug 398101 - Be more diligent about invalidating textruns for lines [p=roc r+sr=dbaron a=blocking1.9+]

This commit is contained in:
reed@reedloden.com 2007-11-08 22:55:32 -08:00
Родитель 12ddd61add
Коммит 8c4eb4e25f
2 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -1432,6 +1432,7 @@ nsBlockFrame::MarkLineDirty(line_iterator aLine)
{ {
// Mark aLine dirty // Mark aLine dirty
aLine->MarkDirty(); aLine->MarkDirty();
aLine->SetInvalidateTextRuns(PR_TRUE);
#ifdef DEBUG #ifdef DEBUG
if (gNoisyReflow) { if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent); IndentBy(stdout, gNoiseIndent);
@ -1447,6 +1448,7 @@ nsBlockFrame::MarkLineDirty(line_iterator aLine)
aLine->IsInline() && aLine->IsInline() &&
aLine.prev()->IsInline()) { aLine.prev()->IsInline()) {
aLine.prev()->MarkDirty(); aLine.prev()->MarkDirty();
aLine.prev()->SetInvalidateTextRuns(PR_TRUE);
#ifdef DEBUG #ifdef DEBUG
if (gNoisyReflow) { if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent); IndentBy(stdout, gNoiseIndent);
@ -4857,13 +4859,13 @@ nsBlockFrame::AddFrames(nsIFrame* aFrameList,
} }
mLines.after_insert(prevSibLine, line); mLines.after_insert(prevSibLine, line);
prevSibLine->SetChildCount(prevSibLine->GetChildCount() - rem); prevSibLine->SetChildCount(prevSibLine->GetChildCount() - rem);
prevSibLine->MarkDirty(); // Mark prevSibLine dirty and as needing textrun invalidation, since
} // we may be breaking up text in the line. Its previous line may also
// Force the lines next to where we're inserting content to regenerate // need to be invalidated because it may be able to pull some text up.
// their textruns MarkLineDirty(prevSibLine);
prevSibLine->SetInvalidateTextRuns(PR_TRUE); // The new line will also need its textruns recomputed because of the
if (prevSibLine.next() != end_lines()) { // frame changes.
prevSibLine.next()->SetInvalidateTextRuns(PR_TRUE); line->SetInvalidateTextRuns(PR_TRUE);
} }
// Now (partially) join the sibling lists together // Now (partially) join the sibling lists together
@ -4911,7 +4913,10 @@ nsBlockFrame::AddFrames(nsIFrame* aFrameList,
} }
else { else {
prevSibLine->SetChildCount(prevSibLine->GetChildCount() + 1); prevSibLine->SetChildCount(prevSibLine->GetChildCount() + 1);
prevSibLine->MarkDirty(); // We're adding inline content to prevSibLine, so we need to mark it
// dirty, ensure its textruns are recomputed, and possibly do the same
// to its previous line since that line may be able to pull content up.
MarkLineDirty(prevSibLine);
} }
aPrevSibling = newFrame; aPrevSibling = newFrame;
@ -6208,9 +6213,6 @@ nsBlockFrame::ChildIsDirty(nsIFrame* aChild)
// child is being dirtied. // child is being dirtied.
line_iterator fline = FindLineFor(aChild); line_iterator fline = FindLineFor(aChild);
if (fline != end_lines()) { if (fline != end_lines()) {
// An inline descendant might have been added or removed, so we should
// reconstruct textruns.
fline->SetInvalidateTextRuns(PR_TRUE);
MarkLineDirty(fline); MarkLineDirty(fline);
} }
} }

Просмотреть файл

@ -460,7 +460,9 @@ protected:
/** /**
* Mark |aLine| dirty, and, if necessary because of possible * Mark |aLine| dirty, and, if necessary because of possible
* pull-up, mark the previous line dirty as well. * pull-up, mark the previous line dirty as well. Also invalidates textruns
* on those lines because the text in the lines might have changed due to
* addition/removal of frames.
*/ */
nsresult MarkLineDirty(line_iterator aLine); nsresult MarkLineDirty(line_iterator aLine);