evas_object_text_block: fix halign_set to work 40/208040/1
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 17 Jun 2019 12:20:53 +0000 (21:20 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 17 Jun 2019 12:43:44 +0000 (21:43 +0900)
New format's halign and halign_auto were initialized with default values
after the new format copied halign and halign_auto from original format.
This caused that the halign value given by halign_set was not applied.

To keep backward compatibility and to resolve the bug, halign and
halign_auto are initialized only for legacy textblock.

Change-Id: I9639fcea898c4bea41c1eed6c91cffd7feadd695

src/lib/evas/canvas/evas_object_textblock.c

index 47a018d..5df3552 100644 (file)
@@ -3643,10 +3643,21 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
         *fmt = c->o->default_format.format;
         fmt->ref = 1;
         fmt->font.bitmap_scalable = _FMT_INFO(bitmap_scalable);
-        /* TIZEN_ONLY(20180509): Fix default values for text alignment */
-        fmt->halign = 0.0;
-        fmt->halign_auto = EINA_TRUE;
-        fmt->valign = -1.0;
+
+        /* TIZEN_ONLY(20190617): The initialized halign and halign_auto caused
+         * that the halign value given by halign_set was not applied.
+         * To keep backward compatibility and to resolve the bug, halign and
+         * halign_auto are initialized only for legacy textblock. */
+        Evas_Object_Protected_Data *obj;
+        obj = efl_data_scope_get(c->obj, EFL_CANVAS_OBJECT_CLASS);
+        if (obj->legacy.ctor)
+          {
+             /* TIZEN_ONLY(20180509): Fix default values for text alignment */
+             fmt->halign = 0.0;
+             fmt->halign_auto = EINA_TRUE;
+             fmt->valign = -1.0;
+             /* END */
+          }
         /* END */
 
         // Apply font if specified