From b45fcae53f8b543e55b889c25448081f15dbbab3 Mon Sep 17 00:00:00 2001 From: Youngsun Suh Date: Wed, 21 May 2025 08:56:35 +0900 Subject: [PATCH] Fix perf regression when efl page_tab is showing Change-Id: I130f254c8d7a50cfd471ecd96b0927850c1c9bac --- include/utils.h | 2 +- src/app_tracker.c | 2 +- src/reading_composer.c | 4 ++-- src/utils.c | 34 +++++++++++++++++----------------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/utils.h b/include/utils.h index bbe0128a..4e405f8e 100644 --- a/include/utils.h +++ b/include/utils.h @@ -141,7 +141,6 @@ Eina_Bool object_has_focused_state(AtspiAccessible *obj); Eina_Bool object_has_defunct_state(AtspiAccessible *obj); Eina_Bool object_has_highlighted_state(AtspiAccessible *obj); Eina_Bool object_get_extents(AtspiAccessible *object, AtspiRect *extents); -Eina_Bool is_legacy_toolkit(AtspiAccessible *obj); int get_percent_value(double value, double lower, double upper); @@ -149,6 +148,7 @@ Eina_Bool is_same_str (const char *s1, const char *s2); Eina_Bool rect_contains(const AtspiRect *rect, int x, int y); Live_Region_Politeness try_parse_politeness(GHashTable *attrs, Eina_Bool assertive_by_default); +Eina_Bool has_legacy_elm_type(AtspiAccessible *obj); static inline void ESAL(Eina_Strbuf *buf, const char *txt) { diff --git a/src/app_tracker.c b/src/app_tracker.c index 26f9eeef..bca57eaf 100644 --- a/src/app_tracker.c +++ b/src/app_tracker.c @@ -328,7 +328,7 @@ static void _on_atspi_event_cb(AtspiEvent *event, void *user_data) DEBUG("Append Window"); window_tracker_window_append(atd->window_tracker_data, event->source, EINA_FALSE); } else if (role == ATSPI_ROLE_PAGE_TAB) { - if (is_legacy_toolkit(event->source)) { + if (has_legacy_elm_type(event->source)) { // EFL only: refresh default label for newly showing page tab DEBUG("Refreshing TAB"); timer_reschedule(atd); diff --git a/src/reading_composer.c b/src/reading_composer.c index ca4a25da..1c5251d8 100644 --- a/src/reading_composer.c +++ b/src/reading_composer.c @@ -232,7 +232,7 @@ TIZEN_PROD_STATIC char *generate_state_trait_from_role(AtspiAccessibleReadingMat } case ATSPI_ROLE_PAGE_TAB: { AtspiAccessible *parent = rm->parent; - if (!parent || is_legacy_toolkit(rm->self)) break; + if (!parent || has_legacy_elm_type(rm->self)) break; AtspiRole parent_role = rm->parent_role; if (parent_role == ATSPI_ROLE_PAGE_TAB_LIST) { @@ -376,7 +376,7 @@ TIZEN_PROD_STATIC char *generate_description_trait(AtspiAccessibleReadingMateria } case ATSPI_ROLE_PAGE_TAB: { AtspiAccessible *parent = rm->parent; - if (!parent || is_legacy_toolkit(rm->self)) break; + if (!parent || has_legacy_elm_type(rm->self)) break; AtspiRole parent_role = rm->parent_role; if (parent_role == ATSPI_ROLE_PAGE_TAB_LIST) { diff --git a/src/utils.c b/src/utils.c index 4bd2531e..e3537863 100644 --- a/src/utils.c +++ b/src/utils.c @@ -252,23 +252,6 @@ Eina_Bool object_has_highlighted_state(AtspiAccessible *obj) return _object_has_state(obj, ATSPI_STATE_HIGHLIGHTED); } -Eina_Bool is_legacy_toolkit(AtspiAccessible *obj) { - Eina_Bool ret = EINA_FALSE; - AtspiAccessible *app = atspi_accessible_get_application(obj, NULL); - if (app) { - gchar* toolkit_name = atspi_accessible_get_toolkit_name(app, NULL); - if (toolkit_name) { - if (g_str_equal(toolkit_name, "elementary")) { - ret = EINA_TRUE; - } - g_free(toolkit_name); - } - g_object_unref(app); - } - DEBUG("is_legacy_toolkit=%d", ret); - return ret; -} - int get_percent_value(double value, double lower, double upper) { double add_for_rounding = 0.5f; @@ -338,3 +321,20 @@ Live_Region_Politeness try_parse_politeness(GHashTable *attrs, Eina_Bool asserti DEBUG("speaking politeness mode is %d", mode); return mode; } + +Eina_Bool has_legacy_elm_type(AtspiAccessible *obj) +{ + Eina_Bool ret = EINA_FALSE; + GHashTable *attrs = atspi_accessible_get_attributes(obj, NULL); + if (attrs) { + const char *val = g_hash_table_lookup(attrs, "type"); + if (val) { + DEBUG("type attr is '%s'", val); + if (g_strcmp0(val, "Elm_Layout") == 0 || g_strcmp0(val, "Eext.Sidenavi") == 0) ret = EINA_TRUE; + } + + if (attrs) g_hash_table_unref(attrs); + } + + return ret; +} -- 2.34.1