Changeset 116786 in webkit


Ignore:
Timestamp:
May 11, 2012 11:04:15 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Ensure that animations continue to run when transform-style is changed
https://bugs.webkit.org/show_bug.cgi?id=83283

Source/WebCore:

Make sure that we transfer animations when changing layers due to a transform-style change.
Unit tested in GraphicsLayerChromiumTest.updateLayerPreserves3DWithAnimations

Patch by Ian Vollick <vollick@chromium.org> on 2012-05-11
Reviewed by James Robinson.

Test: animations/change-transform-style-during-animation.html

  • platform/graphics/chromium/GraphicsLayerChromium.cpp:

(WebCore::GraphicsLayerChromium::updateLayerPreserves3D):

  • platform/graphics/chromium/LayerChromium.cpp:

(WebCore::LayerChromium::setLayerAnimationController):
(WebCore::LayerChromium::releaseLayerAnimationController):
(WebCore):
(WebCore::LayerChromium::notifyAnimationStarted):

  • platform/graphics/chromium/LayerChromium.h:

(LayerChromium):

  • platform/graphics/chromium/cc/CCLayerAnimationController.cpp:

(WebCore::CCLayerAnimationController::CCLayerAnimationController):
(WebCore::CCLayerAnimationController::pushAnimationUpdatesTo):
(WebCore::CCLayerAnimationController::notifyAnimationStarted):
(WebCore::CCLayerAnimationController::setClient):
(WebCore):
(WebCore::CCLayerAnimationController::pushNewAnimationsToImplThread):
(WebCore::CCLayerAnimationController::replaceImplThreadAnimations):

  • platform/graphics/chromium/cc/CCLayerAnimationController.h:

(CCLayerAnimationController):
(WebCore::CCLayerAnimationController::setForceSync):

Source/WebKit/chromium:

Patch by Ian Vollick <vollick@chromium.org> on 2012-05-11
Reviewed by James Robinson.

  • WebKit.gypi:
  • tests/GraphicsLayerChromiumTest.cpp: Added.

(WebKitTests):
(MockGraphicsLayerClient):
(WebKitTests::MockGraphicsLayerClient::notifyAnimationStarted):
(WebKitTests::MockGraphicsLayerClient::notifySyncRequired):
(WebKitTests::MockGraphicsLayerClient::paintContents):
(WebKitTests::MockGraphicsLayerClient::showDebugBorders):
(WebKitTests::MockGraphicsLayerClient::showRepaintCounter):
(WebKitTests::TEST):

LayoutTests:

Patch by Ian Vollick <vollick@chromium.org> on 2012-05-11
Reviewed by James Robinson.

  • animations/change-transform-style-during-animation-expected.png: Added.
  • animations/change-transform-style-during-animation-expected.txt: Added.
  • animations/change-transform-style-during-animation.html: Added.
