Back out changeset 25beb9ced8d2 (bug 418975) for causing crash bug 645072.

This commit is contained in:
L. David Baron 2011-03-25 11:38:58 -07:00
Родитель 10be45c537
Коммит 32c4f11bf8
3 изменённых файлов: 7 добавлений и 38 удалений

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

@ -3184,8 +3184,7 @@ nsIFrame::InlineMinWidthData::ForceBreak(nsIRenderingContext *aRenderingContext)
}
void
nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingContext,
nscoord aHyphenWidth)
nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingContext)
{
trailingTextFrame = nsnull;
@ -3194,9 +3193,8 @@ nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingCon
// text-indent or negative margin), don't break. Otherwise, do the
// same as ForceBreak. it doesn't really matter when we accumulate
// floats.
if (currentLine + aHyphenWidth < 0 || atStartOfLine)
if (currentLine < 0 || atStartOfLine)
return;
currentLine += aHyphenWidth;
ForceBreak(aRenderingContext);
}

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

@ -1465,11 +1465,7 @@ public:
// optional breaks to prevent min-width from ending up bigger than
// pref-width.
void ForceBreak(nsIRenderingContext *aRenderingContext);
// If the break here is actually taken, aHyphenWidth must be added to the
// width of the current line.
void OptionallyBreak(nsIRenderingContext *aRenderingContext,
nscoord aHyphenWidth = 0);
void OptionallyBreak(nsIRenderingContext *aRenderingContext);
// The last text frame processed so far in the current line, when
// the last characters in that text frame are relevant for line

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

@ -6072,19 +6072,8 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
// OK since we can't really handle tabs for intrinsic sizing anyway.
const nsStyleText* textStyle = GetStyleText();
const nsTextFragment* frag = mContent->GetText();
// If we're hyphenating, the PropertyProvider needs the actual length;
// otherwise we can just pass PR_INT32_MAX to mean "all the text"
PRInt32 len = PR_INT32_MAX;
PRBool hyphenating =
(mTextRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0;
if (hyphenating) {
gfxSkipCharsIterator tmp(iter);
len =
tmp.ConvertSkippedToOriginal(flowEndInTextRun) - iter.GetOriginalOffset();
}
PropertyProvider provider(mTextRun, textStyle, frag, this,
iter, len, nsnull, 0);
iter, PR_INT32_MAX, nsnull, 0);
PRBool collapseWhitespace = !textStyle->WhiteSpaceIsSignificant();
PRBool preformatNewlines = textStyle->NewlineIsSignificant();
@ -6093,16 +6082,7 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
PRUint32 start =
FindStartAfterSkippingWhitespace(&provider, aData, textStyle, &iter, flowEndInTextRun);
nsAutoTArray<PRPackedBool,BIG_TEXT_NODE_SIZE> hyphBuffer;
PRPackedBool *hyphBreakBefore = nsnull;
if (hyphenating) {
hyphBreakBefore = hyphBuffer.AppendElements(flowEndInTextRun - start);
if (hyphBreakBefore) {
provider.GetHyphenationBreaks(start, flowEndInTextRun - start,
hyphBreakBefore);
}
}
// XXX Should we consider hyphenation here?
for (PRUint32 i = start, wordStart = start; i <= flowEndInTextRun; ++i) {
PRBool preformattedNewline = PR_FALSE;
PRBool preformattedTab = PR_FALSE;
@ -6112,11 +6092,8 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
// starts?
preformattedNewline = preformatNewlines && mTextRun->GetChar(i) == '\n';
preformattedTab = preformatTabs && mTextRun->GetChar(i) == '\t';
if (!mTextRun->CanBreakLineBefore(i) &&
!preformattedNewline &&
!preformattedTab &&
(!hyphBreakBefore || !hyphBreakBefore[i - start]))
{
if (!mTextRun->CanBreakLineBefore(i) && !preformattedNewline &&
!preformattedTab) {
// we can't break here (and it's not the end of the flow)
continue;
}
@ -6158,8 +6135,6 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK))) {
if (preformattedNewline) {
aData->ForceBreak(aRenderingContext);
} else if (hyphBreakBefore && hyphBreakBefore[i - start]) {
aData->OptionallyBreak(aRenderingContext, provider.GetHyphenWidth());
} else {
aData->OptionallyBreak(aRenderingContext);
}