Bug 1225118 - [css-grid] Deal with nscoord overflow when applying [align|justify]-self:stretch. r=dholbert

This commit is contained in:
Mats Palmgren 2015-11-17 15:00:29 +01:00
Родитель da54c2a828
Коммит b442e0b4b3
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -962,7 +962,6 @@ AlignJustifySelf(uint8_t aAlignment, bool aOverflowSafe, LogicalAxis aAxis,
nscoord bpInAxis = aAxis == eLogicalAxisBlock ? bp.BStartEnd(wm)
: bp.IStartEnd(wm);
nscoord contentSize = size - bpInAxis;
NS_ASSERTION(contentSize >= 0, "huh?");
const nscoord unstretchedContentSize = contentSize;
contentSize += gap;
nscoord max = aAxis == eLogicalAxisBlock ? aRS.ComputedMaxBSize()
@ -973,7 +972,8 @@ AlignJustifySelf(uint8_t aAlignment, bool aOverflowSafe, LogicalAxis aAxis,
}
// |gap| is now how much the content size is actually allowed to grow.
didResize = gap > 0;
if (didResize) {
// (nscoord overflow can make |contentSize| negative, bug 1225118)
if (didResize && MOZ_LIKELY(contentSize >= 0)) {
(aAxis == eLogicalAxisBlock ? aContentSize->BSize(wm)
: aContentSize->ISize(wm)) = contentSize;
if (MOZ_UNLIKELY(!aSameSide)) {