Bug 1160819 - ResponsiveImageSelector - improve some over-aggressive assertions

This commit is contained in:
John Schoenick 2015-07-05 18:03:00 -07:00
Родитель 3a8e01586f
Коммит ffa5e40696
2 изменённых файлов: 4 добавлений и 4 удалений

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

@ -703,8 +703,8 @@ ResponsiveImageCandidate::Density(int32_t aMatchingWidth) const
if (mType == eCandidateType_Density) {
return mValue.mDensity;
} else if (mType == eCandidateType_ComputedFromWidth) {
if (aMatchingWidth <= 0) {
MOZ_ASSERT(false, "0 or negative matching width is invalid per spec");
if (aMatchingWidth < 0) {
MOZ_ASSERT(false, "Don't expect to have a negative matching width at this point");
return 1.0;
}
double density = double(mValue.mWidth) / double(aMatchingWidth);

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

@ -754,7 +754,7 @@ HTMLImageElement::NaturalHeight()
if (mResponsiveSelector) {
double density = mResponsiveSelector->GetSelectedImageDensity();
MOZ_ASSERT(IsFinite(density) && density > 0.0);
MOZ_ASSERT(density >= 0.0);
height = NSToIntRound(double(height) / density);
height = std::max(height, 0u);
}
@ -782,7 +782,7 @@ HTMLImageElement::NaturalWidth()
if (mResponsiveSelector) {
double density = mResponsiveSelector->GetSelectedImageDensity();
MOZ_ASSERT(IsFinite(density) && density > 0.0);
MOZ_ASSERT(density >= 0.0);
width = NSToIntRound(double(width) / density);
width = std::max(width, 0u);
}