Changeset 126243 in webkit


Ignore:
Timestamp:
Aug 21, 2012 6:37:04 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Joanmarie Diggs <jdiggs@igalia.com> 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.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126241 r126243  
     12012-08-21  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        [Gtk] No accessible caret-moved events found in certain content
     4        https://bugs.webkit.org/show_bug.cgi?id=72811
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Part of the bug is due to objects which should claim to implement AtkText
     9        failed to do so as a result of containing a mixture of inline and block
     10        spans.
     11
     12        An updated unit test was provided.
     13
     14        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
     15        (roleIsTextType): New method to check if a role is one expected to have
     16        implemented the AtkText interface. Currently that is defined as:
     17         - ParagraphRole
     18         - HeadingRole
     19         - DivRole
     20         - CellRole
     21        (getInterfaceMaskFromObject): If a role is one of the text type roles,
     22        automatically add WAI_TEXT to the accessible object's interface mask.
     23
    1242012-08-21  Tony Chang  <tony@chromium.org>
    225
  • trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp

    r108463 r126243  
    816816}
    817817
     818static bool roleIsTextType(AccessibilityRole role)
     819{
     820    return role == ParagraphRole || role == HeadingRole || role == DivRole || role == CellRole;
     821}
     822
    818823static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject)
    819824{
     
    857862            if (role != TableRole) {
    858863                interfaceMask |= 1 << WAI_HYPERTEXT;
    859                 if (renderer && renderer->childrenInline())
     864                if ((renderer && renderer->childrenInline()) || roleIsTextType(role))
    860865                    interfaceMask |= 1 << WAI_TEXT;
    861866            }
  • trunk/Source/WebKit/gtk/ChangeLog

    r126209 r126243  
     12012-08-21  Joanmarie Diggs  <jdiggs@igalia.com>
     2        [Gtk] No accessible caret-moved events found in certain content
     3        https://bugs.webkit.org/show_bug.cgi?id=72811
     4
     5        Reviewed by Chris Fleizach.
     6
     7        Part of the bug is due to objects which should claim to implement AtkText
     8        failed to do so as a result of containing a mixture of inline and block
     9        spans.
     10
     11        An updated unit test was provided.
     12
     13        * tests/testatk.c:
     14        (testWebkitAtkCaretOffsets): Added instances of objects containing a
     15        mixture of inline and block spans and tested that they implement AtkText
     16        and contain the right textual contents.
     17
    1182012-08-21  Kihong Kwon  <kihong.kwon@samsung.com>
    219
  • trunk/Source/WebKit/gtk/tests/testatk.c

    r125692 r126243  
    6666static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ul><ol><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ol></body></html>";
    6767
    68 static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href='http://foo.bar.baz/'>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>";
     68static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href='http://foo.bar.baz/'>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='foo'><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='foo'><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='foo'><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>";
    6969
    7070static const char* textForSelections = "<html><body><p>A paragraph with plain text</p><p>A paragraph with <a href='http://webkit.org'>a link</a> in the middle</p><ol><li>A list item</li></ol><select></body></html>";
     
    337337    g_assert(ATK_OBJECT(list));
    338338    g_assert(atk_object_get_role(list) == ATK_ROLE_LIST);
    339     g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 1);
     339    g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 3);
    340340
    341341    AtkObject* listItem = atk_object_ref_accessible_child(list, 0);
     
    345345    g_free (text);
    346346
     347    listItem = atk_object_ref_accessible_child(list, 1);
     348    g_assert(ATK_IS_TEXT(listItem));
     349    text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
     350    g_assert_cmpstr(text, ==, "2. Block span in a list item\nInline span in a list item");
     351    g_free (text);
     352
     353    listItem = atk_object_ref_accessible_child(list, 2);
     354    g_assert(ATK_IS_TEXT(listItem));
     355    text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
     356    g_assert_cmpstr(text, ==, "3. Block span in a link in a list item\nInline span in a link in a list item");
     357    g_free (text);
     358
    347359    /* It's not possible to place the caret inside an item's marker. */
    348360    result = atk_text_set_caret_offset(ATK_TEXT(listItem), 1);
     
    361373    AtkObject* comboBox = atk_object_ref_accessible_child(panel, 0);
    362374    g_assert(ATK_IS_OBJECT(comboBox));
     375    g_assert(!ATK_IS_TEXT(comboBox));
    363376    g_assert(atk_object_get_role(comboBox) == ATK_ROLE_COMBO_BOX);
    364377
    365378    AtkObject* menuPopup = atk_object_ref_accessible_child(comboBox, 0);
    366379    g_assert(ATK_IS_OBJECT(menuPopup));
     380    g_assert(!ATK_IS_TEXT(menuPopup));
    367381    g_assert(atk_object_get_role(menuPopup) == ATK_ROLE_MENU);
    368382
     
    373387    text = atk_text_get_text(ATK_TEXT(comboBoxOption), 0, -1);
    374388    g_assert_cmpstr(text, ==, "An option in a combo box");
     389    g_free(text);
    375390
    376391    /* It's not possible to place the caret inside an option for a combobox. */
     
    384399    text = atk_text_get_text(ATK_TEXT(textEntry), 0, -1);
    385400    g_assert_cmpstr(text, ==, "foo bar baz");
     401    g_free(text);
    386402
    387403    result = atk_text_set_caret_offset(ATK_TEXT(textEntry), 5);
     
    392408    AtkObject* table = atk_object_ref_accessible_child(object, 4);
    393409    g_assert(ATK_IS_OBJECT(table));
     410    g_assert(!ATK_IS_TEXT(table));
    394411    g_assert(atk_object_get_role(table) == ATK_ROLE_TABLE);
    395     g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 1);
     412    g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 4);
    396413
    397414    AtkObject* tableCell = atk_object_ref_accessible_child(table, 0);
     
    406423    offset = atk_text_get_caret_offset(ATK_TEXT(tableCell));
    407424    g_assert_cmpint(offset, ==, 2);
     425
     426    /* Even empty table cells should implement AtkText, but report an empty string */
     427    tableCell = atk_object_ref_accessible_child(table, 1);
     428    g_assert(ATK_IS_TEXT(tableCell));
     429    g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
     430    text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
     431    g_assert_cmpstr(text, ==, "");
     432    g_free(text);
     433
     434    tableCell = atk_object_ref_accessible_child(table, 2);
     435    g_assert(ATK_IS_TEXT(tableCell));
     436    g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
     437    text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
     438    g_assert_cmpstr(text, ==, "Block span in a link in a table cell\nInline span in a link in a table cell");
     439    g_free(text);
     440
     441    tableCell = atk_object_ref_accessible_child(table, 3);
     442    g_assert(ATK_IS_TEXT(tableCell));
     443    g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
     444    text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
     445    g_assert_cmpstr(text, ==, "Block span in a table cell\nInline span in a table cell");
     446    g_free(text);
     447
     448    header = atk_object_ref_accessible_child(object, 5);
     449    g_assert(ATK_IS_TEXT(header));
     450    g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING);
     451    text = atk_text_get_text(ATK_TEXT(header), 0, -1);
     452    g_assert_cmpstr(text, ==, "Block span in a link in a heading\nInline span in a link in a heading");
     453    g_free(text);
     454
     455    header = atk_object_ref_accessible_child(object, 6);
     456    g_assert(ATK_IS_TEXT(header));
     457    g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING);
     458    text = atk_text_get_text(ATK_TEXT(header), 0, -1);
     459    g_assert_cmpstr(text, ==, "Block span in a heading\nInline span in a heading");
     460    g_free(text);
    408461
    409462    g_free(textCaretMovedResult);
Note: See TracChangeset for help on using the changeset viewer.