Bug 1647948. Relax assertion about image aspect ratio to consider that images can go into error state. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D80826
This commit is contained in:
Timothy Nikkel 2020-06-25 23:51:22 +00:00
Родитель 6612d6856b
Коммит bc9a1824af
1 изменённых файлов: 15 добавлений и 2 удалений

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

@ -1765,8 +1765,21 @@ static bool OldImageHasDifferentRatio(const nsImageFrame& aFrame,
// If we have an image, we need to have a current request.
// Same if we had an image.
const bool hasRequest = true;
MOZ_ASSERT(currentRatio == ComputeAspectRatio(&aImage, hasRequest, aFrame),
"aspect-ratio got out of sync during paint? How?");
#ifdef DEBUG
auto currentRatioRecomputed = ComputeAspectRatio(&aImage, hasRequest, aFrame);
// If the image encounters an error after decoding the size (and we run
// UpdateIntrinsicRatio) then the image will return the empty AspectRatio and
// the aspect ratio we compute here will be different from what was computed
// and stored before the image went into error state. It would be better to
// check that the image has an error here but we need an imgIRequest for that,
// not an imgIContainer. In lieu of that we check that
// aImage.GetIntrinsicRatio() returns Nothing() as it does when the image is
// in the error state and that the recomputed ratio is the zero ratio.
MOZ_ASSERT(
(!currentRatioRecomputed && aImage.GetIntrinsicRatio() == Nothing()) ||
currentRatio == currentRatioRecomputed,
"aspect-ratio got out of sync during paint? How?");
#endif
auto oldRatio = ComputeAspectRatio(aPrevImage, hasRequest, aFrame);
return oldRatio != currentRatio;
}