Changeset 66964 in webkit


Ignore:
Timestamp:
Sep 8, 2010 3:29:00 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-08 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[Gtk] A list item's number/bullet should not be a child of that list item
https://bugs.webkit.org/show_bug.cgi?id=45190

Ignore list markers and prefix them to the text for the item

  • accessibility/gtk/AccessibilityObjectAtk.cpp: (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): Make list markers ignore accessibility for the GTK port.
  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (webkit_accessible_text_get_text): Prefix the text of a marker along with the accessible text for its list item's AtkObject

2010-09-08 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[Gtk] A list item's number/bullet should not be a child of that list item
https://bugs.webkit.org/show_bug.cgi?id=45190

New unit test added.

  • tests/testatk.c: (testWebkitAtkListsOfItems): New test to check ordered/unordered list of items are properly exposed to AT technologies. (main):
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r66963 r66964  
     12010-09-08  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [Gtk] A list item's number/bullet should not be a child of that list item
     6        https://bugs.webkit.org/show_bug.cgi?id=45190
     7
     8        Ignore list markers and prefix them to the text for the item
     9
     10        * accessibility/gtk/AccessibilityObjectAtk.cpp:
     11        (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
     12        Make list markers ignore accessibility for the GTK port.
     13        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     14        (webkit_accessible_text_get_text): Prefix the text of a marker
     15        along with the accessible text for its list item's AtkObject
     16
    1172010-09-08  Adam Barth  <abarth@webkit.org>
    218
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp

    r64475 r66964  
    7272        return IgnoreObject;
    7373
     74    // Bullets/numbers for list items shouldn't be exposed as AtkObjects.
     75    if (roleValue() == ListMarkerRole)
     76        return IgnoreObject;
     77
    7478    return DefaultBehavior;
    7579}
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r65077 r66964  
    3535
    3636#include "AXObjectCache.h"
     37#include "AccessibilityList.h"
    3738#include "AccessibilityListBox.h"
    3839#include "AccessibilityListBoxOption.h"
     
    5556#include "IntRect.h"
    5657#include "NotImplemented.h"
     58#include "RenderListMarker.h"
    5759#include "RenderText.h"
    5860#include "TextEncoding.h"
     
    934936    }
    935937
     938    // Prefix a item number/bullet if needed
     939    if (coreObject->roleValue() == ListItemRole) {
     940        RenderObject* objRenderer = static_cast<AccessibilityRenderObject*>(coreObject)->renderer();
     941        RenderObject* markerRenderer = objRenderer ? objRenderer->firstChild() : 0;
     942        if (markerRenderer && markerRenderer->isListMarker()) {
     943            String markerTxt = toRenderListMarker(markerRenderer)->text();
     944            ret = markerTxt.length() > 0 ? markerTxt + " " + ret : ret;
     945        }
     946    }
     947
    936948    return g_strdup(ret.utf8().data());
    937949}
  • trunk/WebKit/gtk/ChangeLog

    r66887 r66964  
     12010-09-08  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [Gtk] A list item's number/bullet should not be a child of that list item
     6        https://bugs.webkit.org/show_bug.cgi?id=45190
     7
     8        New unit test added.
     9
     10        * tests/testatk.c:
     11        (testWebkitAtkListsOfItems): New test to check ordered/unordered
     12        list of items are properly exposed to AT technologies.
     13        (main):
     14
    1152010-09-07  Martin Robinson  <mrobinson@igalia.com>
    216
  • trunk/WebKit/gtk/tests/testatk.c

    r64475 r66964  
    4747static const char* textWithAttributes = "<html><head><style>.st1 {font-family: monospace; color:rgb(120,121,122);} .st2 {text-decoration:underline; background-color:rgb(80,81,82);}</style></head><body><p style=\"font-size:14; text-align:right;\">This is the <i>first</i><b> sentence of this text.</b></p><p class=\"st1\">This sentence should have an style applied <span class=\"st2\">and this part should have another one</span>.</p><p>x<sub>1</sub><sup>2</sup>=x<sub>2</sub><sup>3</sup></p><p style=\"text-align:center;\">This sentence is the <strike>last</strike> one.</p></body></html>";
    4848
     49static 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>";
     50
    4951static gboolean bail_out(GMainLoop* loop)
    5052{
     
    841843    g_object_unref(long_text);
    842844    g_object_unref(multiline_text);
     845    g_object_unref(webView);
     846}
     847
     848static void testWebkitAtkListsOfItems(void)
     849{
     850    WebKitWebView* webView;
     851    AtkObject* obj;
     852    AtkObject* uList;
     853    AtkObject* oList;
     854    AtkObject* item1;
     855    AtkObject* item2;
     856    AtkObject* item3;
     857    GMainLoop* loop;
     858
     859    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     860    g_object_ref_sink(webView);
     861    GtkAllocation alloc = { 0, 0, 800, 600 };
     862    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
     863    webkit_web_view_load_string(webView, listsOfItems, NULL, NULL, NULL);
     864    loop = g_main_loop_new(NULL, TRUE);
     865
     866    g_timeout_add(100, (GSourceFunc)bail_out, loop);
     867    g_main_loop_run(loop);
     868
     869    obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
     870    g_assert(obj);
     871
     872    // Unordered list
     873
     874    uList = atk_object_ref_accessible_child(obj, 0);
     875    g_assert(ATK_OBJECT(uList));
     876    g_assert(atk_object_get_role(uList) == ATK_ROLE_LIST);
     877    g_assert_cmpint(atk_object_get_n_accessible_children(uList), ==, 3);
     878
     879    item1 = ATK_TEXT(atk_object_ref_accessible_child(uList, 0));
     880    item2 = ATK_TEXT(atk_object_ref_accessible_child(uList, 1));
     881    item3 = ATK_TEXT(atk_object_ref_accessible_child(uList, 2));
     882
     883    g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0);
     884    g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1);
     885    g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1);
     886
     887    g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "\342\200\242 text only");
     888    g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "\342\200\242 link only");
     889    g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "\342\200\242 text and a link");
     890
     891    g_object_unref(item1);
     892    g_object_unref(item2);
     893    g_object_unref(item3);
     894
     895    // Ordered list
     896
     897    oList = atk_object_ref_accessible_child(obj, 1);
     898    g_assert(ATK_OBJECT(oList));
     899    g_assert(atk_object_get_role(oList) == ATK_ROLE_LIST);
     900    g_assert_cmpint(atk_object_get_n_accessible_children(oList), ==, 3);
     901
     902    item1 = ATK_TEXT(atk_object_ref_accessible_child(oList, 0));
     903    item2 = ATK_TEXT(atk_object_ref_accessible_child(oList, 1));
     904    item3 = ATK_TEXT(atk_object_ref_accessible_child(oList, 2));
     905
     906    g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "1 text only");
     907    g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "2 link only");
     908    g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "3 text and a link");
     909
     910    g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0);
     911    g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1);
     912    g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1);
     913
     914    g_object_unref(item1);
     915    g_object_unref(item2);
     916    g_object_unref(item3);
     917
     918    g_object_unref(uList);
     919    g_object_unref(oList);
    843920    g_object_unref(webView);
    844921}
     
    861938    g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes);
    862939    g_test_add_func("/webkit/atk/get_extents", test_webkit_atk_get_extents);
     940    g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
    863941    return g_test_run ();
    864942}
Note: See TracChangeset for help on using the changeset viewer.