Changeset 230712 in webkit
- Timestamp:
- Apr 17, 2018 9:22:49 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r230703 r230712 1 2018-04-17 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Animated GIF imagery with finite looping are falling one loop short 4 https://bugs.webkit.org/show_bug.cgi?id=183153 5 6 Reviewed by Simon Fraser. 7 8 This layout test tests GIF when it has to loop its entire frames a specific 9 number of times. There are three cases for the loopCount field: 10 -- loopCount is missing: This means the GIF should animate only once. This 11 is covered by animated-red-green-blue-repeat-1.gif. 12 -- loopCount = 0: This means the image has to animate indefinatly. This 13 case is covered by the new GIF animated-red-green-blue-repeat-infinite.gif. 14 -- loopCount > 0: This will loop the GIF entire frames for (loopCount + 1) 15 times. To fix the test with the extra loop, loopCount in 16 animated-red-green-blue-repeat-2.gif was changed to 1 instead of 2. 17 18 * fast/images/animated-image-loop-count-expected.html: 19 * fast/images/animated-image-loop-count.html: 20 * fast/images/resources/animated-red-green-blue-repeat-2.gif: 21 * fast/images/resources/animated-red-green-blue-repeat-infinite.gif: 22 1 23 2018-04-16 Antoine Quint <graouts@apple.com> 2 24 -
trunk/LayoutTests/fast/images/animated-image-loop-count-expected.html
r210951 r230712 10 10 <body> 11 11 <div> 12 <p>Frames of a 3-frame animated image with loopCount = 1:</p>12 <p>Frames of a 3-frame animated image with missing loopCount, (repetitionCount = 1):</p> 13 13 <div class="box" style="background-color: red;"></div> 14 14 <div class="box" style="background-color: green;"></div> … … 17 17 </div> 18 18 <div> 19 <p>Frames of a 3-frame animated image with loopCount = 2:</p>19 <p>Frames of a 3-frame animated image with loopCount = 1, (repetitionCount = 2):</p> 20 20 <div class="box" style="background-color: red;"></div> 21 21 <div class="box" style="background-color: green;"></div> … … 26 26 <div class="box" style="background-color: blue;"></div> 27 27 </div> 28 <div> 29 <p>Frames of a 3-frame animated image with loopCount = 0, (repetitionCount = infinite):</p> 30 <div class="box" style="background-color: red;"></div> 31 <div class="box" style="background-color: green;"></div> 32 <div class="box" style="background-color: blue;"></div> 33 <div class="box" style="background-color: red;"></div> 34 <div class="box" style="background-color: green;"></div> 35 <div class="box" style="background-color: blue;"></div> 36 <div class="box" style="background-color: red;"></div> 37 </div> 28 38 </body> 29 39 </html> -
trunk/LayoutTests/fast/images/animated-image-loop-count.html
r214450 r230712 9 9 <body> 10 10 <div> 11 <p>Frames of a 3-frame animated image with loopCount = 1:</p>11 <p>Frames of a 3-frame animated image with missing loopCount, (repetitionCount = 1):</p> 12 12 <canvas id="canvas-1"></canvas> 13 13 <canvas id="canvas-2"></canvas> … … 16 16 </div> 17 17 <div> 18 <p>Frames of a 3-frame animated image with loopCount = 2:</p>18 <p>Frames of a 3-frame animated image with loopCount = 1, (repetitionCount = 2):</p> 19 19 <canvas id="canvas-a"></canvas> 20 20 <canvas id="canvas-b"></canvas> … … 24 24 <canvas id="canvas-f"></canvas> 25 25 <canvas id="canvas-g"></canvas> 26 </div> 27 <div> 28 <p>Frames of a 3-frame animated image with loopCount = 0, (repetitionCount = infinite):</p> 29 <canvas id="canvas-A"></canvas> 30 <canvas id="canvas-B"></canvas> 31 <canvas id="canvas-C"></canvas> 32 <canvas id="canvas-D"></canvas> 33 <canvas id="canvas-E"></canvas> 34 <canvas id="canvas-F"></canvas> 35 <canvas id="canvas-G"></canvas> 26 36 </div> 27 37 <script> … … 66 76 var images = [ 67 77 { src: "resources/animated-red-green-blue-repeat-1.gif", canvasId: '1', frameCount: 4 }, 68 { src: "resources/animated-red-green-blue-repeat-2.gif", canvasId: 'a', frameCount: 7 } 78 { src: "resources/animated-red-green-blue-repeat-2.gif", canvasId: 'a', frameCount: 7 }, 79 { src: "resources/animated-red-green-blue-repeat-infinite.gif", canvasId: 'A', frameCount: 7 } 69 80 ]; 70 81 -
trunk/Source/WebCore/ChangeLog
r230711 r230712 1 2018-04-17 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Animated GIF imagery with finite looping are falling one loop short 4 https://bugs.webkit.org/show_bug.cgi?id=183153 5 6 Reviewed by Simon Fraser. 7 8 The Netscape Looping Application Extension is a block which may be added 9 to a GIF file to tell the viewer to loop through the entire GIF frames. 10 This is communicated through two bytes designated for the "loopCount" in 11 this block. 12 13 The entire block may not be found in the GIF, in which case the GIF is 14 supposed to animate its entire frames only once. 15 16 If the block exists and loopCount = 0, this means the image has to loop 17 through its frames indefinitely. 18 19 If the block exist and loopCount > 0, this should mean the image has to 20 loop through its frames loopCount + 1 times. The extra loop seems to be 21 the consensus among most of the GIF generators and viewers. For example, 22 if the image designer wants the image to loop through its frames n times: 23 -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 24 will write n - 1 for loopCount. However http://gifmaker.me and 25 http://gifmaker.org write n for loopCount. 26 -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will 27 translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 28 means loop the GIF n times. 29 30 Because the specs are not really clear about this, we are going to consider 31 the agreed-upon behavior among most of the web browsers the specs here. 32 33 * platform/graphics/cg/ImageDecoderCG.cpp: 34 (WebCore::ImageDecoderCG::repetitionCount const): 35 * platform/image-decoders/gif/GIFImageDecoder.cpp: 36 (WebCore::GIFImageDecoder::repetitionCount const): 37 1 38 2018-04-17 Saam Barati <sbarati@apple.com> 2 39 -
trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp
r229400 r230712 246 246 247 247 // A property with value 0 means loop forever. 248 return loopCount ? loopCount : RepetitionCountInfinite; 248 // For loopCount > 0, the specs is not clear about it. But it looks the meaning 249 // is: play once + loop loopCount which is equivalent to play loopCount + 1. 250 return loopCount ? loopCount + 1 : RepetitionCountInfinite; 249 251 } 250 252 -
trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
r230522 r230712 96 96 m_repetitionCount = RepetitionCountOnce; 97 97 else if (m_reader && m_reader->loopCount() != cLoopCountNotSeen) 98 m_repetitionCount = m_reader->loopCount() ;98 m_repetitionCount = m_reader->loopCount() > 0 ? m_reader->loopCount() + 1 : m_reader->loopCount(); 99 99 return m_repetitionCount; 100 100 }
Note: See TracChangeset
for help on using the changeset viewer.