Changeset 153396 in webkit


Ignore:
Timestamp:
Jul 26, 2013 5:57:31 PM (11 years ago)
Author:
dino@apple.com
Message:

Allow new transitions to run even when controller is suspended
https://bugs.webkit.org/show_bug.cgi?id=119171
<rdar://problem/14511404>

Reviewed by Simon Fraser.

Source/WebCore:

Expose a new property on AnimationController that allows newly created
animations to run even if the controller says it is suspended. See WebKit
ChangeLog for more details.

Test: transitions/created-while-suspended.html

  • WebCore.exp.in: Export the new methods so WebView can use them.
  • page/animation/AnimationController.cpp:

(WebCore::AnimationControllerPrivate::AnimationControllerPrivate): Initialize new flag to false.
(WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended): Check new flag is not true.
(WebCore::AnimationControllerPrivate::setAllowsNewAnimationsWhileSuspended): Expose setter.
(WebCore::AnimationController::allowsNewAnimationsWhileSuspended): "Public" getter.
(WebCore::AnimationController::setAllowsNewAnimationsWhileSuspended): "Public" setter.

  • page/animation/AnimationController.h:
  • page/animation/AnimationControllerPrivate.h:

(WebCore::AnimationControllerPrivate::allowsNewAnimationsWhileSuspended):

  • page/animation/CompositeAnimation.cpp:

(WebCore::CompositeAnimation::CompositeAnimation): Only suspend if new flag is false. Everything else
relies on the m_suspended flag, so the real code change is this one line.

Source/WebKit/mac:

Expose a new SPI on WebView that triggers the (buggy) old behaviour
for animations, such that any newly created animations will start even
when the document is supposedly suspended. It turns out that client content was
unknowingly relying on this behaviour - e.g. suspending a view, loading a
bunch of new content, bringing the view on screen and then unsuspending. In this
situation, we were not running CSS transitions, because the page was suspended.
However, JS was still triggering them, and content was expecting a transitionEnd event.

  • WebView/WebView.mm:

(-[WebView allowsNewCSSAnimationsWhileSuspended]): Calls into AnimationController.
(-[WebView setAllowsNewCSSAnimationsWhileSuspended:]): Ditto.

  • WebView/WebViewPrivate.h: New methods listed above.

LayoutTests:

