Changeset 147121 in webkit


Ignore:
Timestamp:
Mar 28, 2013 9:00:06 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK][AC] Animating layer disappears while running with clutter backend
https://bugs.webkit.org/show_bug.cgi?id=110470

Patch by ChangSeok Oh <ChangSeok Oh> on 2013-03-28
Reviewed by Gustavo Noronha Silva.

The reason of this issue is that clutter_actor_remove_child leads to stopping animations
of child actor. ClutterActor's animation could be defined only when it has a parent actor.
So we should avoid the case calling the api as much as we can. At least we don't
need to reset a actor's parent at all if the current parent is same with new one.
If we can't avoid invoking clutter_actor_remove_child for an animating actor, we may apply
a more complicated way to keep the animation. But I haven't faced such a case yet.

Covered by existing animation tests.

  • platform/graphics/clutter/GraphicsLayerActor.cpp:

(graphicsLayerActorSetSublayers):

  • platform/graphics/clutter/GraphicsLayerClutter.cpp:

(WebCore::GraphicsLayerClutter::recursiveCommitChanges):
(WebCore::GraphicsLayerClutter::updateSublayerList):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147120 r147121  
     12013-03-28  ChangSeok Oh  <changseok.oh@collabora.com>
     2
     3        [GTK][AC] Animating layer disappears while running with clutter backend
     4        https://bugs.webkit.org/show_bug.cgi?id=110470
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        The reason of this issue is that clutter_actor_remove_child leads to stopping animations
     9        of child actor. ClutterActor's animation could be defined only when it has a parent actor.
     10        So we should avoid the case calling the api as much as we can. At least we don't
     11        need to reset a actor's parent at all if the current parent is same with new one.
     12        If we can't avoid invoking clutter_actor_remove_child for an animating actor, we may apply
     13        a more complicated way to keep the animation. But I haven't faced such a case yet.
     14
     15        Covered by existing animation tests.
     16
     17        * platform/graphics/clutter/GraphicsLayerActor.cpp:
     18        (graphicsLayerActorSetSublayers):
     19        * platform/graphics/clutter/GraphicsLayerClutter.cpp:
     20        (WebCore::GraphicsLayerClutter::recursiveCommitChanges):
     21        (WebCore::GraphicsLayerClutter::updateSublayerList):
     22
    1232013-03-28  Xianzhu Wang  <wangxianzhu@chromium.org>
    224
  • trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp

    r142749 r147121  
    471471    }
    472472
     473    ClutterActor* newParentActor = CLUTTER_ACTOR(layer);
    473474    for (size_t i = 0; i < subLayers.size(); ++i) {
    474         ClutterActor* layerActor = CLUTTER_ACTOR(subLayers[i].get());
    475         clutter_actor_add_child(CLUTTER_ACTOR(layer), layerActor);
     475        ClutterActor* childActor = CLUTTER_ACTOR(subLayers[i].get());
     476        ClutterActor* oldParentActor = clutter_actor_get_parent(childActor);
     477        if (oldParentActor) {
     478            if (oldParentActor == newParentActor)
     479                continue;
     480            clutter_actor_remove_child(oldParentActor, childActor);
     481        }
     482        clutter_actor_add_child(newParentActor, childActor);
    476483    }
    477484}
  • trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp

    r146608 r147121  
    579579
    580580    for (size_t i = 0; i < numChildren; ++i) {
    581         GraphicsLayerClutter* curChild = static_cast<GraphicsLayerClutter*>(childLayers[i]);
    582         curChild->recursiveCommitChanges(localState, pageScaleFactor, baseRelativePosition, affectedByPageScale);
     581        GraphicsLayerClutter* currentChild = static_cast<GraphicsLayerClutter*>(childLayers[i]);
     582        currentChild->recursiveCommitChanges(localState, pageScaleFactor, baseRelativePosition, affectedByPageScale);
    583583    }
    584584
     
    659659    const Vector<GraphicsLayer*>& childLayers = children();
    660660
    661     if (childLayers.size() > 0) {
    662         size_t numChildren = childLayers.size();
    663         for (size_t i = 0; i < numChildren; ++i) {
    664             GraphicsLayerClutter* curChild = static_cast<GraphicsLayerClutter*>(childLayers[i]);
    665             GraphicsLayerActor* childLayer = curChild->layerForSuperlayer();
    666             g_assert(GRAPHICS_LAYER_IS_ACTOR(childLayer));
    667             newSublayers.append(childLayer);
    668         }
    669 
    670         for (size_t i = 0; i < newSublayers.size(); i++) {
    671             ClutterActor* layerActor = CLUTTER_ACTOR(newSublayers[i].get());
    672             ClutterActor* parentActor = clutter_actor_get_parent(layerActor);
    673             if (parentActor)
    674                 clutter_actor_remove_child(parentActor, layerActor);
    675         }
     661    size_t numChildren = childLayers.size();
     662    for (size_t i = 0; i < numChildren; ++i) {
     663        GraphicsLayerClutter* currentChild = static_cast<GraphicsLayerClutter*>(childLayers[i]);
     664        GraphicsLayerActor* childLayer = currentChild->layerForSuperlayer();
     665        ASSERT(GRAPHICS_LAYER_IS_ACTOR(childLayer));
     666
     667        newSublayers.append(childLayer);
    676668    }
    677669
Note: See TracChangeset for help on using the changeset viewer.