Changeset 70737 in webkit


Ignore:
Timestamp:
Oct 27, 2010 6:44:58 PM (13 years ago)
Author:
andersca@apple.com
Message:

Find indicators do not bounce
https://bugs.webkit.org/show_bug.cgi?id=48490
<rdar://problem/8564276>

Reviewed by Sam Weinig.

WebKit2:

  • UIProcess/API/mac/FindIndicatorWindow.h:
  • UIProcess/API/mac/FindIndicatorWindow.mm:

(-[WebFindIndicatorWindowAnimation _initWithFindIndicatorWindow:WebKit::animationDuration:animationProgressCallback:WebKit::FindIndicatorWindow::animationDidEndCallback:WebKit::FindIndicatorWindow::]):
Add an animationDuration parameter.

(WebKit::FindIndicatorWindow::FindIndicatorWindow):
Initialize m_bounceAnimationContext.

(WebKit::FindIndicatorWindow::setFindIndicator):
Create a bounce animation and start it.

(WebKit::FindIndicatorWindow::closeWindow):
Stop the bounce animation and destroy the bounce animation context.

(WebKit::FindIndicatorWindow::startFadeOutTimerFired):
pass the fade out duration.

(WebKit::FindIndicatorWindow::bounceAnimationCallback):
Set the bounce animation progress.

(WebKit::FindIndicatorWindow::bounceAnimationDidEnd):
Destroy the bounce animation context.

WebKitLibraries:

