Title: [218019] trunk/LayoutTests
Revision
218019
Author
[email protected]
Date
2017-06-09 14:53:34 -0700 (Fri, 09 Jun 2017)

Log Message

LayoutTest fast/images/animated-image-different-dest-size.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=170203

Patch by Said Abou-Hallawa <[email protected]> on 2017-06-09
Reviewed by Simon Fraser.

Instead of using setTimeout(), listen to the webkitImageFrameReady event
to know relaibly when to draw the next frame of an animated image to a
canvas.

* fast/images/animated-image-different-dest-size.html:
* platform/mac-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (218018 => 218019)


--- trunk/LayoutTests/ChangeLog	2017-06-09 21:25:36 UTC (rev 218018)
+++ trunk/LayoutTests/ChangeLog	2017-06-09 21:53:34 UTC (rev 218019)
@@ -1,3 +1,17 @@
+2017-06-09  Said Abou-Hallawa  <[email protected]>
+
+        LayoutTest fast/images/animated-image-different-dest-size.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=170203
+ 
+        Reviewed by Simon Fraser.
+ 
+        Instead of using setTimeout(), listen to the webkitImageFrameReady event
+        to know relaibly when to draw the next frame of an animated image to a
+        canvas.
+
+        * fast/images/animated-image-different-dest-size.html:
+        * platform/mac-wk2/TestExpectations:
+
 2017-06-09  Matt Lewis  <[email protected]>
 
         Skipped layout test svg/animations/svglength-element-removed-crash.svg.

Modified: trunk/LayoutTests/fast/images/animated-image-different-dest-size.html (218018 => 218019)


--- trunk/LayoutTests/fast/images/animated-image-different-dest-size.html	2017-06-09 21:25:36 UTC (rev 218018)
+++ trunk/LayoutTests/fast/images/animated-image-different-dest-size.html	2017-06-09 21:53:34 UTC (rev 218019)
@@ -21,9 +21,16 @@
                     context.drawImage(image, 0, 0, 100, 100, 0, 0, canvas.width, canvas.height);
                     newCanvasIds.push(String.fromCharCode(canvasId.charCodeAt() + 1))
                 }
-                setTimeout(() => {
-                    resolve(newCanvasIds);
-                }, 40);
+
+                if (window.internals) {
+                    image.addEventListener("webkitImageFrameReady", function() {
+                        resolve(newCanvasIds);
+                    }, false);
+                } else {
+                    setTimeout(() => {
+                        resolve(newCanvasIds);
+                    }, 40);
+                }
             });
         }
 
@@ -37,12 +44,13 @@
             return promise;
         }
 
-        function loadImage(src, canvasIds, frameCount) {
+        function loadImage(image, src, canvasIds, frameCount) {
             return new Promise((resolve) => {
-                let image = new Image;
                 image._onload_ = (() => {
-                    if (window.internals)
+                    if (window.internals) {
                         internals.setImageFrameDecodingDuration(image, 0.030);
+                        internals.settings.setWebkitImageReadyEventEnabled(true);
+                    }
                     drawImage(image, canvasIds, frameCount).then(resolve);
                 });
                 image.src = ""
@@ -55,10 +63,14 @@
 
             if (window.testRunner)
                 testRunner.waitUntilDone();
-                
-            var promise = loadImage("resources/animated-red-green-blue.gif", ['1', 'a'], 3);
 
+            var image = new Image;
+            document.body.appendChild(image);
+
+            var promise = loadImage(image, "resources/animated-red-green-blue.gif", ['1', 'a'], 3);
+
             promise.then(() => {
+                image.remove();
                 if (window.testRunner)
                     testRunner.notifyDone();
             });

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (218018 => 218019)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2017-06-09 21:25:36 UTC (rev 218018)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2017-06-09 21:53:34 UTC (rev 218019)
@@ -636,8 +636,6 @@
 
 webkit.org/b/169640 imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-_javascript_.html [ Failure ]
 
-webkit.org/b/170203 fast/images/animated-image-different-dest-size.html [ Pass ImageOnlyFailure ]
-
 # Media loading via network cache requires Sierra or newer.
 [ ElCapitan ] http/tests/cache/disk-cache/disk-cache-media-small.html [ Failure ]
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to