зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1753453 - Don't send OnUnlockedDraw for non-animated images. r=aosmond
We're checking animation consumers, not locked status. We don't care about animation consumer count of non-animated images. Depends on D137765 Differential Revision: https://phabricator.services.mozilla.com/D137766
This commit is contained in:
Родитель
2875aa2568
Коммит
3e6347714a
|
@ -269,15 +269,13 @@ void nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest,
|
|||
}
|
||||
|
||||
void nsImageLoadingContent::OnUnlockedDraw() {
|
||||
// It's OK for non-animated images to wait until the next frame visibility
|
||||
// update to become locked. (And that's preferable, since in the case of
|
||||
// scrolling it keeps memory usage minimal.) For animated images, though, we
|
||||
// want to mark them visible right away so we can call
|
||||
// IncrementAnimationConsumers() on them and they'll start animating.
|
||||
if (!(mCurrentRequestFlags & REQUEST_IS_ANIMATED) &&
|
||||
!(mPendingRequestFlags & REQUEST_IS_ANIMATED)) {
|
||||
return;
|
||||
}
|
||||
// This notification is only sent for animated images. It's OK for
|
||||
// non-animated images to wait until the next frame visibility update to
|
||||
// become locked. (And that's preferable, since in the case of scrolling it
|
||||
// keeps memory usage minimal.)
|
||||
//
|
||||
// For animated images, though, we want to mark them visible right away so we
|
||||
// can call IncrementAnimationConsumers() on them and they'll start animating.
|
||||
|
||||
nsIFrame* frame = GetOurPrimaryFrame();
|
||||
if (!frame) {
|
||||
|
@ -305,10 +303,8 @@ void nsImageLoadingContent::OnUnlockedDraw() {
|
|||
void nsImageLoadingContent::OnImageIsAnimated(imgIRequest* aRequest) {
|
||||
bool* requestFlag = nullptr;
|
||||
if (aRequest == mCurrentRequest) {
|
||||
mCurrentRequestFlags |= REQUEST_IS_ANIMATED;
|
||||
requestFlag = &mCurrentRequestRegistered;
|
||||
} else if (aRequest == mPendingRequest) {
|
||||
mPendingRequestFlags |= REQUEST_IS_ANIMATED;
|
||||
requestFlag = &mPendingRequestRegistered;
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE("Which image is this?");
|
||||
|
|
|
@ -470,11 +470,9 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
|
|||
REQUEST_NEEDS_ANIMATION_RESET = 1 << 0,
|
||||
// Set if the request is currently tracked with the document.
|
||||
REQUEST_IS_TRACKED = 1 << 1,
|
||||
// Set if the request is animated.
|
||||
REQUEST_IS_ANIMATED = 1 << 2,
|
||||
// Set if this is an imageset request, such as from <img srcset> or
|
||||
// <picture>
|
||||
REQUEST_IS_IMAGESET = 1 << 3,
|
||||
REQUEST_IS_IMAGESET = 1 << 2,
|
||||
};
|
||||
|
||||
// If the image was blocked or if there was an error loading, it's nice to
|
||||
|
|
|
@ -1370,7 +1370,7 @@ RasterImage::Draw(gfxContext* aContext, const IntSize& aSize,
|
|||
return ImgDrawResult::BAD_ARGS;
|
||||
}
|
||||
|
||||
if (mAnimationConsumers == 0) {
|
||||
if (mAnimationConsumers == 0 && mAnimationState) {
|
||||
SendOnUnlockedDraw(aFlags);
|
||||
}
|
||||
|
||||
|
|
|
@ -976,7 +976,7 @@ VectorImage::Draw(gfxContext* aContext, const nsIntSize& aSize,
|
|||
return ImgDrawResult::NOT_READY;
|
||||
}
|
||||
|
||||
if (mAnimationConsumers == 0) {
|
||||
if (mAnimationConsumers == 0 && mHaveAnimations) {
|
||||
SendOnUnlockedDraw(aFlags);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче