-
Notifications
You must be signed in to change notification settings - Fork 1.6k
REGRESSION(283753@main): Video as image source with decoding="async"
is decoded always synchronously
#47266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
EWS run on current version of this PR (hash 26afd37) |
@@ -344,7 +344,7 @@ DecodingMode RenderBoxModelObject::decodingModeForImageDraw(const Image& image, | |||
// <img decoding="async"> forces asynchronous decoding but make sure this | |||
// will not cause flickering. | |||
if (imgElement->decodingMode() == DecodingMode::Asynchronous) { | |||
if (bitmapImage->isAsyncDecodingEnabledForTesting()) | |||
if (bitmapImage->isAsyncDecodingEnabledForTesting() || bitmapImage->isAnimated()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK to change behavior for animated GIF/APNG etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is restoring the code to what it was before 283753@main. If the page specifies decoding="async" for an animated image, I think we should respect this choice since it isn't going to cause any flickering. Please notice that for animated images, the returned DecodingMode
here is for the next frame (not the current one).
For async animated image decoding, we always display the current frame which we ensure it is cached. The animation is advanced only when the frame finishes decoding. The image is repainted when the animation is advanced.
…` is decoded always synchronously https://bugs.webkit.org/show_bug.cgi?id=295066 rdar://153915118 Reviewed by Simon Fraser. The bug is in RenderBoxModelObject::decodingModeForImageDraw() when we choose the DecodingMode for the image and the element has the attribute decoding="async”. In this case we try to be smart and override the user choice if it is going to cause flickering. We check if the element is in the viewport and if it is, we do use DecodingMode::Synchronous. But this should logic not be applied to animated images (or videos as images) because for animated images we calculate the decoding mode for the next frame. * Source/WebCore/platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): * Source/WebCore/rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::decodingModeForImageDraw const): Canonical link: https://commits.webkit.org/296706@main
26afd37
to
f12f3a3
Compare
Committed 296706@main (f12f3a3): https://commits.webkit.org/296706@main Reviewed commits have been landed. Closing PR #47266 and removing active labels. |
f12f3a3
26afd37