atspi: follow edje_entry logic to send anchor name 75/148875/2
authorShinwoo Kim <cinoo.kim@samsung.com>
Mon, 11 Sep 2017 05:29:46 +0000 (14:29 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 11 Sep 2017 08:50:44 +0000 (08:50 +0000)
The edje_entry has logic remove unnecessary character.
The elm_entry is following the logic to give correct information.

Change-Id: I55114193d9b23117ddc8b9863c2b14741f42a215

src/lib/elm_entry.c

index 872362f27b83a3a3d1d4f2d0c10cfa2f89da1e86..a484d7f89505d48442dfce8c54cae3a18f92a5c5 100644 (file)
@@ -8189,6 +8189,47 @@ _anchor_rect_activated_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_
      evas_object_smart_callback_call(entry, SIG_ANCHOR_CLICKED, &ei);
 }
 
+static char *
+_anchor_format_parse(const char *item)
+{
+   const char *start, *end;
+   char *tmp;
+   size_t len;
+
+   start = strchr(item, '=');
+   if (!start) return NULL;
+
+   start++; /* Advance after the '=' */
+   /* If we can find a quote as the first non-space char,
+    * our new delimiter is a quote, not a space. */
+   while (*start == ' ')
+     start++;
+
+   if (*start == '\'')
+     {
+        start++;
+        end = strchr(start, '\'');
+        while ((end) && (end > start) && (end[-1] == '\\'))
+          end = strchr(end + 1, '\'');
+     }
+   else
+     {
+        end = strchr(start, ' ');
+        while ((end) && (end > start) && (end[-1] == '\\'))
+          end = strchr(end + 1, ' ');
+     }
+
+   /* Null terminate before the spaces */
+   if (end) len = end - start;
+   else len = strlen(start);
+
+   tmp = malloc(len + 1);
+   strncpy(tmp, start, len);
+   tmp[len] = '\0';
+
+   return tmp;
+}
+
 static void
 _atspi_expose_anchors(Eo *obj, Eina_Bool is_screen_reader)
 {
@@ -8222,7 +8263,7 @@ _atspi_expose_anchors(Eo *obj, Eina_Bool is_screen_reader)
                   p = strstr(s, "href=");
                   if (p)
                     {
-                       name = strdup(p + 5);
+                       name = _anchor_format_parse(p);
                     }
 
                   start = evas_object_textblock_cursor_new(tb);