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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 17d66c6d
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 Adam Barth <abarth@webkit.org>
Rubber-stamped by Eric Seidel.
......@@ -71,6 +71,10 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO
if (role == StaticTextRole)
return IgnoreObject;
// Bullets/numbers for list items shouldn't be exposed as AtkObjects.
if (roleValue() == ListMarkerRole)
return IgnoreObject;
return DefaultBehavior;
}
......
......@@ -34,6 +34,7 @@
#if HAVE(ACCESSIBILITY)
#include "AXObjectCache.h"
#include "AccessibilityList.h"
#include "AccessibilityListBox.h"
#include "AccessibilityListBoxOption.h"
#include "AccessibilityRenderObject.h"
......@@ -54,6 +55,7 @@
#include "InlineTextBox.h"
#include "IntRect.h"
#include "NotImplemented.h"
#include "RenderListMarker.h"
#include "RenderText.h"
#include "TextEncoding.h"
#include <wtf/text/CString.h>
......@@ -933,6 +935,16 @@ static gchar* webkit_accessible_text_get_text(AtkText* text, gint startOffset, g
ret = ret.substring(start, endOffset - startOffset);
}
// Prefix a item number/bullet if needed
if (coreObject->roleValue() == ListItemRole) {
RenderObject* objRenderer = static_cast<AccessibilityRenderObject*>(coreObject)->renderer();
RenderObject* markerRenderer = objRenderer ? objRenderer->firstChild() : 0;
if (markerRenderer && markerRenderer->isListMarker()) {
String markerTxt = toRenderListMarker(markerRenderer)->text();
ret = markerTxt.length() > 0 ? markerTxt + " " + ret : ret;
}
}
return g_strdup(ret.utf8().data());
}
......
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):
2010-09-07 Martin Robinson <mrobinson@igalia.com>
Reviewed by Xan Lopez.
......
......@@ -46,6 +46,8 @@ static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo<
static 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>";
static 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>";
static gboolean bail_out(GMainLoop* loop)
{
if (g_main_loop_is_running(loop))
......@@ -843,6 +845,81 @@ static void test_webkit_atk_get_extents(void)
g_object_unref(webView);
}
static void testWebkitAtkListsOfItems(void)
{
WebKitWebView* webView;
AtkObject* obj;
AtkObject* uList;
AtkObject* oList;
AtkObject* item1;
AtkObject* item2;
AtkObject* item3;
GMainLoop* loop;
webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_ref_sink(webView);
GtkAllocation alloc = { 0, 0, 800, 600 };
gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
webkit_web_view_load_string(webView, listsOfItems, NULL, NULL, NULL);
loop = g_main_loop_new(NULL, TRUE);
g_timeout_add(100, (GSourceFunc)bail_out, loop);
g_main_loop_run(loop);
obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
g_assert(obj);
// Unordered list
uList = atk_object_ref_accessible_child(obj, 0);
g_assert(ATK_OBJECT(uList));
g_assert(atk_object_get_role(uList) == ATK_ROLE_LIST);
g_assert_cmpint(atk_object_get_n_accessible_children(uList), ==, 3);
item1 = ATK_TEXT(atk_object_ref_accessible_child(uList, 0));
item2 = ATK_TEXT(atk_object_ref_accessible_child(uList, 1));
item3 = ATK_TEXT(atk_object_ref_accessible_child(uList, 2));
g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0);
g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1);
g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1);
g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "\342\200\242 text only");
g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "\342\200\242 link only");
g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "\342\200\242 text and a link");
g_object_unref(item1);
g_object_unref(item2);
g_object_unref(item3);
// Ordered list
oList = atk_object_ref_accessible_child(obj, 1);
g_assert(ATK_OBJECT(oList));
g_assert(atk_object_get_role(oList) == ATK_ROLE_LIST);
g_assert_cmpint(atk_object_get_n_accessible_children(oList), ==, 3);
item1 = ATK_TEXT(atk_object_ref_accessible_child(oList, 0));
item2 = ATK_TEXT(atk_object_ref_accessible_child(oList, 1));
item3 = ATK_TEXT(atk_object_ref_accessible_child(oList, 2));
g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "1 text only");
g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "2 link only");
g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "3 text and a link");
g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0);
g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1);
g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1);
g_object_unref(item1);
g_object_unref(item2);
g_object_unref(item3);
g_object_unref(uList);
g_object_unref(oList);
g_object_unref(webView);
}
int main(int argc, char** argv)
{
g_thread_init(NULL);
......@@ -860,6 +937,7 @@ int main(int argc, char** argv)
g_test_add_func("/webkit/atk/getHeadersInTable", testWebkitAtkGetHeadersInTable);
g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes);
g_test_add_func("/webkit/atk/get_extents", test_webkit_atk_get_extents);
g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
return g_test_run ();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment