Bug 197251

Summary: REGRESSION(r244372): [GTK][WPE] fast/images/icon-decoding.html and others are failing
Product: WebKit Reporter: Alicia Boya García <aboya>
Component: WebKitGTKAssignee: Miguel Gomez <magomez>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, bugs-noreply, clopez, commit-queue, magomez, mcatanzaro, zan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=203240
Attachments:
Description Flags
Patch
none
Patch none

Description Alicia Boya García 2019-04-24 15:28:53 PDT
The following tests are failing on GTK since r244372:r244375

fast/images/icon-decoding.html
fast/images/reset-image-animation.html
fast/images/slower-animation-than-decoding-image.html
fast/images/slower-decoding-than-animation-image.html

Image failures:

css3/shapes/shape-outside/shape-image/shape-image-025.html
fast/images/animated-image-loop-count.html
imported/w3c/web-platform-tests/css/css-shapes/shape-outside/shape-image/shape-image-025.html
Comment 1 Michael Catanzaro 2019-04-24 16:31:50 PDT
That's going to be "ScalableImageDecoder: don't forcefully decode image data when querying frame completeness, duration" again
Comment 2 Miguel Gomez 2019-10-10 03:24:41 PDT
Several tests are failing on the WPE bot as well, and as Michael comments, the culprit seems to be r244372 "ScalableImageDecoder: don't forcefully decode image data when querying frame completeness, duration"

fast/images/icon-decoding.html [ Failure ]
fast/images/reset-image-animation.html [ Failure ]
fast/images/slower-animation-than-decoding-image.html [ Failure ]
fast/images/slower-decoding-than-animation-image.html [ Failure ]
fast/images/animated-image-loop-count.html [ ImageOnlyFailure ]
fast/images/animated-webp.html [ ImageOnlyFailure ]
Comment 3 Miguel Gomez 2019-10-16 05:27:41 PDT
I've been giving a look to this. There are 3 different issues.

First: fast/images/icon-decoding.html just needs new baseline

Second: https://github.com/WebKit/webkit/blob/1240cfe9a01ee4469fdaaacdf3056c4401b01b24/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp#L205

is causing that even non complete frames have a duration of 100ms. We should return 0_s if !frame.isComplete(), and avoid the 11ms change. This fixes these tests:

fast/images/reset-image-animation.html
fast/images/slower-animation-than-decoding-image.html
fast/images/slower-decoding-than-animation-image.html
fast/images/animated-image-loop-count.html

Then
css3/shapes/shape-outside/shape-image/shape-image-025.html
imported/w3c/web-platform-tests/css/css-shapes/shape-outside/shape-image/shape-image-025.html

are a bit trickier. They are testing that when using shape-outside on an animated image, the shape must be generated from the first frame of the animation. I've been debugging the code and I can see how the shape is being generated for each frame of the animation (both before and after the regression), and I think that these were passing before just by chance.
The thing is that just decoding the first frame would be enough for the shape image, but nothing indicates that and the complete animation is decoded. With each decoded frame, RenderBox::imageChanged() ends up being invoked and that causes the shape to be marked as dirty, so the next time we want to use it we'll generate it again from the new frame. I think we should somehow indicate that we don't want to decode the full animation when drawing the first frame (BitmapImage::draw()), but I need to check how the Apple ports deal with this, as it's not failing there.
Comment 4 Miguel Gomez 2019-10-22 01:42:37 PDT
I'm going to split this bug into 2, cause there are 2 issues here, one in ScalableDecoder and another one that seems to be in the multiplatform code handling the shape-outside property.

I leave this bug for the ScalableImageDecoder problem and I've created https://bugs.webkit.org/show_bug.cgi?id=203240 to handle the (possible) multiplatform issue.
Comment 5 Miguel Gomez 2019-10-22 01:50:48 PDT
*** Bug 197501 has been marked as a duplicate of this bug. ***
Comment 6 Miguel Gomez 2019-10-22 06:41:44 PDT
Created attachment 381541 [details]
Patch
Comment 7 Adrian Perez 2019-10-22 06:55:06 PDT
Comment on attachment 381541 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381541&action=review

There is a small typo in the ChangeLog; please fix it before landing.

> Source/WebCore/ChangeLog:10
> +        Covered by existent tests.

s/existent/existing/
Comment 8 Miguel Gomez 2019-10-22 07:19:29 PDT
Created attachment 381543 [details]
Patch
Comment 9 WebKit Commit Bot 2019-10-22 08:17:52 PDT
Comment on attachment 381543 [details]
Patch

Clearing flags on attachment: 381543

Committed r251431: <https://trac.webkit.org/changeset/251431>
Comment 10 WebKit Commit Bot 2019-10-22 08:17:54 PDT
All reviewed patches have been landed.  Closing bug.