Changeset 148743 in webkit
- Timestamp:
- Apr 19, 2013 6:54:27 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148742 r148743 1 2013-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 1 24 2013-04-19 ChangSeok Oh <changseok.oh@collabora.com> 2 25 -
trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp
r148742 r148743 74 74 static void graphicsLayerActorPaint(ClutterActor*); 75 75 76 static void graphicsLayerActorAdded(ClutterContainer*, ClutterActor*, gpointer data);77 static void graphicsLayerActorRemoved(ClutterContainer*, ClutterActor*, gpointer data);78 76 static gboolean graphicsLayerActorDraw(ClutterCanvas*, cairo_t*, gint width, gint height, GraphicsLayerActor*); 79 77 static void graphicsLayerActorUpdateTexture(GraphicsLayerActor*); … … 111 109 // Default used by GraphicsLayer. 112 110 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);116 111 } 117 112 … … 177 172 // FIXME: maybe we can cache children allocation and not call 178 173 // 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); 184 180 185 181 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); 188 184 childBox.x2 = childBox.x1 + childWidth; 189 185 childBox.y2 = childBox.y1 + childHeight; 190 186 191 clutter_actor_allocate(child , &childBox, flags);187 clutter_actor_allocate(childActor, &childBox, flags); 192 188 } 193 189 … … 219 215 static void graphicsLayerActorPaint(ClutterActor* actor) 220 216 { 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)); 227 220 } 228 221 … … 249 242 250 243 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);263 244 } 264 245 … … 341 322 g_return_if_fail(GRAPHICS_LAYER_IS_ACTOR(layer)); 342 323 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)); 346 325 } 347 326 … … 403 382 ASSERT(GRAPHICS_LAYER_IS_ACTOR(layer)); 404 383 405 return g_list_length(layer->children);384 return clutter_actor_get_n_children(CLUTTER_ACTOR(layer)); 406 385 } 407 386 … … 412 391 ASSERT(CLUTTER_IS_ACTOR(newChildLayer)); 413 392 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); 416 394 } 417 395 … … 421 399 ASSERT(CLUTTER_IS_ACTOR(childLayer)); 422 400 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); 431 402 } 432 403 -
trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.h
r148742 r148743 65 65 ClutterRectangle parent; 66 66 GraphicsLayerActorPrivate *priv; 67 GList *children;68 67 }; 69 68
Note: See TracChangeset
for help on using the changeset viewer.