Changeset 249162 in webkit
- Timestamp:
- Aug 27, 2019 12:50:47 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249157 r249162 1 2019-08-27 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 3 Drawing an animated image to a canvas via drawImage should draw the first frame 4 https://bugs.webkit.org/show_bug.cgi?id=74779 5 <rdar://problem/42282454> 6 7 Reviewed by Said Abou-Hallawa. 8 9 Adds a test that checks that when drawing an animated image into a canvas 10 it draws the first frame and that the animation doesn't reset or pause. 11 12 Also enable the new internal setting setAnimatedImageDebugCanvasDrawingEnabled() 13 for the tests that rely on canvas.drawImage() drawing the current frame instead 14 of the first one. 15 16 * fast/canvas/drawImage-animated-gif-draws-first-frame-and-no-reset-image-expected.txt: Added. 17 * fast/canvas/drawImage-animated-gif-draws-first-frame-and-no-reset-image.html: Added. 18 The above test checks that when drawing an animated image to a canvas it draws the first frame 19 and that the playing image doesn't get reseted and finish playing. 20 * fast/canvas/resources/animated-red-green-blue-yellow-cyan-black-repeat-1.gif: Added. 21 * fast/images/animated-gif-restored-from-bfcache.html: Enable internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(). 22 * fast/images/animated-image-different-dest-size.html: Ditto. 23 * fast/images/animated-image-loop-count.html: Ditto. 24 * fast/images/animated-image-mp4.html: Ditto. 25 * fast/images/decode-animated-image.html: Ditto. 26 * fast/images/decode-render-animated-image.html: Ditto. 27 * fast/images/ordered-animated-image-frames.html: Ditto. 28 * fast/images/reset-image-animation.html: Ditto. 29 * fast/images/slower-animation-than-decoding-image.html: Ditto. 30 * fast/images/slower-decoding-than-animation-image.html: Ditto. 31 1 32 2019-08-27 Ryan Haddad <ryanhaddad@apple.com> 2 33 -
trunk/LayoutTests/fast/images/animated-gif-restored-from-bfcache.html
r214706 r249162 6 6 7 7 function runTest() { 8 if (window.testRunner) 8 if (window.internals && window.testRunner) { 9 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 9 10 testRunner.waitUntilDone(); 11 } 10 12 11 13 var image = document.getElementById("image"); -
trunk/LayoutTests/fast/images/animated-image-different-dest-size.html
r218019 r249162 50 50 if (window.internals) { 51 51 internals.setImageFrameDecodingDuration(image, 0.030); 52 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 52 53 internals.settings.setWebkitImageReadyEventEnabled(true); 53 54 } -
trunk/LayoutTests/fast/images/animated-image-loop-count.html
r230712 r249162 68 68 69 69 (function() { 70 if (window.internals) 70 if (window.internals) { 71 71 internals.clearMemoryCache(); 72 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 73 } 72 74 73 75 if (window.testRunner) -
trunk/LayoutTests/fast/images/animated-image-mp4.html
r222225 r249162 6 6 <script> 7 7 window.jsTestIsAsync = true; 8 9 if (window.internals) 10 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 11 8 12 var imageData; 9 13 -
trunk/LayoutTests/fast/images/decode-animated-image.html
r221805 r249162 9 9 <canvas></canvas> 10 10 <script> 11 if (window.testRunner) 11 if (window.internals && window.testRunner) { 12 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 12 13 testRunner.waitUntilDone(); 14 } 15 13 16 var image = new Image; 14 17 image.src = "resources/animated-red-green-blue-repeat-2.gif"; -
trunk/LayoutTests/fast/images/decode-render-animated-image.html
r221805 r249162 21 21 if (window.internals && window.testRunner) { 22 22 internals.clearMemoryCache(); 23 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 23 24 internals.settings.setWebkitImageReadyEventEnabled(true); 24 25 testRunner.waitUntilDone(); -
trunk/LayoutTests/fast/images/ordered-animated-image-frames.html
r214450 r249162 10 10 <canvas id="canvas"></canvas> 11 11 <script> 12 if (window.internals) 12 if (window.internals && window.testRunner) { 13 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 13 14 internals.clearMemoryCache(); 14 15 if (window.testRunner)16 15 testRunner.waitUntilDone(); 16 } 17 17 18 18 var image = new Image; -
trunk/LayoutTests/fast/images/reset-image-animation.html
r214450 r249162 34 34 return new Promise((resolve) => { 35 35 image.onload = (() => { 36 if (window.internals) 36 if (window.internals) { 37 37 internals.setImageFrameDecodingDuration(image, 0.020); 38 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 39 } 38 40 drawImage(Math.ceil(frameCount / 2), 0).then(() => { 39 41 internals.resetImageAnimation(image); -
trunk/LayoutTests/fast/images/slower-animation-than-decoding-image.html
r208511 r249162 21 21 return; 22 22 internals.setImageFrameDecodingDuration(image, 0.040); 23 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 23 24 drawImage(); 24 25 drawLoop(); -
trunk/LayoutTests/fast/images/slower-decoding-than-animation-image.html
r208511 r249162 10 10 jsTestIsAsync = true; 11 11 12 internals.clearMemoryCache(); 12 if (window.internals) { 13 internals.settings.setAnimatedImageDebugCanvasDrawingEnabled(true); 14 internals.clearMemoryCache(); 15 } 13 16 14 17 var image = new Image; -
trunk/Source/WebCore/ChangeLog
r249160 r249162 1 2019-08-27 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 3 Drawing an animated image to a canvas via drawImage should draw the first frame 4 https://bugs.webkit.org/show_bug.cgi?id=74779 5 <rdar://problem/42282454> 6 7 Reviewed by Said Abou-Hallawa. 8 9 After this patch, when an animated image is drawn into a canvas via 10 drawImage, the actual image that the canvas will receive will be 11 a new Image object with the contents of the first frame of the animation. 12 13 It also adds an internal setting to keep the previous behaviour 14 (draw the current frame playing) because there are several layout 15 tests that rely on canvas.drawImage() to check that animated images 16 play properly. 17 18 Test: fast/canvas/drawImage-animated-gif-draws-first-frame-and-no-reset-image.html 19 20 * html/canvas/CanvasRenderingContext2DBase.cpp: 21 (WebCore::CanvasRenderingContext2DBase::drawImage): 22 * page/Settings.yaml: 23 * testing/InternalSettings.cpp: 24 (WebCore::InternalSettings::Backup::Backup): 25 (WebCore::InternalSettings::Backup::restoreTo): 26 (WebCore::InternalSettings::setAnimatedImageDebugCanvasDrawingEnabled): 27 * testing/InternalSettings.h: 28 * testing/InternalSettings.idl: 29 1 30 2019-08-27 Antti Koivisto <antti@apple.com> 2 31 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
r248846 r249162 58 58 #include "RenderTheme.h" 59 59 #include "SecurityOrigin.h" 60 #include "Settings.h" 60 61 #include "StrokeStyleApplier.h" 61 62 #include "StyleProperties.h" … … 1571 1572 } 1572 1573 1573 if (image->isBitmapImage()) 1574 if (image->isBitmapImage()) { 1575 // Drawing an animated image to a canvas should draw the first frame (except for a few layout tests) 1576 if (image->isAnimated() && !document.settings().animatedImageDebugCanvasDrawingEnabled()) 1577 image = BitmapImage::create(image->nativeImage()); 1574 1578 downcast<BitmapImage>(*image).updateFromSettings(document.settings()); 1579 } 1575 1580 1576 1581 if (rectContainsCanvas(normalizedDstRect)) { -
trunk/Source/WebCore/page/Settings.yaml
r248640 r249162 760 760 onChange: mediaTypeOverrideChanged 761 761 762 animatedImageDebugCanvasDrawingEnabled: 763 initial: false 762 764 763 765 fontRenderingMode: -
trunk/Source/WebCore/testing/InternalSettings.cpp
r248846 r249162 104 104 , m_shouldDispatchSyntheticMouseOutAfterSyntheticClick(settings.shouldDispatchSyntheticMouseOutAfterSyntheticClick()) 105 105 , m_shouldDeactivateAudioSession(PlatformMediaSessionManager::shouldDeactivateAudioSession()) 106 , m_animatedImageDebugCanvasDrawingEnabled(settings.animatedImageDebugCanvasDrawingEnabled()) 106 107 , m_userInterfaceDirectionPolicy(settings.userInterfaceDirectionPolicy()) 107 108 , m_systemLayoutDirection(settings.systemLayoutDirection()) … … 213 214 settings.setShouldDispatchSyntheticMouseOutAfterSyntheticClick(m_shouldDispatchSyntheticMouseOutAfterSyntheticClick); 214 215 PlatformMediaSessionManager::setShouldDeactivateAudioSession(m_shouldDeactivateAudioSession); 216 settings.setAnimatedImageDebugCanvasDrawingEnabled(m_animatedImageDebugCanvasDrawingEnabled); 215 217 216 218 #if ENABLE(INDEXED_DATABASE_IN_WORKERS) … … 777 779 } 778 780 781 ExceptionOr<void> InternalSettings::setAnimatedImageDebugCanvasDrawingEnabled(bool ignore) 782 { 783 if (!m_page) 784 return Exception { InvalidAccessError }; 785 settings().setAnimatedImageDebugCanvasDrawingEnabled(ignore); 786 return { }; 787 } 788 779 789 void InternalSettings::setIndexedDBWorkersEnabled(bool enabled) 780 790 { -
trunk/Source/WebCore/testing/InternalSettings.h
r247145 r249162 106 106 ExceptionOr<void> setShouldDispatchSyntheticMouseEventsWhenModifyingSelection(bool); 107 107 ExceptionOr<void> setShouldDispatchSyntheticMouseOutAfterSyntheticClick(bool); 108 ExceptionOr<void> setAnimatedImageDebugCanvasDrawingEnabled(bool); 108 109 109 110 using FrameFlatteningValue = FrameFlattening; … … 204 205 bool m_shouldDispatchSyntheticMouseOutAfterSyntheticClick { false }; 205 206 bool m_shouldDeactivateAudioSession; 207 bool m_animatedImageDebugCanvasDrawingEnabled; 206 208 UserInterfaceDirectionPolicy m_userInterfaceDirectionPolicy; 207 209 TextDirection m_systemLayoutDirection; -
trunk/Source/WebCore/testing/InternalSettings.idl
r247145 r249162 82 82 [MayThrowException] void setScrollingTreeIncludesFrames(boolean enabled); 83 83 [MayThrowException] void setAllowUnclampedScrollPosition(boolean allowUnclamped); 84 [MayThrowException] void setAnimatedImageDebugCanvasDrawingEnabled(boolean enable); 84 85 85 86 [MayThrowException] void setMinimumTimerInterval(unrestricted double intervalInSeconds);
Note: See TracChangeset
for help on using the changeset viewer.