Bug 1224669 - Clamp width to be non-negative during intrinsic width calculation. r=dholbert

This commit is contained in:
Jonathan Kew 2016-01-01 10:29:27 +00:00
Родитель 4a39150d67
Коммит a790163053
2 изменённых файлов: 17 добавлений и 7 удалений

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

@ -7872,7 +7872,9 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext,
if (i > wordStart) {
nscoord width =
NSToCoordCeilClamped(textRun->GetAdvanceWidth(wordStart, i - wordStart, &provider));
NSToCoordCeilClamped(textRun->GetAdvanceWidth(wordStart, i - wordStart,
&provider));
width = std::max(0, width);
aData->currentLine = NSCoordSaturatingAdd(aData->currentLine, width);
aData->atStartOfLine = false;
@ -7884,8 +7886,11 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext,
aData->trailingWhitespace += width;
} else {
// Some non-whitespace so the old trailingWhitespace is no longer trailing
aData->trailingWhitespace =
NSToCoordCeilClamped(textRun->GetAdvanceWidth(trimStart, i - trimStart, &provider));
nscoord wsWidth =
NSToCoordCeilClamped(textRun->GetAdvanceWidth(trimStart,
i - trimStart,
&provider));
aData->trailingWhitespace = std::max(0, wsWidth);
}
} else {
aData->trailingWhitespace = 0;
@ -8024,7 +8029,9 @@ nsTextFrame::AddInlinePrefISizeForFlow(nsRenderingContext *aRenderingContext,
if (i > lineStart) {
nscoord width =
NSToCoordCeilClamped(textRun->GetAdvanceWidth(lineStart, i - lineStart, &provider));
NSToCoordCeilClamped(textRun->GetAdvanceWidth(lineStart, i - lineStart,
&provider));
width = std::max(0, width);
aData->currentLine = NSCoordSaturatingAdd(aData->currentLine, width);
if (collapseWhitespace) {
@ -8035,8 +8042,11 @@ nsTextFrame::AddInlinePrefISizeForFlow(nsRenderingContext *aRenderingContext,
aData->trailingWhitespace += width;
} else {
// Some non-whitespace so the old trailingWhitespace is no longer trailing
aData->trailingWhitespace =
NSToCoordCeilClamped(textRun->GetAdvanceWidth(trimStart, i - trimStart, &provider));
nscoord wsWidth =
NSToCoordCeilClamped(textRun->GetAdvanceWidth(trimStart,
i - trimStart,
&provider));
aData->trailingWhitespace = std::max(0, wsWidth);
}
} else {
aData->trailingWhitespace = 0;

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

@ -326,4 +326,4 @@ pref(layout.css.control-characters.visible,true) != control-chars-04d.html contr
HTTP(..) == space-font-1.html space-font-1-ref.html
# handling of highly negative letter-spacing and intrinsic width
fails == negative-letter-spacing-1.html negative-letter-spacing-1-ref.html
== negative-letter-spacing-1.html negative-letter-spacing-1-ref.html