Fixed <rdar://problem/4002505> 8A378: Endlessly animating gif's on http://www.entropy.ch
authorrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Feb 2005 01:51:47 +0000 (01:51 +0000)
committerrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Feb 2005 01:51:47 +0000 (01:51 +0000)
If animated images had no loop count property we were incorrectly
looping forver.  Note, that in the course of fixing this bug
I found that ImageIO is incorrectly NOT reporting the loop count
for a whole class of animated GIFs.

        Reviewed by Ken Kocienda.

        * WebCoreSupport.subproj/WebImageData.m:
        (-[WebImageData _repetitionCount]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8587 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebImageData.m

index 75ed6420f92cae85db4d00db663c65dbf5b6d2a8..988406317ace65204523a13d2cf9d60af3feccad 100644 (file)
@@ -1,3 +1,17 @@
+2005-02-11  Richard Williamson   <rjw@apple.com>
+
+       Fixed <rdar://problem/4002505> 8A378: Endlessly animating gif's on http://www.entropy.ch
+       
+       If animated images had no loop count property we were incorrectly
+       looping forver.  Note, that in the course of fixing this bug
+       I found that ImageIO is incorrectly NOT reporting the loop count
+       for a whole class of animated GIFs.
+
+        Reviewed by Ken Kocienda.
+
+        * WebCoreSupport.subproj/WebImageData.m:
+        (-[WebImageData _repetitionCount]):
+
 === Safari-186 ===
 
 2005-02-11  Vicki Murley  <vicki@apple.com>
index a01f75220abd68360592718e464a358f2fb585e5..be908966ea207af54de23489eb4cca458b954eed 100644 (file)
@@ -649,10 +649,12 @@ CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
     return value;
 }
 
-- (float)_floatFileProperty:(CFStringRef)property type:(CFStringRef)type 
+- (float)_floatFileProperty:(CFStringRef)property type:(CFStringRef)type hasProperty:(BOOL *)hasProperty;
 {
     [decodeLock lock];
     
+    *hasProperty = NO;
+    
     CFDictionaryRef properties = [self fileProperties];
     if (!properties) {
         [decodeLock unlock];
@@ -677,6 +679,8 @@ CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
     CFNumberGetValue (num, kCFNumberFloat32Type, &value);
 
     [decodeLock unlock];
+
+    *hasProperty = YES;
     
     return value;
 }
@@ -729,7 +733,16 @@ CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
 
 - (int)_repetitionCount
 {
-    return [self _floatFileProperty:kCGImagePropertyGIFLoopCount type:kCGImagePropertyGIFDictionary];
+    int count;
+    BOOL hasProperty;
+
+    // No property means loop once.
+    // A property with value 0 means loops forever.
+    count = [self _floatFileProperty:kCGImagePropertyGIFLoopCount type:kCGImagePropertyGIFDictionary hasProperty:&hasProperty];
+    if (!hasProperty)
+       count = -1;
+       
+    return count;
 }
 
 - (BOOL)isAnimationFinished