зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160819 - ResponsiveImageSelector - improve some over-aggressive assertions
This commit is contained in:
Родитель
3a8e01586f
Коммит
ffa5e40696
|
@ -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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче