зеркало из 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) {
|
if (mType == eCandidateType_Density) {
|
||||||
return mValue.mDensity;
|
return mValue.mDensity;
|
||||||
} else if (mType == eCandidateType_ComputedFromWidth) {
|
} else if (mType == eCandidateType_ComputedFromWidth) {
|
||||||
if (aMatchingWidth <= 0) {
|
if (aMatchingWidth < 0) {
|
||||||
MOZ_ASSERT(false, "0 or negative matching width is invalid per spec");
|
MOZ_ASSERT(false, "Don't expect to have a negative matching width at this point");
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
double density = double(mValue.mWidth) / double(aMatchingWidth);
|
double density = double(mValue.mWidth) / double(aMatchingWidth);
|
||||||
|
|
|
@ -754,7 +754,7 @@ HTMLImageElement::NaturalHeight()
|
||||||
|
|
||||||
if (mResponsiveSelector) {
|
if (mResponsiveSelector) {
|
||||||
double density = mResponsiveSelector->GetSelectedImageDensity();
|
double density = mResponsiveSelector->GetSelectedImageDensity();
|
||||||
MOZ_ASSERT(IsFinite(density) && density > 0.0);
|
MOZ_ASSERT(density >= 0.0);
|
||||||
height = NSToIntRound(double(height) / density);
|
height = NSToIntRound(double(height) / density);
|
||||||
height = std::max(height, 0u);
|
height = std::max(height, 0u);
|
||||||
}
|
}
|
||||||
|
@ -782,7 +782,7 @@ HTMLImageElement::NaturalWidth()
|
||||||
|
|
||||||
if (mResponsiveSelector) {
|
if (mResponsiveSelector) {
|
||||||
double density = mResponsiveSelector->GetSelectedImageDensity();
|
double density = mResponsiveSelector->GetSelectedImageDensity();
|
||||||
MOZ_ASSERT(IsFinite(density) && density > 0.0);
|
MOZ_ASSERT(density >= 0.0);
|
||||||
width = NSToIntRound(double(width) / density);
|
width = NSToIntRound(double(width) / density);
|
||||||
width = std::max(width, 0u);
|
width = std::max(width, 0u);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче