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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:24:44 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8a89372bfa92584ca4e12281d4d1d4c291cad824
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 16 05:19:30 2002 +0000

            Removed dependence on window resize notification.  We now
            use the IFWebView setFrame: method to trigger layouts.  Much
            cleaner.
    
            Cleaned up image animation timer scheduler.
    
            Stop animation if last frame has zero duration, like IE.
    
            Change minimum duration to 1/30th (used if zero frame duration is
            specified).  This is closer to what I see in IE empirically.
    
            * WebCoreSupport.subproj/IFImageRenderer.h:
            * WebCoreSupport.subproj/IFImageRenderer.m:
            (-[IFImageRenderer frameDuration]):
            (-[IFImageRenderer _scheduleFrame]):
            (-[IFImageRenderer nextFrame:]):
            (-[IFImageRenderer beginAnimationInRect:fromRect:]):
            * WebView.subproj/IFHTMLView.mm:
            (-[IFHTMLView initWithFrame:]):
            (-[IFHTMLView removeNotifications]):
            * WebView.subproj/IFWebView.mm:
            (-[IFWebView setFrame:]):
            (-[IFWebView viewWillStartLiveResize]):
            (-[IFWebView viewDidEndLiveResize]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1569 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 949de80..308e302 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,30 @@
+2002-07-15  Richard Williamson (Home)  <rjw at apple.com>
+
+        Removed dependence on window resize notification.  We now
+        use the IFWebView setFrame: method to trigger layouts.  Much
+        cleaner.
+        
+        Cleaned up image animation timer scheduler.
+        
+        Stop animation if last frame has zero duration, like IE.
+        
+        Change minimum duration to 1/30th (used if zero frame duration is
+        specified).  This is closer to what I see in IE empirically.
+        
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRenderer.m:
+        (-[IFImageRenderer frameDuration]):
+        (-[IFImageRenderer _scheduleFrame]):
+        (-[IFImageRenderer nextFrame:]):
+        (-[IFImageRenderer beginAnimationInRect:fromRect:]):
+        * WebView.subproj/IFHTMLView.mm:
+        (-[IFHTMLView initWithFrame:]):
+        (-[IFHTMLView removeNotifications]):
+        * WebView.subproj/IFWebView.mm:
+        (-[IFWebView setFrame:]):
+        (-[IFWebView viewWillStartLiveResize]):
+        (-[IFWebView viewDidEndLiveResize]):
+
 2002-07-15  Maciej Stachowiak  <mjs at apple.com>
 
         Fixed Radar 2957209 - Change "JavaScript can open new windows
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 949de80..308e302 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,30 @@
+2002-07-15  Richard Williamson (Home)  <rjw at apple.com>
+
+        Removed dependence on window resize notification.  We now
+        use the IFWebView setFrame: method to trigger layouts.  Much
+        cleaner.
+        
+        Cleaned up image animation timer scheduler.
+        
+        Stop animation if last frame has zero duration, like IE.
+        
+        Change minimum duration to 1/30th (used if zero frame duration is
+        specified).  This is closer to what I see in IE empirically.
+        
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRenderer.m:
+        (-[IFImageRenderer frameDuration]):
+        (-[IFImageRenderer _scheduleFrame]):
+        (-[IFImageRenderer nextFrame:]):
+        (-[IFImageRenderer beginAnimationInRect:fromRect:]):
+        * WebView.subproj/IFHTMLView.mm:
+        (-[IFHTMLView initWithFrame:]):
+        (-[IFHTMLView removeNotifications]):
+        * WebView.subproj/IFWebView.mm:
+        (-[IFWebView setFrame:]):
+        (-[IFWebView viewWillStartLiveResize]):
+        (-[IFWebView viewDidEndLiveResize]):
+
 2002-07-15  Maciej Stachowiak  <mjs at apple.com>
 
         Fixed Radar 2957209 - Change "JavaScript can open new windows
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
index 4559b9d..209ed6e 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
@@ -14,6 +14,7 @@
     int loadStatus;
     NSColor *patternColor;
     int patternColorLoadStatus;
+    BOOL animationFinished;
 }
 
 + (void)stopAnimationsInView: (NSView *)aView;
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRenderer.m b/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
index b0cb231..3fd90d2 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
@@ -25,6 +25,7 @@ static NSMutableArray *activeImageRenderers;
     
 }
 
+
 - copyWithZone:(NSZone *)zone
 {
     IFImageRenderer *copy = [super copyWithZone:zone];
@@ -114,26 +115,44 @@ static NSMutableArray *activeImageRenderers;
     [imageRep setProperty:NSImageCurrentFrame withValue:[NSNumber numberWithInt:frame]];
 }
 
+#define MINIMUM_DURATON  (1.0/30.0)
+
 - (float)frameDuration
 {
     id property = [self firstRepProperty:NSImageCurrentFrameDuration];
     float duration = (property != nil ? [property floatValue] : 0.0);
-    if (duration < 0.0167){
+    if (duration < MINIMUM_DURATON){
         /*
             Many annoying ads specify a 0 duration to make an image flash
             as quickly as possible.  However a zero duration is faster than
             the refresh rate.  We need to pick a minimum duration.
             
             Browsers handle the minimum time case differently.  IE seems to use something
-            close to 1/60th of a second.  Konqueror uses 0.  The ImageMagick library
+            close to 1/30th of a second.  Konqueror uses 0.  The ImageMagick library
             uses 1/100th.  The units in the GIF specification are 1/100th of second.
-            We will use 1/60th of second as the minimum time.
+            We will use 1/30th of second as the minimum time.
         */
-        duration = .0167;
+        duration = MINIMUM_DURATON;
     }
     return duration;
 }
 
+- (void)_scheduleFrame
+{   
+    if (!animationFinished){
+        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
+                                                    target:self
+                                                    selector:@selector(nextFrame:)
+                                                    userInfo:nil
+                                                    repeats:NO] retain];
+        if (!activeImageRenderers)
+            activeImageRenderers = [[NSMutableArray alloc] init];
+            
+        [activeImageRenderers addObject: self];
+    }
+}
+
+
 - (void)nextFrame:(id)context
 {
     int currentFrame;
@@ -145,7 +164,13 @@ static NSMutableArray *activeImageRenderers;
     
     currentFrame = [self currentFrame] + 1;
     if (currentFrame >= [self frameCount]) {
-        currentFrame = 0;
+        if ([self frameDuration] == 0) {
+            animationFinished = YES;	// Don't repeat if the last frame has a duration of 0.  
+                                // IE doesn't repeat, so we don't.
+            return;
+        }
+        else
+            currentFrame = 0;
     }
     [self setCurrentFrame:currentFrame];
     
@@ -162,13 +187,11 @@ static NSMutableArray *activeImageRenderers;
                     fraction:1.0];
             [frameView unlockFocus];
         }
-    
-        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
-                                                    target:self
-                                                    selector:@selector(nextFrame:)
-                                                    userInfo:nil
-                                                    repeats:NO] retain];
+        [self _scheduleFrame];
     } else {
+        // No need to schedule the next frame in this case.  The display
+        // will eventually cause the image to be redrawn and the next frame
+        // will be scheduled in beginAnimationInRect:fromRect:
         [frameView displayRect:targetRect];
     }
     
@@ -179,26 +202,18 @@ static NSMutableArray *activeImageRenderers;
 {
     // The previous, if any, frameView, is released in stopAnimation.
     [self stopAnimation];
-    
-    if ([self frameCount] > 1) {
-        imageRect = fr;
-        targetRect = ir;
-        frameView = [[NSView focusView] retain];
-        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
-                                                       target:self
-                                                     selector:@selector(nextFrame:)
-                                                     userInfo:nil
-                                                      repeats:NO] retain];
-        if (!activeImageRenderers)
-            activeImageRenderers = [[NSMutableArray alloc] init];
-            
-        [activeImageRenderers addObject: self];
-    }
 
     [self drawInRect: ir
             fromRect: fr
            operation: NSCompositeSourceOver	// Renders transparency correctly
             fraction: 1.0];
+    
+    if ([self frameCount] > 1 && animationFinished != YES) {
+        imageRect = fr;
+        targetRect = ir;
+        frameView = [[NSView focusView] retain];
+        [self _scheduleFrame];
+    }
 }
 
 - (void)stopAnimation
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
index 4559b9d..209ed6e 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
@@ -14,6 +14,7 @@
     int loadStatus;
     NSColor *patternColor;
     int patternColorLoadStatus;
+    BOOL animationFinished;
 }
 
 + (void)stopAnimationsInView: (NSView *)aView;
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
index b0cb231..3fd90d2 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
@@ -25,6 +25,7 @@ static NSMutableArray *activeImageRenderers;
     
 }
 
+
 - copyWithZone:(NSZone *)zone
 {
     IFImageRenderer *copy = [super copyWithZone:zone];
@@ -114,26 +115,44 @@ static NSMutableArray *activeImageRenderers;
     [imageRep setProperty:NSImageCurrentFrame withValue:[NSNumber numberWithInt:frame]];
 }
 
