return ret;
}
-TIZEN_PROD_STATIC char *generate_description_from_relation_object(AtspiAccessibleReadingMaterial *rm)
-{
- char *trait = NULL;
- Eina_Strbuf *buf;
- char *role_name = generate_role_trait(rm);
- char *description_from_role = NULL;
- char *state_from_role = generate_state_trait(rm);
-
- buf = eina_strbuf_new();
- if (role_name && strlen(role_name) > 0)
- ESAL(buf, role_name);
-
- if (vc_get_read_description())
- description_from_role = generate_description_trait(rm);
- if (description_from_role && strlen(description_from_role) > 0) {
- if (eina_strbuf_length_get(buf))
- ESAL(buf, " , ");
- ESAL(buf, description_from_role);
- }
-
- if (state_from_role && strlen(state_from_role) > 0) {
- if (eina_strbuf_length_get(buf))
- ESAL(buf, " , ");
- ESAL(buf, state_from_role);
- }
- SCREEN_READER_SAFE_FREE(role_name, free);
- SCREEN_READER_SAFE_FREE(description_from_role, free);
- SCREEN_READER_SAFE_FREE(state_from_role, free);
-
- if (rm->description && strlen(rm->description) > 0)
- eina_strbuf_prepend_printf(buf, "%s , ", rm->description);
-
- trait = eina_strbuf_string_steal(buf);
- eina_strbuf_free(buf);
- return trait;
-}
-
TIZEN_PROD_STATIC
unsigned short int reading_composer_reading_attribute_get(AtspiAccessibleReadingMaterial *rm)
{
DEBUG("END");
return base_desc;
}
-
-char* reading_composer_extended_description_get(ReadingComposerData *data)
+TIZEN_PROD_STATIC
+char* reading_composer_extended_description_get_recursive(ReadingComposerData *data, int nest_level, int max_nest_level)
{
DEBUG("START");
char *description = NULL;
char *description_from_role = NULL;
AtspiAccessibleReadingMaterial *rm;
- if (!data)
+ if (!data || nest_level > max_nest_level)
return NULL;
rm = data;
if (reading_attribute & ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION) {
/* read_description is determined by vconf value for the 'read usage hints aloud' */
DEBUG("START : ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION (read usage hints: %d)", vc_get_read_description());
- description = rm->description;
- /* If description is set by application side, do not read other default information */
- if (vc_get_read_description() && description && strlen(description) > 0) {
- ESAL(buf2, description);
- } else if (STATE_SET_CONTAINS(rm->states, ATSPI_STATE_ENABLED)) {
- if (vc_get_read_description())
- description_from_role = generate_description_trait(rm);
-
- if (rm->described_by_accessible) {
- AtspiAccessibleReadingMaterial *_rm = atspi_accessible_get_reading_material(rm->described_by_accessible, NULL);
- if (_rm) {
- description_from_relation = generate_description_from_relation_object(_rm);
- reading_composer_reading_material_free(_rm);
+ if (vc_get_read_description()) {
+ description = rm->description;
+ if (description && strlen(description) > 0) {
+ /* If description is explicitely set by application side, read it as it is (without any other default information) */
+ ESAL(buf2, description);
+ } else if (STATE_SET_CONTAINS(rm->states, ATSPI_STATE_ENABLED)) {
+ /* If description is not explicitely set by application side, provide default information */
+ if (rm->described_by_accessible) {
+ AtspiAccessibleReadingMaterial *_rm = atspi_accessible_get_reading_material(rm->described_by_accessible, NULL);
+ if (_rm) {
+ description_from_relation = reading_composer_extended_description_get_recursive(_rm, ++nest_level, max_nest_level);
+ reading_composer_reading_material_free(_rm);
+ }
}
- }
- if (description_from_role && strlen(description_from_role) > 0) {
- ESAL(buf2, description_from_role);
- }
- if (description_from_relation && strlen(description_from_relation)) {
- if (eina_strbuf_length_get(buf2))
- ESAL(buf2, " , ");
- ESAL(buf2, description_from_relation);
+ if (description_from_relation && strlen(description_from_relation)) {
+ ESAL(buf2, description_from_relation);
+ } else {
+ description_from_role = generate_description_trait(rm);
+ if (description_from_role && strlen(description_from_role) > 0) {
+ ESAL(buf2, description_from_role);
+ }
+ }
}
}
SCREEN_READER_SAFE_FREE(description_from_relation, free);
return ext_desc;
}
+char* reading_composer_extended_description_get(ReadingComposerData *data) {
+ return reading_composer_extended_description_get_recursive(data, 0, 1);
+}
+
char* reading_composer_percent_value_description_get(ReadingComposerData *data) {
Eina_Strbuf *buf = NULL;
AtspiAccessibleReadingMaterial *rm;