elm_panel: add some exception handling code in scrollable_content_size_set 80/130180/1
authorJEONGHYUN YUN <jh0506.yun@samsung.com>
Thu, 5 Jan 2017 05:54:08 +0000 (14:54 +0900)
committerJaeun Choi <jaeun12.choi@samsung.com>
Fri, 19 May 2017 06:57:06 +0000 (15:57 +0900)
this is part of the commit
336a5996a60efd2ef10ba45a2868e746c385c260
in tizen branch (which is from upstream)
except for the new API part

Change-Id: I8124229033de8c67dce2def519c87fd6e29960f0

src/lib/elm_panel.c

index f3b1bffe61c0be04f6aa5ee766d40dc0aec20de8..5001115d7a828f1fa1cb50943dd1ae3c0af92cfd 100644 (file)
@@ -1416,29 +1416,36 @@ _elm_panel_elm_widget_disable(Eo *obj, Elm_Panel_Data *sd)
 EOLIAN static void
 _elm_panel_scrollable_content_size_set(Eo *obj, Elm_Panel_Data *sd, double ratio)
 {
-   Evas_Coord w, h;
+   if (ratio < 0) ratio = 0;
+   else if (ratio > 1.0) ratio = 1.0;
+
    sd->content_size_ratio = ratio;
-   evas_object_geometry_get(obj, NULL, NULL, &w, &h);
 
-   switch (sd->orient)
+   if (sd->scrollable)
      {
-      case ELM_PANEL_ORIENT_TOP:
-      case ELM_PANEL_ORIENT_BOTTOM:
-         // vertical
-         evas_object_resize(sd->scr_ly, w, (1 + sd->content_size_ratio) * h);
-         evas_object_size_hint_min_set(sd->scr_panel, w, (sd->content_size_ratio * h));
-         evas_object_size_hint_min_set(sd->scr_event, w, h);
-         break;
-      case ELM_PANEL_ORIENT_LEFT:
-      case ELM_PANEL_ORIENT_RIGHT:
-         // horizontal
-         evas_object_resize(sd->scr_ly, (1 + sd->content_size_ratio) * w, h);
-         evas_object_size_hint_min_set(sd->scr_panel, (sd->content_size_ratio * w), h);
-         evas_object_size_hint_min_set(sd->scr_event, w, h);
-         break;
-     }
+        Evas_Coord w, h;
+        evas_object_geometry_get(obj, NULL, NULL, &w, &h);
 
-   elm_layout_sizing_eval(obj);
+        switch (sd->orient)
+          {
+           case ELM_PANEL_ORIENT_TOP:
+           case ELM_PANEL_ORIENT_BOTTOM:
+              // vertical
+              evas_object_resize(sd->scr_ly, w, (1 + sd->content_size_ratio) * h);
+              evas_object_size_hint_min_set(sd->scr_panel, w, (sd->content_size_ratio * h));
+              evas_object_size_hint_min_set(sd->scr_event, w, h);
+              break;
+           case ELM_PANEL_ORIENT_LEFT:
+           case ELM_PANEL_ORIENT_RIGHT:
+              // horizontal
+              evas_object_resize(sd->scr_ly, (1 + sd->content_size_ratio) * w, h);
+              evas_object_size_hint_min_set(sd->scr_panel, (sd->content_size_ratio * w), h);
+              evas_object_size_hint_min_set(sd->scr_event, w, h);
+              break;
+          }
+
+        elm_layout_sizing_eval(obj);
+     }
 }
 
 EOLIAN static Eina_Bool