Location:
trunk
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116784 r116786  
     12012-05-11  Ian Vollick  <vollick@chromium.org>
     2
     3        [chromium] Ensure that animations continue to run when transform-style is changed
     4        https://bugs.webkit.org/show_bug.cgi?id=83283
     5
     6        Reviewed by James Robinson.
     7
     8        * animations/change-transform-style-during-animation-expected.png: Added.
     9        * animations/change-transform-style-during-animation-expected.txt: Added.
     10        * animations/change-transform-style-during-animation.html: Added.
     11
    1122012-05-11  Dave Tharp  <dtharp@codeaurora.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r116783 r116786  
     12012-05-11  Ian Vollick  <vollick@chromium.org>
     2
     3        [chromium] Ensure that animations continue to run when transform-style is changed
     4        https://bugs.webkit.org/show_bug.cgi?id=83283
     5
     6        Make sure that we transfer animations when changing layers due to a transform-style change.
     7        Unit tested in GraphicsLayerChromiumTest.updateLayerPreserves3DWithAnimations
     8
     9        Reviewed by James Robinson.
     10
     11        Test: animations/change-transform-style-during-animation.html
     12
     13        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
     14        (WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
     15        * platform/graphics/chromium/LayerChromium.cpp:
     16        (WebCore::LayerChromium::setLayerAnimationController):
     17        (WebCore::LayerChromium::releaseLayerAnimationController):
     18        (WebCore):
     19        (WebCore::LayerChromium::notifyAnimationStarted):
     20        * platform/graphics/chromium/LayerChromium.h:
     21        (LayerChromium):
     22        * platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
     23        (WebCore::CCLayerAnimationController::CCLayerAnimationController):
     24        (WebCore::CCLayerAnimationController::pushAnimationUpdatesTo):
     25        (WebCore::CCLayerAnimationController::notifyAnimationStarted):
     26        (WebCore::CCLayerAnimationController::setClient):
     27        (WebCore):
     28        (WebCore::CCLayerAnimationController::pushNewAnimationsToImplThread):
     29        (WebCore::CCLayerAnimationController::replaceImplThreadAnimations):
     30        * platform/graphics/chromium/cc/CCLayerAnimationController.h:
     31        (CCLayerAnimationController):
     32        (WebCore::CCLayerAnimationController::setForceSync):
     33
    1342012-05-11  Tommy Widenflycht  <tommyw@google.com>
    235
  • trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp

    r116456 r116786  
    608608        m_transformLayer->setPreserves3D(true);
    609609        m_transformLayer->setLayerAnimationDelegate(this);
     610        m_transformLayer->setLayerAnimationController(m_layer->releaseLayerAnimationController());
    610611
    611612        // Copy the position from this layer.
     
    639640            m_transformLayer->parent()->replaceChild(m_transformLayer.get(), m_layer.get());
    640641
     642        m_layer->setLayerAnimationDelegate(this);
     643        m_layer->setLayerAnimationController(m_transformLayer->releaseLayerAnimationController());
     644
    641645        // Release the transform layer.
    642646        m_transformLayer->setLayerAnimationDelegate(0);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r116714 r116786  
    633633{
    634634    m_layerAnimationController = layerAnimationController;
    635     setNeedsCommit();
     635    if (m_layerAnimationController) {
     636        m_layerAnimationController->setClient(this);
     637        m_layerAnimationController->setForceSync();
     638    }
     639    setNeedsCommit();
     640}
     641
     642PassOwnPtr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationController()
     643{
     644    OwnPtr<CCLayerAnimationController> toReturn = m_layerAnimationController.release();
     645    m_layerAnimationController = CCLayerAnimationController::create(this);
     646    return toReturn.release();
    636647}
    637648
     
    644655{
    645656    m_layerAnimationController->notifyAnimationStarted(event);
    646     m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime);
     657    if (m_layerAnimationDelegate)
     658        m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime);
    647659}
    648660
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r116195 r116786  
    241241    CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); }
    242242    void setLayerAnimationController(PassOwnPtr<CCLayerAnimationController>);
     243    PassOwnPtr<CCLayerAnimationController> releaseLayerAnimationController();
    243244
    244245    void setLayerAnimationDelegate(CCLayerAnimationDelegate* layerAnimationDelegate) { m_layerAnimationDelegate = layerAnimationDelegate; }
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp

    r116714 r116786  
    125125
    126126CCLayerAnimationController::CCLayerAnimationController(CCLayerAnimationControllerClient* client)
    127     : m_client(client)
     127    : m_forceSync(false)
     128    , m_client(client)
    128129{
    129130}
     
    204205void CCLayerAnimationController::pushAnimationUpdatesTo(CCLayerAnimationController* controllerImpl)
    205206{
    206     pushNewAnimationsToImplThread(controllerImpl);
    207     removeAnimationsCompletedOnMainThread(controllerImpl);
    208     pushPropertiesToImplThread(controllerImpl);
     207    if (m_forceSync) {
     208        replaceImplThreadAnimations(controllerImpl);
     209        m_forceSync = false;
     210    } else {
     211        pushNewAnimationsToImplThread(controllerImpl);
     212        removeAnimationsCompletedOnMainThread(controllerImpl);
     213        pushPropertiesToImplThread(controllerImpl);
     214    }
    209215}
    210216
     
    254260{
    255261    for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
    256         if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimations[i]->targetProperty() == event.targetProperty) {
    257             ASSERT(m_activeAnimations[i]->needsSynchronizedStartTime());
     262        if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimations[i]->targetProperty() == event.targetProperty && m_activeAnimations[i]->needsSynchronizedStartTime()) {
    258263            m_activeAnimations[i]->setNeedsSynchronizedStartTime(false);
    259264            m_activeAnimations[i]->setStartTime(event.monotonicTime);
     
    261266        }
    262267    }
     268}
     269
     270void CCLayerAnimationController::setClient(CCLayerAnimationControllerClient* client)
     271{
     272    m_client = client;
    263273}
    264274
     
    282292        // The new animation should be set to run as soon as possible.
    283293        toAdd->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0);
     294        toAdd->setStartTime(0);
    284295        controllerImpl->add(toAdd.release());
    285296    }
     
    438449}
    439450
     451void CCLayerAnimationController::replaceImplThreadAnimations(CCLayerAnimationController* controllerImpl) const
     452{
     453    controllerImpl->m_activeAnimations.clear();
     454    for (size_t i = 0; i < m_activeAnimations.size(); ++i)
     455        controllerImpl->add(m_activeAnimations[i]->cloneForImplThread());
     456}
     457
    440458void CCLayerAnimationController::tickAnimations(double monotonicTime)
    441459{
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h

    r115519 r116786  
    9191    void notifyAnimationStarted(const CCAnimationEvent&);
    9292
     93    // If a sync is forced, then the next time animation updates are pushed to the impl
     94    // thread, all animations will be transferred.
     95    void setForceSync() { m_forceSync = true; }
     96
     97    void setClient(CCLayerAnimationControllerClient*);
     98
    9399protected:
    94100    explicit CCLayerAnimationController(CCLayerAnimationControllerClient*);
     
    100106    void removeAnimationsCompletedOnMainThread(CCLayerAnimationController*) const;
    101107    void pushPropertiesToImplThread(CCLayerAnimationController*) const;
     108    void replaceImplThreadAnimations(CCLayerAnimationController*) const;
    102109
    103110    void startAnimationsWaitingForNextTick(double monotonicTime, CCAnimationEventsVector*);
     
    109116    void tickAnimations(double monotonicTime);
    110117
     118    // If this is true, we force a sync to the impl thread.
     119    bool m_forceSync;
     120
    111121    CCLayerAnimationControllerClient* m_client;
    112122    Vector<OwnPtr<CCActiveAnimation> > m_activeAnimations;
  • trunk/Source/WebKit/chromium/ChangeLog

    r116782 r116786  
     12012-05-11  Ian Vollick  <vollick@chromium.org>
     2
     3        [chromium] Ensure that animations continue to run when transform-style is changed
     4        https://bugs.webkit.org/show_bug.cgi?id=83283
     5
     6        Reviewed by James Robinson.
     7
     8        * WebKit.gypi:
     9        * tests/GraphicsLayerChromiumTest.cpp: Added.
     10        (WebKitTests):
     11        (MockGraphicsLayerClient):
     12        (WebKitTests::MockGraphicsLayerClient::notifyAnimationStarted):
     13        (WebKitTests::MockGraphicsLayerClient::notifySyncRequired):
     14        (WebKitTests::MockGraphicsLayerClient::paintContents):
     15        (WebKitTests::MockGraphicsLayerClient::showDebugBorders):
     16        (WebKitTests::MockGraphicsLayerClient::showRepaintCounter):
     17        (WebKitTests::TEST):
     18
    1192012-05-11  Min Qin  <qinmin@google.com>
    220
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r116722 r116786  
    106106            'tests/FrameTestHelpers.cpp',
    107107            'tests/FrameTestHelpers.h',
     108            'tests/GraphicsLayerChromiumTest.cpp',
    108109            'tests/IDBBindingUtilitiesTest.cpp',
    109110            'tests/IDBKeyPathTest.cpp',
Note: See TracChangeset for help on using the changeset viewer.