[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:15:57 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 5300de2a15fd59811c7b75248e00c586f087de1f
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jun 1 00:03:12 2002 +0000

    	* WebCoreSupport.subproj/IFImageRenderer.h: Fixed the line endings (they were
    	Macintosh CRs instead of Unix LFs). Also made all the methods be private for
    	now since there's no need to have them be public.
    
    	* WebCoreSupport.subproj/IFImageRenderer.m: Fixed the line endings (they were
    	Macintosh CRs instead of Unix LFs). Some minor code tweaks too sharing a bit
    	more code.
    
    	* WebCoreSupport.subproj/IFImageRendererFactory.m:
    	(-[IFImageRendererFactory imageRendererWithSize:]): Return an IFImageRenderer
    	rather than just an NSImage, since an NSImage does not satisfy WebCoreImageRenderer.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1247 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 493f688..4a659b9 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,19 @@
 2002-05-31  Darin Adler  <darin at apple.com>
 
+	* WebCoreSupport.subproj/IFImageRenderer.h: Fixed the line endings (they were
+	Macintosh CRs instead of Unix LFs). Also made all the methods be private for
+	now since there's no need to have them be public.
+
+	* WebCoreSupport.subproj/IFImageRenderer.m: Fixed the line endings (they were
+	Macintosh CRs instead of Unix LFs). Some minor code tweaks too sharing a bit
+	more code.
+
+	* WebCoreSupport.subproj/IFImageRendererFactory.m:
+	(-[IFImageRendererFactory imageRendererWithSize:]): Return an IFImageRenderer
+	rather than just an NSImage, since an NSImage does not satisfy WebCoreImageRenderer.
+
+2002-05-31  Darin Adler  <darin at apple.com>
+
 	* Misc.subproj/WebKitDebug.h: Use displayableString in DEBUG_OBJECT
 	for nicer logging.
 
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 493f688..4a659b9 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,19 @@
 2002-05-31  Darin Adler  <darin at apple.com>
 
+	* WebCoreSupport.subproj/IFImageRenderer.h: Fixed the line endings (they were
+	Macintosh CRs instead of Unix LFs). Also made all the methods be private for
+	now since there's no need to have them be public.
+
+	* WebCoreSupport.subproj/IFImageRenderer.m: Fixed the line endings (they were
+	Macintosh CRs instead of Unix LFs). Some minor code tweaks too sharing a bit
+	more code.
+
+	* WebCoreSupport.subproj/IFImageRendererFactory.m:
+	(-[IFImageRendererFactory imageRendererWithSize:]): Return an IFImageRenderer
+	rather than just an NSImage, since an NSImage does not satisfy WebCoreImageRenderer.
+
+2002-05-31  Darin Adler  <darin at apple.com>
+
 	* Misc.subproj/WebKitDebug.h: Use displayableString in DEBUG_OBJECT
 	for nicer logging.
 
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
index 91a0e35..aedb361 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
@@ -1,9 +1,8 @@
-/*	IFAnimatedImage.h
+/*	IFImageRenderer.h
 	Copyright 2002, Apple, Inc. All rights reserved.
 */
 
 #import <Cocoa/Cocoa.h>
-
 #import <WebCoreImageRenderer.h>
 
 @interface IFImageRenderer : NSImage <WebCoreImageRenderer>
@@ -13,10 +12,4 @@
     NSRect imageRect;
     NSRect targetRect;
 }
-
-- (int)frameCount;
-- (int)currentFrame;
-- (void)setCurrentFrame:(int)frame;
-- (float)frameDuration;
-
 @end
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRenderer.m b/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
index 501230d..26180db 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
@@ -4,49 +4,50 @@
 
 #import <WebKit/IFImageRenderer.h>
 
+#import <WebKit/WebKitDebug.h>
+
 @implementation IFImageRenderer
 
 - (void)dealloc
 {
     [self stopAnimation];
-    [frameTimer release];
-    [frameView release];
     [super dealloc];
 }
 