Add bounce animation context functions.

  • WebKitSystemInterface.h:
  • libWebKitSystemInterfaceLeopard.a:
  • libWebKitSystemInterfaceSnowLeopard.a:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r70734 r70737  
     12010-10-27  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Find indicators do not bounce
     6        https://bugs.webkit.org/show_bug.cgi?id=48490
     7        <rdar://problem/8564276>
     8
     9        * UIProcess/API/mac/FindIndicatorWindow.h:
     10        * UIProcess/API/mac/FindIndicatorWindow.mm:
     11        (-[WebFindIndicatorWindowAnimation _initWithFindIndicatorWindow:WebKit::animationDuration:animationProgressCallback:WebKit::FindIndicatorWindow::animationDidEndCallback:WebKit::FindIndicatorWindow::]):
     12        Add an animationDuration parameter.
     13       
     14        (WebKit::FindIndicatorWindow::FindIndicatorWindow):
     15        Initialize m_bounceAnimationContext.
     16
     17        (WebKit::FindIndicatorWindow::setFindIndicator):
     18        Create a bounce animation and start it.
     19
     20        (WebKit::FindIndicatorWindow::closeWindow):
     21        Stop the bounce animation and destroy the bounce animation context.
     22
     23        (WebKit::FindIndicatorWindow::startFadeOutTimerFired):
     24        pass the fade out duration.
     25
     26        (WebKit::FindIndicatorWindow::bounceAnimationCallback):
     27        Set the bounce animation progress.
     28
     29        (WebKit::FindIndicatorWindow::bounceAnimationDidEnd):
     30        Destroy the bounce animation context.
     31
    1322010-10-27  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    233
  • trunk/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h

    r69895 r70737  
    3232#import <wtf/RetainPtr.h>
    3333#import "RunLoop.h"
     34#import "WebKitSystemInterface.h"
    3435
    3536@class WKView;
     
    5859    void fadeOutAnimationDidEnd();
    5960
     61    void bounceAnimationCallback(double);
     62    void bounceAnimationDidEnd();
     63
    6064    WKView* m_wkView;
    6165    RefPtr<FindIndicator> m_findIndicator;
    6266    RetainPtr<NSWindow> m_findIndicatorWindow;
     67
     68    WKWindowBounceAnimationContextRef m_bounceAnimationContext;
     69    RetainPtr<WebFindIndicatorWindowAnimation> m_bounceAnimation;
    6370
    6471    RunLoop::Timer<FindIndicatorWindow> m_startFadeOutTimer;
  • trunk/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm

    r70001 r70737  
    2929#include <WebCore/GraphicsContext.h>
    3030
    31 static const double pulseAnimationDuration = 0.12;
    32 static const double timeBeforeFadeStarts = pulseAnimationDuration + 0.2;
     31static const double bounceAnimationDuration = 0.12;
     32static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
    3333static const double fadeOutAnimationDuration = 0.3;
    3434
     
    7373
    7474- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow
    75                  animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
    76                    animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback;
     75                 animationDuration:(CFTimeInterval)duration
     76         animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
     77           animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback;
    7778@end
    7879
     
    8081
    8182- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow
     83                 animationDuration:(CFTimeInterval)animationDuration
    8284         animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
    8385           animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback
    8486{
    85     if ((self = [super initWithDuration:fadeOutAnimationDuration animationCurve:NSAnimationEaseInOut])) {
     87    if ((self = [super initWithDuration:animationDuration animationCurve:NSAnimationEaseInOut])) {
    8688        _findIndicatorWindow = findIndicatorWindow;
    8789        _animationProgressCallback = animationProgressCallback;
     
    116118FindIndicatorWindow::FindIndicatorWindow(WKView *wkView)
    117119    : m_wkView(wkView)
     120    , m_bounceAnimationContext(0)
    118121    , m_startFadeOutTimer(RunLoop::main(), this, &FindIndicatorWindow::startFadeOutTimerFired)
    119122{
     
    159162    [m_findIndicatorWindow.get() setReleasedWhenClosed:NO];
    160163
     164    // Start the bounce animation.
     165    m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
     166    m_bounceAnimation.adoptNS([[WebFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
     167                                                                                  animationDuration:bounceAnimationDuration
     168                                                                          animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
     169                                                                            animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
     170    [m_bounceAnimation.get() startAnimation];
     171
    161172    if (fadeOut)
    162173        m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);
     
    175186    }
    176187
     188    if (m_bounceAnimation) {
     189        [m_bounceAnimation.get() stopAnimation];
     190        m_bounceAnimation = nullptr;
     191    }
     192
     193    if (m_bounceAnimationContext)
     194        WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
     195   
    177196    [[m_findIndicatorWindow.get() parentWindow] removeChildWindow:m_findIndicatorWindow.get()];
    178197    [m_findIndicatorWindow.get() close];
     
    184203    ASSERT(!m_fadeOutAnimation);
    185204   
    186     m_fadeOutAnimation.adoptNS([[WebFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
     205    m_fadeOutAnimation.adoptNS([[WebFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
     206                                                                                   animationDuration:fadeOutAnimationDuration
    187207                                                                           animationProgressCallback:&FindIndicatorWindow::fadeOutAnimationCallback
    188208                                                                             animationDidEndCallback:&FindIndicatorWindow::fadeOutAnimationDidEnd]);
     
    205225}
    206226
     227void FindIndicatorWindow::bounceAnimationCallback(double progress)
     228{
     229    ASSERT(m_bounceAnimation);
     230    ASSERT(m_bounceAnimationContext);
     231
     232    WKWindowBounceAnimationSetAnimationProgress(m_bounceAnimationContext, progress);
     233}
     234
     235void FindIndicatorWindow::bounceAnimationDidEnd()
     236{
     237    ASSERT(m_bounceAnimation);
     238    ASSERT(m_bounceAnimationContext);
     239    ASSERT(m_findIndicatorWindow);
     240
     241    WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
     242    m_bounceAnimationContext = 0;
     243}
     244
    207245} // namespace WebKit
  • trunk/WebKitLibraries/ChangeLog

    r70539 r70737  
     12010-10-27  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Find indicators do not bounce
     6        https://bugs.webkit.org/show_bug.cgi?id=48490
     7        <rdar://problem/8564276>
     8
     9        Add bounce animation context functions.
     10
     11        * WebKitSystemInterface.h:
     12        * libWebKitSystemInterfaceLeopard.a:
     13        * libWebKitSystemInterfaceSnowLeopard.a:
     14
    1152010-10-26  Adam Roben  <aroben@apple.com>
    216
  • trunk/WebKitLibraries/WebKitSystemInterface.h

    r70400 r70737  
    291291CALayer *WKCARemoteLayerClientGetLayer(WKCARemoteLayerClientRef);
    292292
     293typedef struct __WKWindowBounceAnimationContext *WKWindowBounceAnimationContextRef;
     294
     295WKWindowBounceAnimationContextRef WKWindowBounceAnimationContextCreate(NSWindow *window);
     296void WKWindowBounceAnimationContextDestroy(WKWindowBounceAnimationContextRef context);
     297void WKWindowBounceAnimationSetAnimationProgress(WKWindowBounceAnimationContextRef context, double animationProgress);
     298
    293299#if defined(__x86_64__)
    294300#import <mach/mig.h>
Note: See TracChangeset for help on using the changeset viewer.