Bug 1151204 part 5 - [css-grid] Fix a bug in the is-this-the-last-track check. r=dholbert

This commit is contained in:
Mats Palmgren 2016-10-01 02:26:39 +02:00
Родитель 7d542f321e
Коммит 479e0b57fd
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -3978,6 +3978,8 @@ nsGridContainerFrame::Tracks::CalculateItemBaselines(
std::sort(aBaselineItems.begin(), aBaselineItems.end(),
ItemBaselineData::IsBaselineTrackLessThan);
MOZ_ASSERT(mSizes.Length() > 0, "having an item implies at least one track");
const uint32_t lastTrack = mSizes.Length() - 1;
nscoord maxBaseline = 0;
nscoord maxDescent = 0;
uint32_t currentTrack = kAutoLine; // guaranteed to not match any item
@ -4007,7 +4009,7 @@ nsGridContainerFrame::Tracks::CalculateItemBaselines(
if (currentTrack == 0 && aBaselineGroup == BaselineSharingGroup::eFirst) {
mBaseline[aBaselineGroup] = maxBaseline;
}
if (currentTrack + 1 == len &&
if (currentTrack == lastTrack &&
aBaselineGroup == BaselineSharingGroup::eLast) {
mBaseline[aBaselineGroup] = maxBaseline;
}