зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
013f12737d
Коммит
cce045cd3c
|
@ -572,7 +572,6 @@ public:
|
||||||
|
|
||||||
void SetAtStartOfLine() {
|
void SetAtStartOfLine() {
|
||||||
mStartOfLine = PR_TRUE;
|
mStartOfLine = PR_TRUE;
|
||||||
mCanStopOnThisLine = PR_FALSE;
|
|
||||||
}
|
}
|
||||||
void SetSkipIncompleteTextRuns(PRBool aSkip) {
|
void SetSkipIncompleteTextRuns(PRBool aSkip) {
|
||||||
mSkipIncompleteTextRuns = aSkip;
|
mSkipIncompleteTextRuns = aSkip;
|
||||||
|
@ -580,9 +579,6 @@ public:
|
||||||
void SetCommonAncestorWithLastFrame(nsIFrame* aFrame) {
|
void SetCommonAncestorWithLastFrame(nsIFrame* aFrame) {
|
||||||
mCommonAncestorWithLastFrame = aFrame;
|
mCommonAncestorWithLastFrame = aFrame;
|
||||||
}
|
}
|
||||||
PRBool CanStopOnThisLine() {
|
|
||||||
return mCanStopOnThisLine;
|
|
||||||
}
|
|
||||||
nsIFrame* GetCommonAncestorWithLastFrame() {
|
nsIFrame* GetCommonAncestorWithLastFrame() {
|
||||||
return mCommonAncestorWithLastFrame;
|
return mCommonAncestorWithLastFrame;
|
||||||
}
|
}
|
||||||
|
@ -602,9 +598,6 @@ public:
|
||||||
mMaxTextLength = 0;
|
mMaxTextLength = 0;
|
||||||
mDoubleByteText = PR_FALSE;
|
mDoubleByteText = PR_FALSE;
|
||||||
}
|
}
|
||||||
void ResetLineBreaker() {
|
|
||||||
mLineBreaker.Reset();
|
|
||||||
}
|
|
||||||
void AccumulateRunInfo(nsTextFrame* aFrame);
|
void AccumulateRunInfo(nsTextFrame* aFrame);
|
||||||
void BuildTextRunForFrames(void* aTextBuffer);
|
void BuildTextRunForFrames(void* aTextBuffer);
|
||||||
void AssignTextRun(gfxTextRun* aTextRun);
|
void AssignTextRun(gfxTextRun* aTextRun);
|
||||||
|
@ -692,7 +685,6 @@ private:
|
||||||
PRPackedBool mTrimNextRunLeadingWhitespace;
|
PRPackedBool mTrimNextRunLeadingWhitespace;
|
||||||
PRPackedBool mCurrentRunTrimLeadingWhitespace;
|
PRPackedBool mCurrentRunTrimLeadingWhitespace;
|
||||||
PRPackedBool mSkipIncompleteTextRuns;
|
PRPackedBool mSkipIncompleteTextRuns;
|
||||||
PRPackedBool mCanStopOnThisLine;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static nsIFrame*
|
static nsIFrame*
|
||||||
|
@ -805,10 +797,6 @@ BuildTextRunsScanner::FindBoundaries(nsIFrame* aFrame, FindBoundaryState* aState
|
||||||
return FB_CONTINUE;
|
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
|
* General routine for building text runs. This is hairy because of the need
|
||||||
* to build text runs that span content nodes.
|
* to build text runs that span content nodes.
|
||||||
|
@ -853,9 +841,9 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the line containing aForFrame
|
// Find the line containing aForFrame
|
||||||
nsBlockFrame::line_iterator startLine;
|
nsBlockFrame::line_iterator line;
|
||||||
if (aForFrameLine) {
|
if (aForFrameLine) {
|
||||||
startLine = *aForFrameLine;
|
line = *aForFrameLine;
|
||||||
} else {
|
} else {
|
||||||
NS_ASSERTION(aForFrame, "One of aForFrame or aForFrameLine must be set!");
|
NS_ASSERTION(aForFrame, "One of aForFrame or aForFrameLine must be set!");
|
||||||
nsIFrame* immediateChild =
|
nsIFrame* immediateChild =
|
||||||
|
@ -866,8 +854,8 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
|
||||||
nsLayoutUtils::FindChildContainingDescendant(block,
|
nsLayoutUtils::FindChildContainingDescendant(block,
|
||||||
presContext->FrameManager()->GetPlaceholderFrameFor(immediateChild));
|
presContext->FrameManager()->GetPlaceholderFrameFor(immediateChild));
|
||||||
}
|
}
|
||||||
startLine = block->FindLineFor(immediateChild);
|
line = block->FindLineFor(immediateChild);
|
||||||
NS_ASSERTION(startLine != block->end_lines(),
|
NS_ASSERTION(line != block->end_lines(),
|
||||||
"Frame is not in the block!!!");
|
"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.
|
// but we discard them instead of assigning them to frames.
|
||||||
// This is a little awkward because we traverse lines in the reverse direction
|
// 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.
|
// 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* stopAtFrame = aForFrame;
|
||||||
nsTextFrame* nextLineFirstTextFrame = nsnull;
|
nsTextFrame* nextLineFirstTextFrame = nsnull;
|
||||||
PRBool seenTextRunBoundaryOnLaterLine = PR_FALSE;
|
PRBool seenTextRunBoundaryOnLaterLine = PR_FALSE;
|
||||||
PRBool mayBeginInTextRun = PR_TRUE;
|
PRBool mayBeginInTextRun = PR_TRUE;
|
||||||
PRBool inOverflow = PR_FALSE;
|
PRBool inOverflow = PR_FALSE;
|
||||||
nsBlockFrame::line_iterator line;
|
|
||||||
while (PR_TRUE) {
|
while (PR_TRUE) {
|
||||||
line = backIterator.GetLine();
|
line = backIterator.GetLine();
|
||||||
block = backIterator.GetContainer();
|
block = backIterator.GetContainer();
|
||||||
|
@ -939,8 +926,6 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
|
||||||
// text run boundary is required we flush textRunFrames ((re)building their
|
// text run boundary is required we flush textRunFrames ((re)building their
|
||||||
// gfxTextRuns as necessary).
|
// gfxTextRuns as necessary).
|
||||||
nsBlockInFlowLineIterator forwardIterator(block, line, inOverflow);
|
nsBlockInFlowLineIterator forwardIterator(block, line, inOverflow);
|
||||||
PRBool seenStartLine = PR_FALSE;
|
|
||||||
PRUint32 linesAfterStartLine = 0;
|
|
||||||
do {
|
do {
|
||||||
line = forwardIterator.GetLine();
|
line = forwardIterator.GetLine();
|
||||||
if (line->IsBlock())
|
if (line->IsBlock())
|
||||||
|
@ -954,21 +939,6 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
|
||||||
scanner.ScanFrame(child);
|
scanner.ScanFrame(child);
|
||||||
child = child->GetNextSibling();
|
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());
|
} while (forwardIterator.Next());
|
||||||
|
|
||||||
// Set mStartOfLine so FlushFrames knows its textrun ends a line
|
// Set mStartOfLine so FlushFrames knows its textrun ends a line
|
||||||
|
@ -1047,7 +1017,6 @@ void BuildTextRunsScanner::FlushFrames(PRBool aFlushLineBreaks)
|
||||||
mBreakSinks.Clear();
|
mBreakSinks.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
mCanStopOnThisLine = PR_TRUE;
|
|
||||||
ResetRunInfo();
|
ResetRunInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче