Backing out bug 397510 again because again it looks like it might have caused a regression, and we don't need it for M9

This commit is contained in:
roc+@cs.cmu.edu 2007-10-18 21:56:05 -07:00
Родитель 013f12737d
Коммит cce045cd3c
1 изменённых файлов: 5 добавлений и 36 удалений

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

@ -572,7 +572,6 @@ public:
void SetAtStartOfLine() {
mStartOfLine = PR_TRUE;
mCanStopOnThisLine = PR_FALSE;
}
void SetSkipIncompleteTextRuns(PRBool aSkip) {
mSkipIncompleteTextRuns = aSkip;
@ -580,9 +579,6 @@ public:
void SetCommonAncestorWithLastFrame(nsIFrame* aFrame) {
mCommonAncestorWithLastFrame = aFrame;
}
PRBool CanStopOnThisLine() {
return mCanStopOnThisLine;
}
nsIFrame* GetCommonAncestorWithLastFrame() {
return mCommonAncestorWithLastFrame;
}
@ -602,9 +598,6 @@ public:
mMaxTextLength = 0;
mDoubleByteText = PR_FALSE;
}
void ResetLineBreaker() {
mLineBreaker.Reset();
}
void AccumulateRunInfo(nsTextFrame* aFrame);
void BuildTextRunForFrames(void* aTextBuffer);
void AssignTextRun(gfxTextRun* aTextRun);
@ -692,7 +685,6 @@ private:
PRPackedBool mTrimNextRunLeadingWhitespace;
PRPackedBool mCurrentRunTrimLeadingWhitespace;
PRPackedBool mSkipIncompleteTextRuns;
PRPackedBool mCanStopOnThisLine;
};
static nsIFrame*
@ -805,10 +797,6 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
return FB_CONTINUE;
}
// build text runs for the 50 lines following aForFrame, and stop after that
// when we get a chance.
#define NUM_LINES_TO_BUILD_TEXT_RUNS 50
/**
* General routine for building text runs. This is hairy because of the need
* to build text runs that span content nodes.
@ -853,9 +841,9 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
}
// Find the line containing aForFrame
nsBlockFrame::line_iterator startLine;
nsBlockFrame::line_iterator line;
if (aForFrameLine) {
startLine = *aForFrameLine;
line = *aForFrameLine;
} else {
NS_ASSERTION(aForFrame, "One of aForFrame or aForFrameLine must be set!");
nsIFrame* immediateChild =
@ -866,8 +854,8 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
nsLayoutUtils::FindChildContainingDescendant(block,
presContext->FrameManager()->GetPlaceholderFrameFor(immediateChild));
}
startLine = block->FindLineFor(immediateChild);
NS_ASSERTION(startLine != block->end_lines(),
line = block->FindLineFor(immediateChild);
NS_ASSERTION(line != block->end_lines(),
"Frame is not in the block!!!");
}
@ -884,13 +872,12 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
// but we discard them instead of assigning them to frames.
// This is a little awkward because we traverse lines in the reverse direction
// but we traverse the frames in each line in the forward direction.
nsBlockInFlowLineIterator backIterator(block, startLine, PR_FALSE);
nsBlockInFlowLineIterator backIterator(block, line, PR_FALSE);
nsTextFrame* stopAtFrame = aForFrame;
nsTextFrame* nextLineFirstTextFrame = nsnull;
PRBool seenTextRunBoundaryOnLaterLine = PR_FALSE;
PRBool mayBeginInTextRun = PR_TRUE;
PRBool inOverflow = PR_FALSE;
nsBlockFrame::line_iterator line;
while (PR_TRUE) {
line = backIterator.GetLine();
block = backIterator.GetContainer();
@ -939,8 +926,6 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
// text run boundary is required we flush textRunFrames ((re)building their
// gfxTextRuns as necessary).
nsBlockInFlowLineIterator forwardIterator(block, line, inOverflow);
PRBool seenStartLine = PR_FALSE;
PRUint32 linesAfterStartLine = 0;
do {
line = forwardIterator.GetLine();
if (line->IsBlock())
@ -954,21 +939,6 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
scanner.ScanFrame(child);
child = child->GetNextSibling();
}
if (line == startLine) {
seenStartLine = PR_TRUE;
}
if (seenStartLine) {
++linesAfterStartLine;
if (linesAfterStartLine >= NUM_LINES_TO_BUILD_TEXT_RUNS && scanner.CanStopOnThisLine()) {
// Don't flush; we may be in the middle of a textrun that we can't
// end here. That's OK, we just won't build it.
// Note that we must already have finished the textrun for aForFrame,
// because we've seen the end of a textrun in a line after the line
// containing aForFrame.
scanner.ResetLineBreaker();
return;
}
}
} while (forwardIterator.Next());
// Set mStartOfLine so FlushFrames knows its textrun ends a line
@ -1047,7 +1017,6 @@ void BuildTextRunsScanner::FlushFrames(PRBool aFlushLineBreaks)
mBreakSinks.Clear();
}
mCanStopOnThisLine = PR_TRUE;
ResetRunInfo();
}