atspi: follow edje_entry logic to send anchor name 76/148876/2
authorShinwoo Kim <cinoo.kim@samsung.com>
Mon, 11 Sep 2017 05:29:46 +0000 (14:29 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Mon, 11 Sep 2017 08:52:24 +0000 (08:52 +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 09e49bec38b3ca87e2d87c61027f77f842c280cf..a37ca84d0db28800c4dfcfdbae11b91b5aa27a7c 100644 (file)
@@ -8135,6 +8135,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_atspi)
 {
@@ -8168,7 +8209,7 @@ _atspi_expose_anchors(Eo *obj, Eina_Bool is_atspi)
                   p = strstr(s, "href=");
                   if (p)
                     {
-                       name = strdup(p + 5);
+                       name = _anchor_format_parse(p);
                     }
 
                   start = evas_object_textblock_cursor_new(tb);