+#define MINIMUM_DURATON  (1.0/30.0)
+
 - (float)frameDuration
 {
     id property = [self firstRepProperty:NSImageCurrentFrameDuration];
     float duration = (property != nil ? [property floatValue] : 0.0);
-    if (duration < 0.0167){
+    if (duration < MINIMUM_DURATON){
         /*
             Many annoying ads specify a 0 duration to make an image flash
             as quickly as possible.  However a zero duration is faster than
             the refresh rate.  We need to pick a minimum duration.
             
             Browsers handle the minimum time case differently.  IE seems to use something
-            close to 1/60th of a second.  Konqueror uses 0.  The ImageMagick library
+            close to 1/30th of a second.  Konqueror uses 0.  The ImageMagick library
             uses 1/100th.  The units in the GIF specification are 1/100th of second.
-            We will use 1/60th of second as the minimum time.
+            We will use 1/30th of second as the minimum time.
         */
-        duration = .0167;
+        duration = MINIMUM_DURATON;
     }
     return duration;
 }
 
+- (void)_scheduleFrame
+{   
+    if (!animationFinished){
+        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
+                                                    target:self
+                                                    selector:@selector(nextFrame:)
+                                                    userInfo:nil
+                                                    repeats:NO] retain];
+        if (!activeImageRenderers)
+            activeImageRenderers = [[NSMutableArray alloc] init];
+            
+        [activeImageRenderers addObject: self];
+    }
+}
+
+
 - (void)nextFrame:(id)context
 {
     int currentFrame;
@@ -145,7 +164,13 @@ static NSMutableArray *activeImageRenderers;
     
     currentFrame = [self currentFrame] + 1;
     if (currentFrame >= [self frameCount]) {
-        currentFrame = 0;
+        if ([self frameDuration] == 0) {
+            animationFinished = YES;	// Don't repeat if the last frame has a duration of 0.  
+                                // IE doesn't repeat, so we don't.
+            return;
+        }
+        else
+            currentFrame = 0;
     }
     [self setCurrentFrame:currentFrame];
     
@@ -162,13 +187,11 @@ static NSMutableArray *activeImageRenderers;
                     fraction:1.0];
             [frameView unlockFocus];
         }
-    
-        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
-                                                    target:self
-                                                    selector:@selector(nextFrame:)
-                                                    userInfo:nil
-                                                    repeats:NO] retain];
+        [self _scheduleFrame];
     } else {
+        // No need to schedule the next frame in this case.  The display
+        // will eventually cause the image to be redrawn and the next frame
+        // will be scheduled in beginAnimationInRect:fromRect:
         [frameView displayRect:targetRect];
     }
     
@@ -179,26 +202,18 @@ static NSMutableArray *activeImageRenderers;
 {
     // The previous, if any, frameView, is released in stopAnimation.
     [self stopAnimation];
-    
-    if ([self frameCount] > 1) {
-        imageRect = fr;
-        targetRect = ir;
-        frameView = [[NSView focusView] retain];
-        frameTimer = [[NSTimer scheduledTimerWithTimeInterval:[self frameDuration]
-                                                       target:self
-                                                     selector:@selector(nextFrame:)
-                                                     userInfo:nil
-                                                      repeats:NO] retain];
-        if (!activeImageRenderers)
-            activeImageRenderers = [[NSMutableArray alloc] init];
-            
-        [activeImageRenderers addObject: self];
-    }
 
     [self drawInRect: ir
             fromRect: fr
            operation: NSCompositeSourceOver	// Renders transparency correctly
             fraction: 1.0];
+    
+    if ([self frameCount] > 1 && animationFinished != YES) {
+        imageRect = fr;
+        targetRect = ir;
+        frameView = [[NSView focusView] retain];
+        [self _scheduleFrame];
+    }
 }
 
 - (void)stopAnimation
diff --git a/WebKit/WebView.subproj/IFHTMLView.mm b/WebKit/WebView.subproj/IFHTMLView.mm
index 787c7b8..37bd00d 100644
--- a/WebKit/WebView.subproj/IFHTMLView.mm
+++ b/WebKit/WebView.subproj/IFHTMLView.mm
@@ -41,12 +41,9 @@
     // when the window becomes/resigns main.
     [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(mouseMovedNotification:) name: NSMouseMovedNotification object: nil];
 
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResized:) name: NSWindowDidResizeNotification object: nil];
-
     return self;
 }
 
