Bug 831269 - Enable sync decoding when image is not ready to paint, r=seth
MozReview-Commit-ID: 87XBXbDuCQF
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1523,16 +1523,24 @@ nsDisplayImage::Paint(nsDisplayListBuild
result == DrawResult::INCOMPLETE ||
result == DrawResult::TEMPORARY_ERROR) {
// If the current image failed to paint because it's still loading or
// decoding, try painting the previous image.
if (mPrevImage) {
result = static_cast<nsImageFrame*>(mFrame)->
PaintImage(*aCtx, ToReferenceFrame(), mVisibleRect, mPrevImage, flags);
}
+
+ // Enable sync decoding when current image failed to paint because
+ // it's still decoding and previous image is not available
+ if (!mPrevImage && result == DrawResult::NOT_READY) {
+ flags |= imgIContainer::FLAG_SYNC_DECODE;
+ DrawResult result = static_cast<nsImageFrame*>(mFrame)->
+ PaintImage(*aCtx, ToReferenceFrame(), mVisibleRect, mImage, flags);
+ }
}
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
nsDisplayItemGeometry*
nsDisplayImage::AllocateGeometry(nsDisplayListBuilder* aBuilder)
{