Changeset 148743 in webkit


Ignore:
Timestamp:
Apr 19, 2013 6:54:27 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK][AC] Manage actor's children by using clutter's own way.
https://bugs.webkit.org/show_bug.cgi?id=114257

Patch by ChangSeok Oh <ChangSeok Oh> on 2013-04-19
Reviewed by Gustavo Noronha Silva.

I believe we don't need to maintain a children list of GList. We can do it
by using clutter APIs like clutter_actor_get_children, clutter_actor_get_first_child, etc.

No new tests since no functionality changed.

  • platform/graphics/clutter/GraphicsLayerActor.cpp:

(graphics_layer_actor_init):
(graphicsLayerActorAllocate):
(graphicsLayerActorPaint):
(graphicsLayerActorRemoveAll):
(graphicsLayerActorGetnChildren):
(graphicsLayerActorReplaceSublayer):
(graphicsLayerActorInsertSublayer):

  • platform/graphics/clutter/GraphicsLayerActor.h:

(_GraphicsLayerActor):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148742 r148743  
     12013-04-19  ChangSeok Oh  <changseok.oh@collabora.com>
     2
     3        [GTK][AC] Manage actor's children by using clutter's own way.
     4        https://bugs.webkit.org/show_bug.cgi?id=114257
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        I believe we don't need to maintain a children list of GList. We can do it
     9        by using clutter APIs like clutter_actor_get_children, clutter_actor_get_first_child, etc.
     10
     11        No new tests since no functionality changed.
     12
     13        * platform/graphics/clutter/GraphicsLayerActor.cpp:
     14        (graphics_layer_actor_init):
     15        (graphicsLayerActorAllocate):
     16        (graphicsLayerActorPaint):
     17        (graphicsLayerActorRemoveAll):
     18        (graphicsLayerActorGetnChildren):
     19        (graphicsLayerActorReplaceSublayer):
     20        (graphicsLayerActorInsertSublayer):
     21        * platform/graphics/clutter/GraphicsLayerActor.h:
     22        (_GraphicsLayerActor):
     23
    1242013-04-19  ChangSeok Oh  <changseok.oh@collabora.com>
    225
  • trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp

    r148742 r148743  
    7474static void graphicsLayerActorPaint(ClutterActor*);
    7575
    76 static void graphicsLayerActorAdded(ClutterContainer*, ClutterActor*, gpointer data);
    77 static void graphicsLayerActorRemoved(ClutterContainer*, ClutterActor*, gpointer data);
    7876static gboolean graphicsLayerActorDraw(ClutterCanvas*, cairo_t*, gint width, gint height, GraphicsLayerActor*);
    7977static void graphicsLayerActorUpdateTexture(GraphicsLayerActor*);
     
    111109    // Default used by GraphicsLayer.
    112110    graphicsLayerActorSetAnchorPoint(self, 0.5, 0.5, 0.0);
    113 
    114     g_signal_connect(self, "actor-added", G_CALLBACK(graphicsLayerActorAdded), 0);
    115     g_signal_connect(self, "actor-removed", G_CALLBACK(graphicsLayerActorRemoved), 0);
    116111}
    117112
     
    177172    // FIXME: maybe we can cache children allocation and not call
    178173    // allocate on them this often?
    179     for (GList* list = layer->children; list; list = list->next) {
    180         ClutterActor* child = CLUTTER_ACTOR(list->data);
    181 
    182         float childWidth = clutter_actor_get_width(child);
    183         float childHeight = clutter_actor_get_height(child);
     174    GOwnPtr<GList> children(clutter_actor_get_children(self));
     175    for (GList* child = children.get(); child; child = child->next) {
     176        ClutterActor* childActor = CLUTTER_ACTOR(child->data);
     177
     178        float childWidth = clutter_actor_get_width(childActor);
     179        float childHeight = clutter_actor_get_height(childActor);
    184180
    185181        ClutterActorBox childBox;
    186         childBox.x1 = clutter_actor_get_x(child);
    187         childBox.y1 = clutter_actor_get_y(child);
     182        childBox.x1 = clutter_actor_get_x(childActor);
     183        childBox.y1 = clutter_actor_get_y(childActor);
    188184        childBox.x2 = childBox.x1 + childWidth;
    189185        childBox.y2 = childBox.y1 + childHeight;
    190186
    191         clutter_actor_allocate(child, &childBox, flags);
     187        clutter_actor_allocate(childActor, &childBox, flags);
    192188    }
    193189
     
    219215static void graphicsLayerActorPaint(ClutterActor* actor)
    220216{
    221     GraphicsLayerActor* graphicsLayer = GRAPHICS_LAYER_ACTOR(actor);
    222 
    223     for (GList* list = graphicsLayer->children; list; list = list->next) {
    224         ClutterActor* child = CLUTTER_ACTOR(list->data);
    225         clutter_actor_paint(child);
    226     }
     217    GOwnPtr<GList> children(clutter_actor_get_children(actor));
     218    for (GList* child = children.get(); child; child = child->next)
     219        clutter_actor_paint(CLUTTER_ACTOR(child->data));
    227220}
    228221
     
    249242
    250243    return TRUE;
    251 }
    252 
    253 static void graphicsLayerActorAdded(ClutterContainer* container, ClutterActor* actor, gpointer data)
    254 {
    255     GraphicsLayerActor* graphicsLayer = GRAPHICS_LAYER_ACTOR(container);
    256     graphicsLayer->children = g_list_append(graphicsLayer->children, actor);
    257 }
    258 
    259 static void graphicsLayerActorRemoved(ClutterContainer* container, ClutterActor* actor, gpointer data)
    260 {
    261     GraphicsLayerActor* graphicsLayer = GRAPHICS_LAYER_ACTOR(container);
    262     graphicsLayer->children = g_list_remove(graphicsLayer->children, actor);
    263244}
    264245
     
    341322    g_return_if_fail(GRAPHICS_LAYER_IS_ACTOR(layer));
    342323
    343     GOwnPtr<GList> children(clutter_actor_get_children(CLUTTER_ACTOR(layer)));
    344     for (GList* child = children.get(); child; child = child->next)
    345         clutter_actor_remove_child(CLUTTER_ACTOR(layer), CLUTTER_ACTOR(child->data));
     324    clutter_actor_remove_all_children(CLUTTER_ACTOR(layer));
    346325}
    347326
     
    403382    ASSERT(GRAPHICS_LAYER_IS_ACTOR(layer));
    404383
    405     return g_list_length(layer->children);
     384    return clutter_actor_get_n_children(CLUTTER_ACTOR(layer));
    406385}
    407386
     
    412391    ASSERT(CLUTTER_IS_ACTOR(newChildLayer));
    413392
    414     clutter_actor_remove_child(CLUTTER_ACTOR(layer), oldChildLayer);
    415     clutter_actor_add_child(CLUTTER_ACTOR(layer), newChildLayer);
     393    clutter_actor_replace_child(CLUTTER_ACTOR(layer), oldChildLayer, newChildLayer);
    416394}
    417395
     
    421399    ASSERT(CLUTTER_IS_ACTOR(childLayer));
    422400
    423     g_object_ref(childLayer);
    424 
    425     layer->children = g_list_insert(layer->children, childLayer, index);
    426     ASSERT(!clutter_actor_get_parent(childLayer));
    427     clutter_actor_add_child(CLUTTER_ACTOR(layer), childLayer);
    428     clutter_actor_queue_relayout(CLUTTER_ACTOR(layer));
    429 
    430     g_object_unref(childLayer);
     401    clutter_actor_insert_child_at_index(CLUTTER_ACTOR(layer), childLayer, index);
    431402}
    432403
  • trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.h

    r148742 r148743  
    6565    ClutterRectangle parent;
    6666    GraphicsLayerActorPrivate *priv;
    67     GList *children;
    6867};
    6968
Note: See TracChangeset for help on using the changeset viewer.