-
 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item 
 {
     SEL action = [item action];
@@ -94,7 +91,6 @@
     [[NSNotificationCenter defaultCenter] removeObserver: self name: NSMouseMovedNotification object: nil];
     [[NSNotificationCenter defaultCenter] removeObserver: self name: NSWindowDidResignMainNotification object: nil];
     [[NSNotificationCenter defaultCenter] removeObserver: self name: NSWindowDidResignMainNotification object: nil];
-    [[NSNotificationCenter defaultCenter] removeObserver: self name: NSWindowDidResizeNotification object: nil];
 }
 
 
@@ -337,16 +333,6 @@
 }
 
 
-- (void)windowResized: (NSNotification *)notification
-{
-    // FIXME: This is a hack. We should relayout when the width of our
-    // superview's bounds changes, not when the window is resized.
-    if ([notification object] == [self window]) {
-        [self setNeedsLayout: YES];
-    }
-}
-
-
 - (void)windowDidBecomeMain: (NSNotification *)notification
 {
     if ([notification object] == [self window])
diff --git a/WebKit/WebView.subproj/IFWebView.mm b/WebKit/WebView.subproj/IFWebView.mm
index d875b8c..1ac1d04 100644
--- a/WebKit/WebView.subproj/IFWebView.mm
+++ b/WebKit/WebView.subproj/IFWebView.mm
@@ -15,6 +15,7 @@
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFWebKitErrors.h>
 #import <WebKit/IFTextRendererFactory.h>
+#import <WebKit/IFImageRenderer.h>
 #import <WebKit/IFImageRendererFactory.h>
 #import <WebKit/IFCookieAdapter.h>
 
@@ -79,6 +80,23 @@ enum {
     [super dealloc];
 }
 
+- (void)setFrame: (NSRect)f
+{
+    if ([self isDocumentHTML] && !NSEqualRects(f, [self frame]))
+        [(IFHTMLView *)[self documentView] setNeedsLayout: YES];
+    [super setFrame: f];
+}
+
+
+- (void)viewWillStartLiveResize
+{
+}
+
+- (void)viewDidEndLiveResize
+{
+    [self display];
+}
+
 - (void)setAllowsScrolling: (BOOL)flag
 {
     [[self frameScrollView] setAllowsScrolling: flag];
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index d875b8c..1ac1d04 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -15,6 +15,7 @@
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFWebKitErrors.h>
 #import <WebKit/IFTextRendererFactory.h>
+#import <WebKit/IFImageRenderer.h>
 #import <WebKit/IFImageRendererFactory.h>
 #import <WebKit/IFCookieAdapter.h>
 
@@ -79,6 +80,23 @@ enum {
     [super dealloc];
 }
 
+- (void)setFrame: (NSRect)f
+{
+    if ([self isDocumentHTML] && !NSEqualRects(f, [self frame]))
+        [(IFHTMLView *)[self documentView] setNeedsLayout: YES];
+    [super setFrame: f];
+}
+
+
+- (void)viewWillStartLiveResize
+{
+}
+
+- (void)viewDidEndLiveResize
+{
+    [self display];
+}
+
 - (void)setAllowsScrolling: (BOOL)flag
 {
     [[self frameScrollView] setAllowsScrolling: flag];
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 787c7b8..37bd00d 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -41,12 +41,9 @@
     // when the window becomes/resigns main.
     [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(mouseMovedNotification:) name: NSMouseMovedNotification object: nil];
 
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResized:) name: NSWindowDidResizeNotification object: nil];
-
     return self;
 }
 
-
 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item 
 {
     SEL action = [item action];
@@ -94,7 +91,6 @@
     [[NSNotificationCenter defaultCenter] removeObserver: self name: NSMouseMovedNotification object: nil];
     [[NSNotificationCenter defaultCenter] removeObserver: self name: NSWindowDidResignMainNotification object: nil];
     [[NSNotificationCenter defaultCenter] removeObserver: self name: NSWindowDidResignMainNotification object: nil];
-    [[NSNotificationCenter defaultCenter] removeObserver: self name: NSWindowDidResizeNotification object: nil];
 }
 
 
@@ -337,16 +333,6 @@
 }
 
 
-- (void)windowResized: (NSNotification *)notification
-{
-    // FIXME: This is a hack. We should relayout when the width of our
-    // superview's bounds changes, not when the window is resized.
-    if ([notification object] == [self window]) {
-        [self setNeedsLayout: YES];
-    }
-}
-
-
 - (void)windowDidBecomeMain: (NSNotification *)notification
 {
     if ([notification object] == [self window])

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list