-- (int) frameCount {
-    NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
+- (id)firstRepProperty:(NSString *)propertyName
+{
+    id firstRep = [[self representations] objectAtIndex:0];
     id property = nil;
-    
-    if ([imageRep respondsToSelector: @selector(valueForProperty:)])
-        property = [imageRep valueForProperty:NSImageFrameCount];
+    if ([firstRep respondsToSelector:@selector(valueForProperty:)])
+        property = [firstRep valueForProperty:propertyName];
+    return property;
+}
+
+- (int)frameCount
+{
+    id property = [self firstRepProperty:NSImageFrameCount];
     return property != nil ? [property intValue] : 1;
 }
 
-- (int) currentFrame {
-    NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
-    id property = nil;
-    
-    if ([imageRep respondsToSelector: @selector(valueForProperty:)])
-        property = [imageRep valueForProperty:NSImageCurrentFrame];
+- (int)currentFrame
+{
+    id property = [self firstRepProperty:NSImageCurrentFrame];
     return property != nil ? [property intValue] : 1;
 }
 
-- (void) setCurrentFrame:(int)frame {
+- (void)setCurrentFrame:(int)frame
+{
     NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
-    [imageRep setProperty:NSImageCurrentFrame withValue: [NSNumber numberWithInt:frame]];
+    [imageRep setProperty:NSImageCurrentFrame withValue:[NSNumber numberWithInt:frame]];
 }
 
-- (float) frameDuration {
-    NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
-    id property = nil;
-    
-    if ([imageRep respondsToSelector: @selector(valueForProperty:)])
-        property = [imageRep valueForProperty:NSImageCurrentFrameDuration];
+- (float)frameDuration
+{
+    id property = [self firstRepProperty:NSImageCurrentFrameDuration];
     return property != nil ? [property floatValue] : 0.0;
 }
 
-- (void)timerFired: (id)context
+- (void)nextFrame:(id)context
 {
     int currentFrame = [self currentFrame];
     
@@ -54,45 +55,44 @@
     [frameTimer release];
     
     currentFrame++;
-    if (currentFrame >= [self frameCount]){
+    if (currentFrame >= [self frameCount]) {
         currentFrame = 0;
     }
-        
+    
     [self setCurrentFrame: currentFrame];
     
     if ([frameView canDraw]){
         [frameView lockFocus];
-        [self drawInRect: targetRect
-                fromRect: imageRect
-                operation: NSCompositeSourceOver	// Renders transparency correctly
-                fraction: 1.0];
+        [self drawInRect:targetRect
+                fromRect:imageRect
+               operation:NSCompositeSourceOver	// Renders transparency correctly
+                fraction:1.0];
         [frameView unlockFocus];
         [[frameView window] flushWindow];
     }
 
-    float frameDuration = [self frameDuration];
-    frameTimer = [[NSTimer scheduledTimerWithTimeInterval: frameDuration
-                target: self
-                selector: @selector(timerFired:)
-                userInfo: nil
-                repeats: NO] retain];
+    frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
+                                                   target:self
+                                                 selector:@selector(nextFrame:)
+                                                 userInfo:nil
+                                                  repeats:NO] retain];
 }
 
 - (void)beginAnimationInView: (NSView *)view inRect: (NSRect)ir fromRect: (NSRect)fr
 {
+    WEBKIT_ASSERT(frameView == nil);
+    
     [self stopAnimation];
     
-    if ([self frameCount] > 1){
-        float frameDuration = [self frameDuration];
-        
+    if ([self frameCount] > 1) {
         imageRect = fr;
         targetRect = ir;
         frameView = [view retain];
-        frameTimer = [[NSTimer scheduledTimerWithTimeInterval: frameDuration
-                    target: self
-                    selector: @selector(timerFired:)
-                    userInfo: nil
-                    repeats: NO] retain];
+        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
+                                                       target:self
+                                                     selector:@selector(nextFrame:)
+                                                     userInfo:nil
+                                                      repeats:NO] retain];
     }
 }
 
@@ -100,20 +100,21 @@
 {
     [frameTimer invalidate];
     [frameTimer release];
-    frameTimer = 0;
+    frameTimer = nil;
     
     [frameView release];
-    frameView = 0;
+    frameView = nil;
 }
 
-- (void)resize: (NSSize)s
+- (void)resize:(NSSize)s
 {
     [self setScalesWhenResized: YES];
     [self setSize: s];
 }
 
-// require by protocol
-- (NSSize)size 
+// required by protocol -- apparently inherited methods don't count
+
+- (NSSize)size
 {
     return [super size];
 }
@@ -123,5 +124,4 @@
     [super drawInRect:dstRect fromRect:srcRect operation:op fraction:delta];
 }
 
-
 @end
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.m b/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.m
index 1ee45c7..091fbb3 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.m
+++ b/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.m
@@ -22,11 +22,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
-#import <Cocoa/Cocoa.h>
 
-#import <WebKit/IFImageRenderer.h>
 #import <WebKit/IFImageRendererFactory.h>
 
+#import <WebKit/IFImageRenderer.h>
+
 #import <WebKit/WebKitDebug.h>
 
 @implementation IFImageRendererFactory
@@ -59,8 +59,7 @@
 
 - (id <WebCoreImageRenderer>)imageRendererWithSize: (NSSize)s
 {
-    IFImageRenderer *imageRenderer = [[NSImage alloc] initWithSize: s];
-    return [imageRenderer autorelease];
+    return [[[IFImageRenderer alloc] initWithSize: s] autorelease];
 }
 
 
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
index 91a0e35..aedb361 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
@@ -1,9 +1,8 @@
-/*	IFAnimatedImage.h
+/*	IFImageRenderer.h
 	Copyright 2002, Apple, Inc. All rights reserved.
 */
 
 #import <Cocoa/Cocoa.h>
-
 #import <WebCoreImageRenderer.h>
 
 @interface IFImageRenderer : NSImage <WebCoreImageRenderer>
@@ -13,10 +12,4 @@
     NSRect imageRect;
     NSRect targetRect;
 }
