elm: Compress more focus tests into the same list walk
authorDerek Foreman <derek.foreman.samsung@gmail.com>
Tue, 20 Nov 2018 17:20:36 +0000 (11:20 -0600)
committerHermet Park <hermetpark@gmail.com>
Wed, 5 Dec 2018 05:35:03 +0000 (14:35 +0900)
Since we're already at the top of the list, we can do the WIN_CLASS test
much more cheaply.

Differential Revision: https://phab.enlightenment.org/D7314

Signed-off-by: Derek Foreman <derek.foreman.samsung@gmail.com>
src/lib/elementary/efl_ui_widget.c

index 4519cb7..e39382a 100644 (file)
@@ -430,18 +430,19 @@ _tree_custom_chain_missing(Eo *obj)
 }
 
 static Eina_Bool
-_tree_disabled_or_unfocusable(Eo *obj)
+_candidacy_exam(Eo *obj)
 {
-   Efl_Ui_Widget *wid = obj;
+   Efl_Ui_Widget *wid = obj, *top;
 
    do {
      ELM_WIDGET_DATA_GET(wid, wid_pd);
 
      if (wid_pd->disabled) return EINA_TRUE;
      if (wid_pd->tree_unfocusable) return EINA_TRUE;
+     top = wid;
    } while((wid = elm_widget_parent_get(wid)));
 
-   return EINA_FALSE;
+   return !efl_isa(top, EFL_UI_WIN_CLASS);
 }
 
 static void _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd);
@@ -551,8 +552,7 @@ _eval_registration_candidate(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool *shou
     //can focus can be overridden by the following properties
     if ((!pd->parent_obj) ||
         (!evas_object_visible_get(obj)) ||
-        !efl_isa(elm_widget_top_get(obj), EFL_UI_WIN_CLASS) ||
-        (_tree_disabled_or_unfocusable(obj)) ||
+        (_candidacy_exam(obj)) ||
         (_tree_custom_chain_missing(obj)))
       return;