Evas textblock: Fix formatted size calculation with ellipsis.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 12 Apr 2011 07:13:33 +0000 (07:13 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 12 Apr 2011 07:13:33 +0000 (07:13 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@58580 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c

index ef54db1..b29ec4f 100644 (file)
@@ -3725,6 +3725,8 @@ _layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_
 
    /* Start of visual layout creation */
    {
+      Evas_Object_Textblock_Paragraph *last_vis_par = NULL;
+
       EINA_INLIST_FOREACH(c->paragraphs, c->par)
         {
            _layout_update_par(c);
@@ -3732,18 +3734,31 @@ _layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_
            /* Break if we should stop here. */
            if (_layout_visualize_par(c))
              {
-                /* Mark all the rest of the paragraphs as invisible */
+                last_vis_par = c->par;
+                break;
+             }
+        }
+
+      /* Mark all the rest of the paragraphs as invisible */
+      if (c->par)
+        {
+           c->par = (Evas_Object_Textblock_Paragraph *)
+              EINA_INLIST_GET(c->par)->next;
+           while (c->par)
+             {
+                c->par->visible = 0;
                 c->par = (Evas_Object_Textblock_Paragraph *)
                    EINA_INLIST_GET(c->par)->next;
-                while (c->par)
-                  {
-                     c->par->visible = 0;
-                     c->par = (Evas_Object_Textblock_Paragraph *)
-                        EINA_INLIST_GET(c->par)->next;
-                  }
-                break;
              }
         }
+
+      /* Get the last visible paragraph in the layout */
+      if (!last_vis_par && c->paragraphs)
+         last_vis_par = (Evas_Object_Textblock_Paragraph *)
+            EINA_INLIST_GET(c->paragraphs)->last;
+
+      if (last_vis_par)
+         c->hmax = last_vis_par->y + last_vis_par->h;
    }
 
    /* Clean the rest of the format stack */
@@ -3754,14 +3769,6 @@ _layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_
         _format_unref_free(c->obj, fmt);
      }
 
-   if (c->paragraphs)
-     {
-        Evas_Object_Textblock_Paragraph *last_par;
-        last_par = (Evas_Object_Textblock_Paragraph *)
-           EINA_INLIST_GET(c->paragraphs)->last;
-        c->hmax = last_par->y + last_par->h;
-     }
-
    if (w_ret) *w_ret = c->wmax;
    if (h_ret) *h_ret = c->hmax;