зеркало из 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() {
|
void nsImageLoadingContent::OnUnlockedDraw() {
|
||||||
// It's OK for non-animated images to wait until the next frame visibility
|
// This notification is only sent for animated images. It's OK for
|
||||||
// update to become locked. (And that's preferable, since in the case of
|
// non-animated images to wait until the next frame visibility update to
|
||||||
// scrolling it keeps memory usage minimal.) For animated images, though, we
|
// become locked. (And that's preferable, since in the case of scrolling it
|
||||||
// want to mark them visible right away so we can call
|
// keeps memory usage minimal.)
|
||||||
// IncrementAnimationConsumers() on them and they'll start animating.
|
//
|
||||||
if (!(mCurrentRequestFlags & REQUEST_IS_ANIMATED) &&
|
// For animated images, though, we want to mark them visible right away so we
|
||||||
!(mPendingRequestFlags & REQUEST_IS_ANIMATED)) {
|
// can call IncrementAnimationConsumers() on them and they'll start animating.
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIFrame* frame = GetOurPrimaryFrame();
|
nsIFrame* frame = GetOurPrimaryFrame();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
|
@ -305,10 +303,8 @@ void nsImageLoadingContent::OnUnlockedDraw() {
|
||||||
void nsImageLoadingContent::OnImageIsAnimated(imgIRequest* aRequest) {
|
void nsImageLoadingContent::OnImageIsAnimated(imgIRequest* aRequest) {
|
||||||
bool* requestFlag = nullptr;
|
bool* requestFlag = nullptr;
|
||||||
if (aRequest == mCurrentRequest) {
|
if (aRequest == mCurrentRequest) {
|
||||||
mCurrentRequestFlags |= REQUEST_IS_ANIMATED;
|
|
||||||
requestFlag = &mCurrentRequestRegistered;
|
requestFlag = &mCurrentRequestRegistered;
|
||||||
} else if (aRequest == mPendingRequest) {
|
} else if (aRequest == mPendingRequest) {
|
||||||
mPendingRequestFlags |= REQUEST_IS_ANIMATED;
|
|
||||||
requestFlag = &mPendingRequestRegistered;
|
requestFlag = &mPendingRequestRegistered;
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT_UNREACHABLE("Which image is this?");
|
MOZ_ASSERT_UNREACHABLE("Which image is this?");
|
||||||
|
|
|
@ -470,11 +470,9 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
|
||||||
REQUEST_NEEDS_ANIMATION_RESET = 1 << 0,
|
REQUEST_NEEDS_ANIMATION_RESET = 1 << 0,
|
||||||
// Set if the request is currently tracked with the document.
|
// Set if the request is currently tracked with the document.
|
||||||
REQUEST_IS_TRACKED = 1 << 1,
|
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
|
// Set if this is an imageset request, such as from <img srcset> or
|
||||||
// <picture>
|
// <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
|
// 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;
|
return ImgDrawResult::BAD_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAnimationConsumers == 0) {
|
if (mAnimationConsumers == 0 && mAnimationState) {
|
||||||
SendOnUnlockedDraw(aFlags);
|
SendOnUnlockedDraw(aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -976,7 +976,7 @@ VectorImage::Draw(gfxContext* aContext, const nsIntSize& aSize,
|
||||||
return ImgDrawResult::NOT_READY;
|
return ImgDrawResult::NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAnimationConsumers == 0) {
|
if (mAnimationConsumers == 0 && mHaveAnimations) {
|
||||||
SendOnUnlockedDraw(aFlags);
|
SendOnUnlockedDraw(aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче