2009-06-10 Xan Lopez <xlopez@igalia.com>
authorxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jun 2009 17:17:12 +0000 (17:17 +0000)
committerxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jun 2009 17:17:12 +0000 (17:17 +0000)
        Reviewed by Gustavo Noronha.

        https://bugs.webkit.org/show_bug.cgi?id=25609
        [GTK] Implement support for get_selection and get_n_selections

        Implement atk_text_get_selection.

        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
        (webkit_accessible_text_get_selection):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@44567 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

index b2b54928b6cafdb27cd5f1ce1872d1e98a6c4709..15dcd6ce398a774cf9dd329f8e070f3eab53ec7c 100644 (file)
@@ -1,3 +1,15 @@
+2009-06-10  Xan Lopez  <xlopez@igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25609
+        [GTK] Implement support for get_selection and get_n_selections
+
+        Implement atk_text_get_selection.
+
+        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+        (webkit_accessible_text_get_selection):
+
 2009-06-10  Xan Lopez  <xlopez@igalia.com>
 
         Reviewed by Gustavo Noronha.
index be786368dc7f97b17845c6ecde806c9050767aeb..aaaf0f37f14cb27755a77beb3089d27ce64e644f 100644 (file)
@@ -618,8 +618,18 @@ static gint webkit_accessible_text_get_n_selections(AtkText* text)
 
 static gchar* webkit_accessible_text_get_selection(AtkText* text, gint selection_num, gint* start_offset, gint* end_offset)
 {
-    notImplemented();
-    return NULL;
+    if (selection_num != 0) {
+        // WebCore does not support multiple selection, so anything but 0 does not make sense for now.
+        *start_offset = *end_offset = 0;
+        return NULL;
+    }
+
+    AccessibilityObject* coreObject = core(text);
+    VisibleSelection selection = coreObject->selection();
+    *start_offset = selection.start().offsetInContainerNode();
+    *end_offset = selection.end().offsetInContainerNode();
+
+    return webkit_accessible_text_get_text(text, *start_offset, *end_offset);
 }
 
 static gboolean webkit_accessible_text_add_selection(AtkText* text, gint start_offset, gint end_offset)