Title: [126243] trunk/Source
Revision
126243
Author
[email protected]
Date
2012-08-21 18:37:04 -0700 (Tue, 21 Aug 2012)

Log Message

[Gtk] No accessible caret-moved events found in certain content
https://bugs.webkit.org/show_bug.cgi?id=72811

Patch by Joanmarie Diggs <[email protected]> on 2012-08-21
Reviewed by Chris Fleizach.

Part of the bug is due to objects which should claim to implement AtkText
failed to do so as a result of containing a mixture of inline and block
spans.

An updated unit test was provided.

Source/WebCore:

* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
(roleIsTextType): New method to check if a role is one expected to have
implemented the AtkText interface. Currently that is defined as:
 - ParagraphRole
 - HeadingRole
 - DivRole
 - CellRole
(getInterfaceMaskFromObject): If a role is one of the text type roles,
automatically add WAI_TEXT to the accessible object's interface mask.

Source/WebKit/gtk:

* tests/testatk.c:
(testWebkitAtkCaretOffsets): Added instances of objects containing a
mixture of inline and block spans and tested that they implement AtkText
and contain the right textual contents.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126242 => 126243)


--- trunk/Source/WebCore/ChangeLog	2012-08-22 01:29:22 UTC (rev 126242)
+++ trunk/Source/WebCore/ChangeLog	2012-08-22 01:37:04 UTC (rev 126243)
@@ -1,3 +1,26 @@
+2012-08-21  Joanmarie Diggs  <[email protected]>
+
+        [Gtk] No accessible caret-moved events found in certain content
+        https://bugs.webkit.org/show_bug.cgi?id=72811
+
+        Reviewed by Chris Fleizach.
+
+        Part of the bug is due to objects which should claim to implement AtkText
+        failed to do so as a result of containing a mixture of inline and block
+        spans.
+
+        An updated unit test was provided.
+
+        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
+        (roleIsTextType): New method to check if a role is one expected to have
+        implemented the AtkText interface. Currently that is defined as:
+         - ParagraphRole
+         - HeadingRole
+         - DivRole
+         - CellRole
+        (getInterfaceMaskFromObject): If a role is one of the text type roles,
+        automatically add WAI_TEXT to the accessible object's interface mask.
+
 2012-08-21  Tony Chang  <[email protected]>
 
         Force XML comments to maintain whitespace

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp (126242 => 126243)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-08-22 01:29:22 UTC (rev 126242)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-08-22 01:37:04 UTC (rev 126243)
@@ -815,6 +815,11 @@
     return G_TYPE_INVALID;
 }
 
+static bool roleIsTextType(AccessibilityRole role)
+{
+    return role == ParagraphRole || role == HeadingRole || role == DivRole || role == CellRole;
+}
+
 static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject)
 {
     guint16 interfaceMask = 0;
@@ -856,7 +861,7 @@
         } else {
             if (role != TableRole) {
                 interfaceMask |= 1 << WAI_HYPERTEXT;
-                if (renderer && renderer->childrenInline())
+                if ((renderer && renderer->childrenInline()) || roleIsTextType(role))
                     interfaceMask |= 1 << WAI_TEXT;
             }
 

Modified: trunk/Source/WebKit/gtk/ChangeLog (126242 => 126243)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-08-22 01:29:22 UTC (rev 126242)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-08-22 01:37:04 UTC (rev 126243)
@@ -1,3 +1,20 @@
+2012-08-21  Joanmarie Diggs  <[email protected]>
+        [Gtk] No accessible caret-moved events found in certain content
+        https://bugs.webkit.org/show_bug.cgi?id=72811
+
+        Reviewed by Chris Fleizach.
+
+        Part of the bug is due to objects which should claim to implement AtkText
+        failed to do so as a result of containing a mixture of inline and block
+        spans.
+
+        An updated unit test was provided.
+
+        * tests/testatk.c:
+        (testWebkitAtkCaretOffsets): Added instances of objects containing a
+        mixture of inline and block spans and tested that they implement AtkText
+        and contain the right textual contents.
+
 2012-08-21  Kihong Kwon  <[email protected]>
 
         [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient

Modified: trunk/Source/WebKit/gtk/tests/testatk.c (126242 => 126243)


--- trunk/Source/WebKit/gtk/tests/testatk.c	2012-08-22 01:29:22 UTC (rev 126242)
+++ trunk/Source/WebKit/gtk/tests/testatk.c	2012-08-22 01:37:04 UTC (rev 126243)
@@ -65,7 +65,7 @@
 
 static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href=''>link only</a></li><li>text and a <a href=''>link</a></li></ul><ol><li>text only</li><li><a href=''>link only</a></li><li>text and a <a href=''>link</a></li></ol></body></html>";
 
-static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href=''>with a link</a> in the middle</p><ol><li>A list item</li></ol><select><option selected value='foo'>An option in a combo box</option></select><input type='text'' name='foo'' value='foo bar baz' /><table><tr><td>a table cell</td></tr></table></body></html>";
+static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href=''>with a link</a> in the middle</p><ol><li>A list item</li><li><span style='display:block;'>Block span in a list item</span><span>Inline span in a list item</span></li><li><a href=''><span style='display:block;'>Block span in a link in a list item</span><span>Inline span in a link in a list item</span></a></li></ol><select><option selected value='foo'>An option in a combo box</option></select><input type='text' name='foo' value='foo bar baz' /><table><tr><td>a table cell</td><td></td><td><a href=''><span style='display:block;'>Block span in a link in a table cell</span><span>Inline span in a link in a table cell</span></a></td><td><span style='display:block;'>Block span in a table cell</span><span>Inline span in a table cell</span></td></tr></table><h4><a href=''><span style='display:block;'>Block span in a link in a heading</span><span>Inline span in a link in a heading</span></h4><h4><span style='display:block;'>Block span in a heading</span><span>Inline span in a heading</span></h4></body></html>";
 
 static const char* textForSelections = "<html><body><p>A paragraph with plain text</p><p>A paragraph with <a href=''>a link</a> in the middle</p><ol><li>A list item</li></ol><select></body></html>";
 
@@ -336,7 +336,7 @@
     AtkObject* list = atk_object_ref_accessible_child(object, 2);
     g_assert(ATK_OBJECT(list));
     g_assert(atk_object_get_role(list) == ATK_ROLE_LIST);
-    g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 1);
+    g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 3);
 
     AtkObject* listItem = atk_object_ref_accessible_child(list, 0);
     g_assert(ATK_IS_TEXT(listItem));