This is actually a test to make sure this fix didn't break anything. There is no
way to trigger the new behaviour from the test system (or from Safari).

Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r153386 r153396  
     12013-07-26  Dean Jackson  <dino@apple.com>
     2
     3        Allow new transitions to run even when controller is suspended
     4        https://bugs.webkit.org/show_bug.cgi?id=119171
     5        <rdar://problem/14511404>
     6
     7        Reviewed by Simon Fraser.
     8
     9        This is actually a test to make sure this fix didn't break anything. There is no
     10        way to trigger the new behaviour from the test system (or from Safari).
     11
    1122013-07-26  Bem Jones-Bey  <bjonesbe@adobe.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r153384 r153396  
     12013-07-26  Dean Jackson  <dino@apple.com>
     2
     3        Allow new transitions to run even when controller is suspended
     4        https://bugs.webkit.org/show_bug.cgi?id=119171
     5        <rdar://problem/14511404>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Expose a new property on AnimationController that allows newly created
     10        animations to run even if the controller says it is suspended. See WebKit
     11        ChangeLog for more details.
     12
     13        Test: transitions/created-while-suspended.html
     14
     15        * WebCore.exp.in: Export the new methods so WebView can use them.
     16        * page/animation/AnimationController.cpp:
     17        (WebCore::AnimationControllerPrivate::AnimationControllerPrivate): Initialize new flag to false.
     18        (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended): Check new flag is not true.
     19        (WebCore::AnimationControllerPrivate::setAllowsNewAnimationsWhileSuspended): Expose setter.
     20        (WebCore::AnimationController::allowsNewAnimationsWhileSuspended): "Public" getter.
     21        (WebCore::AnimationController::setAllowsNewAnimationsWhileSuspended): "Public" setter.
     22        * page/animation/AnimationController.h:
     23        * page/animation/AnimationControllerPrivate.h:
     24        (WebCore::AnimationControllerPrivate::allowsNewAnimationsWhileSuspended):
     25        * page/animation/CompositeAnimation.cpp:
     26        (WebCore::CompositeAnimation::CompositeAnimation): Only suspend if new flag is false. Everything else
     27        relies on the m_suspended flag, so the real code change is this one line.
     28
    1292013-07-26  Brent Fulgham  <bfulgham@apple.com>
    230
  • trunk/Source/WebCore/WebCore.exp.in

    r153380 r153396  
    623623__ZN7WebCore19AnimationController20pauseAnimationAtTimeEPNS_12RenderObjectERKN3WTF12AtomicStringEd
    624624__ZN7WebCore19AnimationController21pauseTransitionAtTimeEPNS_12RenderObjectERKN3WTF6StringEd
     625__ZN7WebCore19AnimationController36setAllowsNewAnimationsWhileSuspendedEb
     626__ZNK7WebCore19AnimationController33allowsNewAnimationsWhileSuspendedEv
    625627__ZN7WebCore19BackForwardListImpl10removeItemEPNS_11HistoryItemE
    626628__ZN7WebCore19BackForwardListImpl10setEnabledEb
  • trunk/Source/WebCore/page/animation/AnimationController.cpp

    r151218 r153396  
    6060    , m_waitingForAsyncStartNotification(false)
    6161    , m_isSuspended(false)
     62    , m_allowsNewAnimationsWhileSuspended(false)
    6263{
    6364}
     
    323324void AnimationControllerPrivate::startAnimationsIfNotSuspended(Document* document)
    324325{
    325     if (!isSuspended())
     326    if (!isSuspended() || allowsNewAnimationsWhileSuspended())
    326327        resumeAnimationsForDocument(document);
     328}
     329
     330void AnimationControllerPrivate::setAllowsNewAnimationsWhileSuspended(bool allowed)
     331{
     332    m_allowsNewAnimationsWhileSuspended = allowed;
    327333}
    328334
     
    604610}
    605611
     612bool AnimationController::allowsNewAnimationsWhileSuspended() const
     613{
     614    return m_data->allowsNewAnimationsWhileSuspended();
     615}
     616
     617void AnimationController::setAllowsNewAnimationsWhileSuspended(bool allowed)
     618{
     619    m_data->setAllowsNewAnimationsWhileSuspended(allowed);
     620}
     621
    606622#if ENABLE(REQUEST_ANIMATION_FRAME)
    607623void AnimationController::serviceAnimations()
  • trunk/Source/WebCore/page/animation/AnimationController.h

    r149576 r153396  
    7777    void beginAnimationUpdate();
    7878    void endAnimationUpdate();
     79
     80    bool allowsNewAnimationsWhileSuspended() const;
     81    void setAllowsNewAnimationsWhileSuspended(bool);
    7982   
    8083    static bool supportsAcceleratedAnimationOfProperty(CSSPropertyID);
  • trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h

    r151218 r153396  
    110110
    111111    void updateAnimationTimerForRenderer(RenderObject*);
    112    
     112
     113    bool allowsNewAnimationsWhileSuspended() const { return m_allowsNewAnimationsWhileSuspended; }
     114    void setAllowsNewAnimationsWhileSuspended(bool);
     115
    113116private:
    114117    void animationTimerFired(Timer<AnimationControllerPrivate>*);
     
    143146    bool m_waitingForAsyncStartNotification;
    144147    bool m_isSuspended;
     148
     149    // Used to flag whether we should revert to previous buggy
     150    // behavior of allowing new transitions and animations to
     151    // run even when this object is suspended.
     152    bool m_allowsNewAnimationsWhileSuspended;
    145153};
    146154
  • trunk/Source/WebCore/page/animation/CompositeAnimation.cpp

    r149665 r153396  
    4545    : m_animationController(animationController)
    4646{
    47     m_suspended = animationController->isSuspended();
     47    m_suspended = animationController->isSuspended() && !animationController->allowsNewAnimationsWhileSuspended();
    4848}
    4949
  • trunk/Source/WebKit/mac/ChangeLog

    r153379 r153396  
     12013-07-26  Dean Jackson  <dino@apple.com>
     2
     3        Allow new transitions to run even when controller is suspended
     4        https://bugs.webkit.org/show_bug.cgi?id=119171
     5        <rdar://problem/14511404>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Expose a new SPI on WebView that triggers the (buggy) old behaviour
     10        for animations, such that any newly created animations will start even
     11        when the document is supposedly suspended. It turns out that client content was
     12        unknowingly relying on this behaviour - e.g. suspending a view, loading a
     13        bunch of new content, bringing the view on screen and then unsuspending. In this
     14        situation, we were not running CSS transitions, because the page was suspended.
     15        However, JS was still triggering them, and content was expecting a transitionEnd event.
     16
     17        * WebView/WebView.mm:
     18        (-[WebView allowsNewCSSAnimationsWhileSuspended]): Calls into AnimationController.
     19        (-[WebView setAllowsNewCSSAnimationsWhileSuspended:]): Ditto.
     20        * WebView/WebViewPrivate.h: New methods listed above.
     21
    1222013-07-26  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r152763 r153396  
    27912791}
    27922792
     2793- (BOOL)allowsNewCSSAnimationsWhileSuspended
     2794{
     2795    Frame* frame = core([self mainFrame]);
     2796    if (frame)
     2797        return frame->animation()->allowsNewAnimationsWhileSuspended();
     2798
     2799    return false;
     2800}
     2801
     2802- (void)setAllowsNewCSSAnimationsWhileSuspended:(BOOL)allowed
     2803{
     2804    Frame* frame = core([self mainFrame]);
     2805    if (frame)
     2806        frame->animation()->setAllowsNewAnimationsWhileSuspended(allowed);
     2807}
     2808
    27932809- (BOOL)cssAnimationsSuspended
    27942810{
  • trunk/Source/WebKit/mac/WebView/WebViewPrivate.h

    r152579 r153396  
    565565- (void)setCSSAnimationsSuspended:(BOOL)suspended;
    566566
     567/*
     568    SPI to revert back to buggy behavior that would allow new transitions
     569    and animations to run even when the view is suspended (e.g. loading a
     570    new document).
     571*/
     572- (BOOL)allowsNewCSSAnimationsWhileSuspended;
     573- (void)setAllowsNewCSSAnimationsWhileSuspended:(BOOL)allowed;
     574
    567575+ (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme;
    568576+ (void)_registerURLSchemeAsSecure:(NSString *)scheme;
Note: See TracChangeset for help on using the changeset viewer.