Title: [125692] trunk/Source
Revision
125692
Author
[email protected]
Date
2012-08-15 12:18:27 -0700 (Wed, 15 Aug 2012)

Log Message

[Gtk] atk_text_set_caret_offset() fails for table cells
https://bugs.webkit.org/show_bug.cgi?id=83501

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

Source/WebCore:

Allow using text ranges in accessible table cells.

* accessibility/gtk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::allowsTextRanges):
Add table cells to the list of accessibility objects supporting text ranges.

Source/WebKit/gtk:

Update unit test to include setting the caret in a table cell via the AtkText interface.

* tests/testatk.c:
(testWebkitAtkCaretOffsets): Add setting the caret inside the text of a table cell.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125691 => 125692)


--- trunk/Source/WebCore/ChangeLog	2012-08-15 19:08:06 UTC (rev 125691)
+++ trunk/Source/WebCore/ChangeLog	2012-08-15 19:18:27 UTC (rev 125692)
@@ -1,3 +1,16 @@
+2012-08-15  Joanmarie Diggs  <[email protected]>
+
+        [Gtk] atk_text_set_caret_offset() fails for table cells
+        https://bugs.webkit.org/show_bug.cgi?id=83501
+
+        Reviewed by Chris Fleizach.
+
+        Allow using text ranges in accessible table cells.
+
+        * accessibility/gtk/AccessibilityObjectAtk.cpp:
+        (WebCore::AccessibilityObject::allowsTextRanges):
+        Add table cells to the list of accessibility objects supporting text ranges.
+
 2012-08-15  Scott Graham  <[email protected]>
 
         Rename window.internals.fastMallocStatistics to mallocStatistics

Modified: trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp (125691 => 125692)


--- trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp	2012-08-15 19:08:06 UTC (rev 125691)
+++ trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp	2012-08-15 19:18:27 UTC (rev 125692)
@@ -103,7 +103,7 @@
 bool AccessibilityObject::allowsTextRanges() const
 {
     // Check type for the AccessibilityObject.
-    if (isTextControl() || isWebArea() || isGroup() || isLink() || isHeading() || isListItem())
+    if (isTextControl() || isWebArea() || isGroup() || isLink() || isHeading() || isListItem() || isTableCell())
         return true;
 
     // Check roles as the last fallback mechanism.

Modified: trunk/Source/WebKit/gtk/ChangeLog (125691 => 125692)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-08-15 19:08:06 UTC (rev 125691)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-08-15 19:18:27 UTC (rev 125692)
@@ -1,5 +1,17 @@
 2012-08-15  Joanmarie Diggs  <[email protected]>
 
+        [Gtk] atk_text_set_caret_offset() fails for table cells
+        https://bugs.webkit.org/show_bug.cgi?id=83501
+
+        Reviewed by Chris Fleizach.
+
+        Update unit test to include setting the caret in a table cell via the AtkText interface.
+
+        * tests/testatk.c:
+        (testWebkitAtkCaretOffsets): Add setting the caret inside the text of a table cell.
+
+2012-08-15  Joanmarie Diggs  <[email protected]>
+
         [Gtk] atk_text_get_text_at_offset() fails to provide the correct line for paragraphs in list items whose text wraps
         https://bugs.webkit.org/show_bug.cgi?id=83435
 

Modified: trunk/Source/WebKit/gtk/tests/testatk.c (125691 => 125692)


--- trunk/Source/WebKit/gtk/tests/testatk.c	2012-08-15 19:08:06 UTC (rev 125691)
+++ trunk/Source/WebKit/gtk/tests/testatk.c	2012-08-15 19:18:27 UTC (rev 125692)
@@ -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' /></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* 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>";
 
@@ -389,6 +389,23 @@
     offset = atk_text_get_caret_offset(ATK_TEXT(textEntry));
     g_assert_cmpint(offset, ==, 5);
 
+    AtkObject* table = atk_object_ref_accessible_child(object, 4);
+    g_assert(ATK_IS_OBJECT(table));
+    g_assert(atk_object_get_role(table) == ATK_ROLE_TABLE);
+    g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 1);
+
+    AtkObject* tableCell = atk_object_ref_accessible_child(table, 0);
+    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, ==, "a table cell");
+    g_free(text);
+
+    result = atk_text_set_caret_offset(ATK_TEXT(tableCell), 2);
+    g_assert_cmpint(result, ==, TRUE);
+    offset = atk_text_get_caret_offset(ATK_TEXT(tableCell));
+    g_assert_cmpint(offset, ==, 2);
+
     g_free(textCaretMovedResult);
 
     g_object_unref(header);
@@ -401,6 +418,8 @@
     g_object_unref(menuPopup);
     g_object_unref(comboBoxOption);
     g_object_unref(textEntry);
+    g_object_unref(table);
+    g_object_unref(tableCell);
     g_object_unref(webView);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to