summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-04-10 16:01:28 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-04-10 16:14:45 +0900
commitc0db1f422502102f012fadfa17078a69d085c736 (patch)
tree85c6ef1da3c6c448ed054133e47e22ed6363baec /src/lib/edje/edje_calc.c
parent1ab87367d8f1c0f416a65c4a43d96bb2f3683052 (diff)
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows: - Layout A is created (edje object / elm_layout) - Object B is swallowed inside A - Clipper C is set to clip B This is a invalid usage, as layout A takes control over the clip property of B (just like it does for geometry, visibility, color...). Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc loop, as it can change between states. In the past, edje_recalc did not reset the clip so anyone could (wrongly) swallow an object and then change its clip from C to modify its color, mask it, blend it, etc... Even though this was not proper use of the API, this is not very clearly documented, and since it worked, it has been (ab)used a lot already. The result now is that a clipper set from C will become visible as an opaque white rectangle covering the entire UI. Booh. This patch is a workaround that should have no impact on well written applications. As a bonus this avoids an extra call to clip_set() from edje. @fix
Diffstat (limited to 'src/lib/edje/edje_calc.c')
-rw-r--r--src/lib/edje/edje_calc.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 6f5e08c17d..bf0d809c5a 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -4360,7 +4360,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4360 if (ep->param1.description->rel2.id_y >= 0) 4360 if (ep->param1.description->rel2.id_y >= 0)
4361 rp1[Rel2Y] = ed->table_parts[ep->param1.description->rel2.id_y]; 4361 rp1[Rel2Y] = ed->table_parts[ep->param1.description->rel2.id_y];
4362 if (ep->param1.description->clip_to_id >= 0) 4362 if (ep->param1.description->clip_to_id >= 0)
4363 clip1 = ed->table_parts[ep->param1.description->clip_to_id % ed->table_parts_size]; 4363 {
4364 clip1 = ed->table_parts[ep->param1.description->clip_to_id % ed->table_parts_size];
4365 ed->has_state_clip = EINA_TRUE;
4366 }
4364 } 4367 }
4365 if (ep->param2) 4368 if (ep->param2)
4366 { 4369 {
@@ -4373,7 +4376,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4373 if (ep->param2->description->rel2.id_y >= 0) 4376 if (ep->param2->description->rel2.id_y >= 0)
4374 rp2[Rel2Y] = ed->table_parts[ep->param2->description->rel2.id_y]; 4377 rp2[Rel2Y] = ed->table_parts[ep->param2->description->rel2.id_y];
4375 if (ep->param2->description->clip_to_id >= 0) 4378 if (ep->param2->description->clip_to_id >= 0)
4376 clip2 = ed->table_parts[ep->param2->description->clip_to_id % ed->table_parts_size]; 4379 {
4380 clip2 = ed->table_parts[ep->param2->description->clip_to_id % ed->table_parts_size];
4381 ed->has_state_clip = EINA_TRUE;
4382 }
4377 } 4383 }
4378 4384
4379 if (flags & FLAG_X) 4385 if (flags & FLAG_X)
@@ -5119,12 +5125,15 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5119 _edje_entry_real_part_configure(ed, ep); 5125 _edje_entry_real_part_configure(ed, ep);
5120 5126
5121 /* handle clip overrides */ 5127 /* handle clip overrides */
5122 if ((pf->ext) && (pf->ext->clip_to) && (pf->ext->clip_to->object)) 5128 if (ed->has_state_clip)
5123 evas_object_clip_set(ep->object, pf->ext->clip_to->object); 5129 {
5124 else if (ep->part->clip_to_id >= 0) 5130 if ((pf->ext) && (pf->ext->clip_to) && (pf->ext->clip_to->object))
5125 evas_object_clip_set(ep->object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object); 5131 evas_object_clip_set(ep->object, pf->ext->clip_to->object);
5126 else 5132 else if (ep->part->clip_to_id >= 0)
5127 evas_object_clip_set(ep->object, ed->base->clipper); 5133 evas_object_clip_set(ep->object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object);
5134 else
5135 evas_object_clip_set(ep->object, ed->base->clipper);
5136 }
5128 break; 5137 break;
5129 5138
5130 case EDJE_PART_TYPE_TEXT: 5139 case EDJE_PART_TYPE_TEXT:
@@ -5384,12 +5393,15 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5384 (ep->typedata.swallow)) && 5393 (ep->typedata.swallow)) &&
5385 (ep->typedata.swallow->swallowed_object)) 5394 (ep->typedata.swallow->swallowed_object))
5386 { 5395 {
5387 if ((pf->ext) && (pf->ext->clip_to) && (pf->ext->clip_to->object)) 5396 if (ed->has_state_clip)
5388 evas_object_clip_set(ep->typedata.swallow->swallowed_object, pf->ext->clip_to->object); 5397 {
5389 else if (ep->part->clip_to_id >= 0) 5398 if ((pf->ext) && (pf->ext->clip_to) && (pf->ext->clip_to->object))
5390 evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object); 5399 evas_object_clip_set(ep->typedata.swallow->swallowed_object, pf->ext->clip_to->object);
5391 else 5400 else if (ep->part->clip_to_id >= 0)
5392 evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->base->clipper); 5401 evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object);
5402 else
5403 evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->base->clipper);
5404 }
5393 5405
5394 if (pf->visible) 5406 if (pf->visible)
5395 { 5407 {