@@ -344,6 +344,18 @@
     g_assert_cmpstr(text, ==, "1. A list item");
     g_free (text);
 
+    listItem = atk_object_ref_accessible_child(list, 1);
+    g_assert(ATK_IS_TEXT(listItem));
+    text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
+    g_assert_cmpstr(text, ==, "2. Block span in a list item\nInline span in a list item");
+    g_free (text);
+
+    listItem = atk_object_ref_accessible_child(list, 2);
+    g_assert(ATK_IS_TEXT(listItem));
+    text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
+    g_assert_cmpstr(text, ==, "3. Block span in a link in a list item\nInline span in a link in a list item");
+    g_free (text);
+
     /* It's not possible to place the caret inside an item's marker. */
     result = atk_text_set_caret_offset(ATK_TEXT(listItem), 1);
     g_assert_cmpint(result, ==, FALSE);
@@ -360,10 +372,12 @@
 
     AtkObject* comboBox = atk_object_ref_accessible_child(panel, 0);
     g_assert(ATK_IS_OBJECT(comboBox));
+    g_assert(!ATK_IS_TEXT(comboBox));
     g_assert(atk_object_get_role(comboBox) == ATK_ROLE_COMBO_BOX);
 
     AtkObject* menuPopup = atk_object_ref_accessible_child(comboBox, 0);
     g_assert(ATK_IS_OBJECT(menuPopup));
+    g_assert(!ATK_IS_TEXT(menuPopup));
     g_assert(atk_object_get_role(menuPopup) == ATK_ROLE_MENU);
 
     AtkObject* comboBoxOption = atk_object_ref_accessible_child(menuPopup, 0);
@@ -372,6 +386,7 @@
     g_assert(ATK_IS_TEXT(comboBoxOption));
     text = atk_text_get_text(ATK_TEXT(comboBoxOption), 0, -1);
     g_assert_cmpstr(text, ==, "An option in a combo box");
+    g_free(text);
 
     /* It's not possible to place the caret inside an option for a combobox. */
     result = atk_text_set_caret_offset(ATK_TEXT(comboBoxOption), 1);
@@ -383,6 +398,7 @@
     g_assert(ATK_IS_TEXT(textEntry));
     text = atk_text_get_text(ATK_TEXT(textEntry), 0, -1);
     g_assert_cmpstr(text, ==, "foo bar baz");
+    g_free(text);
 
     result = atk_text_set_caret_offset(ATK_TEXT(textEntry), 5);
     g_assert_cmpint(result, ==, TRUE);
@@ -391,8 +407,9 @@
 
     AtkObject* table = atk_object_ref_accessible_child(object, 4);
     g_assert(ATK_IS_OBJECT(table));
+    g_assert(!ATK_IS_TEXT(table));
     g_assert(atk_object_get_role(table) == ATK_ROLE_TABLE);
-    g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 1);
+    g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 4);
 
     AtkObject* tableCell = atk_object_ref_accessible_child(table, 0);
     g_assert(ATK_IS_TEXT(tableCell));
@@ -406,6 +423,42 @@
     offset = atk_text_get_caret_offset(ATK_TEXT(tableCell));
     g_assert_cmpint(offset, ==, 2);
 
+    /* Even empty table cells should implement AtkText, but report an empty string */
+    tableCell = atk_object_ref_accessible_child(table, 1);
+    g_assert(ATK_IS_TEXT(tableCell));
+    g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
+    text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
+    g_assert_cmpstr(text, ==, "");
+    g_free(text);
+
+    tableCell = atk_object_ref_accessible_child(table, 2);
+    g_assert(ATK_IS_TEXT(tableCell));
+    g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
+    text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
+    g_assert_cmpstr(text, ==, "Block span in a link in a table cell\nInline span in a link in a table cell");
+    g_free(text);
+
+    tableCell = atk_object_ref_accessible_child(table, 3);
+    g_assert(ATK_IS_TEXT(tableCell));
+    g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
+    text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
+    g_assert_cmpstr(text, ==, "Block span in a table cell\nInline span in a table cell");
+    g_free(text);
+
+    header = atk_object_ref_accessible_child(object, 5);
+    g_assert(ATK_IS_TEXT(header));
+    g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING);
+    text = atk_text_get_text(ATK_TEXT(header), 0, -1);
+    g_assert_cmpstr(text, ==, "Block span in a link in a heading\nInline span in a link in a heading");
+    g_free(text);
+
+    header = atk_object_ref_accessible_child(object, 6);
+    g_assert(ATK_IS_TEXT(header));
+    g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING);
+    text = atk_text_get_text(ATK_TEXT(header), 0, -1);
+    g_assert_cmpstr(text, ==, "Block span in a heading\nInline span in a heading");
+    g_free(text);
+
     g_free(textCaretMovedResult);
 
     g_object_unref(header);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to