-
-- (int)frameCount;
-- (int)currentFrame;
-- (void)setCurrentFrame:(int)frame;
-- (float)frameDuration;
-
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
index 501230d..26180db 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
@@ -4,49 +4,50 @@
 
 #import <WebKit/IFImageRenderer.h>
 
+#import <WebKit/WebKitDebug.h>
+
 @implementation IFImageRenderer
 
 - (void)dealloc
 {
     [self stopAnimation];
-    [frameTimer release];
-    [frameView release];
     [super dealloc];
 }
 
-- (int) frameCount {
-    NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
+- (id)firstRepProperty:(NSString *)propertyName
+{
+    id firstRep = [[self representations] objectAtIndex:0];
     id property = nil;
-    
-    if ([imageRep respondsToSelector: @selector(valueForProperty:)])
-        property = [imageRep valueForProperty:NSImageFrameCount];
+    if ([firstRep respondsToSelector:@selector(valueForProperty:)])
+        property = [firstRep valueForProperty:propertyName];
+    return property;
+}
+
+- (int)frameCount
+{
+    id property = [self firstRepProperty:NSImageFrameCount];
     return property != nil ? [property intValue] : 1;
 }
 
-- (int) currentFrame {
-    NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
-    id property = nil;
-    
-    if ([imageRep respondsToSelector: @selector(valueForProperty:)])
-        property = [imageRep valueForProperty:NSImageCurrentFrame];
+- (int)currentFrame
+{
+    id property = [self firstRepProperty:NSImageCurrentFrame];
     return property != nil ? [property intValue] : 1;
 }
 
-- (void) setCurrentFrame:(int)frame {
+- (void)setCurrentFrame:(int)frame
+{
     NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
-    [imageRep setProperty:NSImageCurrentFrame withValue: [NSNumber numberWithInt:frame]];
+    [imageRep setProperty:NSImageCurrentFrame withValue:[NSNumber numberWithInt:frame]];
 }
 
-- (float) frameDuration {
-    NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
-    id property = nil;
-    
-    if ([imageRep respondsToSelector: @selector(valueForProperty:)])
-        property = [imageRep valueForProperty:NSImageCurrentFrameDuration];
+- (float)frameDuration
+{
+    id property = [self firstRepProperty:NSImageCurrentFrameDuration];
     return property != nil ? [property floatValue] : 0.0;
 }
 
-- (void)timerFired: (id)context
+- (void)nextFrame:(id)context
 {
     int currentFrame = [self currentFrame];
     
@@ -54,45 +55,44 @@
     [frameTimer release];
     
     currentFrame++;
-    if (currentFrame >= [self frameCount]){
+    if (currentFrame >= [self frameCount]) {
         currentFrame = 0;
     }
-        
+    
     [self setCurrentFrame: currentFrame];
     
     if ([frameView canDraw]){
         [frameView lockFocus];
-        [self drawInRect: targetRect
-                fromRect: imageRect
-                operation: NSCompositeSourceOver	// Renders transparency correctly
-                fraction: 1.0];
+        [self drawInRect:targetRect
+                fromRect:imageRect
+               operation:NSCompositeSourceOver	// Renders transparency correctly
+                fraction:1.0];
         [frameView unlockFocus];
         [[frameView window] flushWindow];
     }
 
-    float frameDuration = [self frameDuration];
-    frameTimer = [[NSTimer scheduledTimerWithTimeInterval: frameDuration
-                target: self
-                selector: @selector(timerFired:)
-                userInfo: nil
-                repeats: NO] retain];
+    frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
+                                                   target:self
+                                                 selector:@selector(nextFrame:)
+                                                 userInfo:nil
+                                                  repeats:NO] retain];
 }
 
 - (void)beginAnimationInView: (NSView *)view inRect: (NSRect)ir fromRect: (NSRect)fr
 {
+    WEBKIT_ASSERT(frameView == nil);
+    
     [self stopAnimation];
     
-    if ([self frameCount] > 1){
-        float frameDuration = [self frameDuration];
-        
+    if ([self frameCount] > 1) {
         imageRect = fr;
         targetRect = ir;
         frameView = [view retain];
-        frameTimer = [[NSTimer scheduledTimerWithTimeInterval: frameDuration
-                    target: self
-                    selector: @selector(timerFired:)
-                    userInfo: nil
-                    repeats: NO] retain];
+        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
+                                                       target:self
+                                                     selector:@selector(nextFrame:)
+                                                     userInfo:nil
+                                                      repeats:NO] retain];
     }
 }
 
@@ -100,20 +100,21 @@
 {
     [frameTimer invalidate];
     [frameTimer release];
-    frameTimer = 0;
+    frameTimer = nil;
     
     [frameView release];
-    frameView = 0;
+    frameView = nil;
 }
 
-- (void)resize: (NSSize)s
+- (void)resize:(NSSize)s
 {
     [self setScalesWhenResized: YES];
     [self setSize: s];
 }
 
-// require by protocol
-- (NSSize)size 
+// required by protocol -- apparently inherited methods don't count
+
+- (NSSize)size
 {
     return [super size];
 }
@@ -123,5 +124,4 @@
     [super drawInRect:dstRect fromRect:srcRect operation:op fraction:delta];
 }
 
-
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.m b/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.m
index 1ee45c7..091fbb3 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.m
@@ -22,11 +22,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
-#import <Cocoa/Cocoa.h>
 
-#import <WebKit/IFImageRenderer.h>
 #import <WebKit/IFImageRendererFactory.h>
 
+#import <WebKit/IFImageRenderer.h>
+
 #import <WebKit/WebKitDebug.h>
 
 @implementation IFImageRendererFactory
@@ -59,8 +59,7 @@
 
 - (id <WebCoreImageRenderer>)imageRendererWithSize: (NSSize)s
 {
-    IFImageRenderer *imageRenderer = [[NSImage alloc] initWithSize: s];
-    return [imageRenderer autorelease];
+    return [[[IFImageRenderer alloc] initWithSize: s] autorelease];
 }
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list