Changeset 75250 in webkit


Ignore:
Timestamp:
Jan 7, 2011 9:34:02 AM (13 years ago)
Author:
mario@webkit.org
Message:

2011-01-07 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Chris Fleizach.

GTK: AX: atk tests need to be updated after recent changes
https://bugs.webkit.org/show_bug.cgi?id=51932

Make sure we can always get the right accesssible parent for an
AtkObject when traversing the hierarchy bottom up.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (isRootObject): New function to check whether an AccessibilityObject is the root one or not, according to the latest changes in the hierarchy. (atkParentOfRootObject): Gets the appropriate AtkObject from GTK's GAIL as the parent of the root AtkObject from WebCore. (webkit_accessible_get_parent): Use atkParentOfRootObject. (webkit_accessible_get_index_in_parent): Ditto. (atkRole): Expose AccessibilityObjects with ScrollAreaRole as AtkObject's of role ATK_ROLE_SCROLLED_PANE.

2011-01-07 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Chris Fleizach.

GTK: AX: atk tests need to be updated after recent changes
https://bugs.webkit.org/show_bug.cgi?id=51932

Fix gtk_widget_get_accessible() in WebKitWebView to keep returning
the AtkObject of role ATK_ROLE_DOCUMENT_FRAME.

With the change to support WK2 accessibility, the root object of
the AX hierarchy is different from what GTK expects as the current
hirarchy right now includes a new accessible object as the parent
of the accessible web area (AXScrollView).

  • webkit/webkitwebview.cpp: (webkit_web_view_get_accessible): Return the first child of the wrapper associated to the root accessible object in the document, to keep everything in the GTK port working as it used to be.

Re-enable skipped ATK unit tests now they are passing again.

  • tests/testatk.c: (main): Re-enable skipped tests.
  • tests/testatkroles.c: (main): Ditto.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r75249 r75250  
     12011-01-07  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Chris Fleizach.
     4
     5        GTK: AX: atk tests need to be updated after recent changes
     6        https://bugs.webkit.org/show_bug.cgi?id=51932
     7
     8        Make sure we can always get the right accesssible parent for an
     9        AtkObject when traversing the hierarchy bottom up.
     10
     11        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     12        (isRootObject): New function to check whether an
     13        AccessibilityObject is the root one or not, according to the
     14        latest changes in the hierarchy.
     15        (atkParentOfRootObject): Gets the appropriate AtkObject from GTK's
     16        GAIL as the parent of the root AtkObject from WebCore.
     17        (webkit_accessible_get_parent): Use atkParentOfRootObject.
     18        (webkit_accessible_get_index_in_parent): Ditto.
     19        (atkRole): Expose AccessibilityObjects with ScrollAreaRole as
     20        AtkObject's of role ATK_ROLE_SCROLLED_PANE.
     21
    1222011-01-07  Zhenyao Mo  <zmo@google.com>
    223
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r75034 r75250  
    235235static gpointer webkit_accessible_parent_class = 0;
    236236
    237 static AtkObject* atkParentOfWebView(AtkObject* object)
    238 {
    239     AccessibilityObject* coreParent = core(object)->parentObjectUnignored();
    240 
    241     // The top level web view claims to not have a parent. This makes it
     237static bool isRootObject(AccessibilityObject* coreObject)
     238{
     239    // The root accessible object in WebCore is always an object with
     240    // the ScrolledArea role with one child with the WebArea role.
     241    if (!coreObject || !coreObject->isScrollView())
     242        return false;
     243
     244    AccessibilityObject* firstChild = coreObject->firstChild();
     245    if (!firstChild || !firstChild->isWebArea())
     246        return false;
     247
     248    return true;
     249}
     250
     251static AtkObject* atkParentOfRootObject(AtkObject* object)
     252{
     253    AccessibilityObject* coreObject = core(object);
     254    AccessibilityObject* coreParent = coreObject->parentObjectUnignored();
     255
     256    // The top level object claims to not have a parent. This makes it
    242257    // impossible for assistive technologies to ascend the accessible
    243258    // hierarchy all the way to the application. (Bug 30489)
    244     if (!coreParent && core(object)->isWebArea()) {
    245         HostWindow* hostWindow = core(object)->document()->view()->hostWindow();
     259    if (!coreParent && isRootObject(coreObject)) {
     260        HostWindow* hostWindow = coreObject->document()->view()->hostWindow();
    246261        if (hostWindow) {
    247             PlatformPageClient webView = hostWindow->platformPageClient();
    248             if (webView) {
    249                 GtkWidget* webViewParent = gtk_widget_get_parent(webView);
    250                 if (webViewParent)
    251                     return gtk_widget_get_accessible(webViewParent);
     262            PlatformPageClient scrollView = hostWindow->platformPageClient();
     263            if (scrollView) {
     264                GtkWidget* scrollViewParent = gtk_widget_get_parent(scrollView);
     265                if (scrollViewParent)
     266                    return gtk_widget_get_accessible(scrollViewParent);
    252267            }
    253268        }
     
    262277static AtkObject* webkit_accessible_get_parent(AtkObject* object)
    263278{
    264     AccessibilityObject* coreParent = core(object)->parentObjectUnignored();
    265     if (!coreParent && core(object)->isWebArea())
    266         return atkParentOfWebView(object);
     279    AccessibilityObject* coreObject = core(object);
     280    AccessibilityObject* coreParent = coreObject->parentObjectUnignored();
     281    if (!coreParent && isRootObject(coreObject))
     282        return atkParentOfRootObject(object);
    267283
    268284    if (!coreParent)
     
    301317    AccessibilityObject* parent = coreObject->parentObjectUnignored();
    302318
    303     if (!parent && core(object)->isWebArea()) {
    304         AtkObject* atkParent = atkParentOfWebView(object);
     319    if (!parent && isRootObject(coreObject)) {
     320        AtkObject* atkParent = atkParentOfRootObject(object);
    305321        if (!atkParent)
    306322            return -1;
     
    417433    case ScrollBarRole:
    418434        return ATK_ROLE_SCROLL_BAR;
     435    case ScrollAreaRole:
     436        return ATK_ROLE_SCROLL_PANE;
    419437    case GridRole: // Is this right?
    420438    case TableRole:
  • trunk/WebKit/gtk/ChangeLog

    r75201 r75250  
     12011-01-07  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Chris Fleizach.
     4
     5        GTK: AX: atk tests need to be updated after recent changes
     6        https://bugs.webkit.org/show_bug.cgi?id=51932
     7
     8        Fix gtk_widget_get_accessible() in WebKitWebView to keep returning
     9        the AtkObject of role ATK_ROLE_DOCUMENT_FRAME.
     10
     11        With the change to support WK2 accessibility, the root object of
     12        the AX hierarchy is different from what GTK expects as the current
     13        hirarchy right now includes a new accessible object as the parent
     14        of the accessible web area (AXScrollView).
     15
     16        * webkit/webkitwebview.cpp:
     17        (webkit_web_view_get_accessible): Return the first child of the
     18        wrapper associated to the root accessible object in the document,
     19        to keep everything in the GTK port working as it used to be.
     20
     21        Re-enable skipped ATK unit tests now they are passing again.
     22
     23        * tests/testatk.c:
     24        (main): Re-enable skipped tests.
     25        * tests/testatkroles.c:
     26        (main): Ditto.
     27
    1282011-01-06  Martin Robinson  <mrobinson@igalia.com>
    229
  • trunk/WebKit/gtk/tests/testatk.c

    r75201 r75250  
    13141314    gtk_test_init(&argc, &argv, 0);
    13151315
    1316     /* See: https://bugs.webkit.org/show_bug.cgi?id=51932
    13171316    g_test_bug_base("https://bugs.webkit.org/");
    13181317    g_test_add_func("/webkit/atk/comboBox", testWebkitAtkComboBox);
     
    13341333    g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
    13351334    g_test_add_func("/webkit/atk/textChangedNotifications", testWebkitAtkTextChangedNotifications);
    1336     */
    13371335    return g_test_run ();
    13381336}
  • trunk/WebKit/gtk/tests/testatkroles.c

    r75201 r75250  
    308308    g_test_bug_base("https://bugs.webkit.org/");
    309309
    310     /* See: https://bugs.webkit.org/show_bug.cgi?id=51932
    311310    g_test_add("/webkit/atk/test_webkit_atk_get_role_document_frame",
    312311               AtkRolesFixture, HTML_DOCUMENT_FRAME,
     
    369368               atk_roles_fixture_teardown);
    370369
    371     // Form roles
     370    /* Form roles */
    372371    g_test_add("/webkit/atk/test_webkit_atk_get_role_form",
    373372               AtkRolesFixture, HTML_FORM,
     
    416415               test_webkit_atk_get_role_radio_button,
    417416               atk_roles_fixture_teardown);
    418     */
    419417
    420418    return g_test_run();
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r75031 r75250  
    14411441    WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
    14421442    if (!core(webView))
    1443         return NULL;
     1443        return 0;
    14441444
    14451445    AXObjectCache::enableAccessibility();
     
    14471447    Frame* coreFrame = core(webView)->mainFrame();
    14481448    if (!coreFrame)
    1449         return NULL;
     1449        return 0;
    14501450
    14511451    Document* doc = coreFrame->document();
    14521452    if (!doc)
    1453         return NULL;
    1454 
    1455     AccessibilityObject* coreAccessible = doc->axObjectCache()->rootObject();
    1456     if (!coreAccessible || !coreAccessible->wrapper())
    1457         return NULL;
    1458 
    1459     return coreAccessible->wrapper();
     1453        return 0;
     1454
     1455    AccessibilityObject* rootAccessible = doc->axObjectCache()->rootObject();
     1456    if (!rootAccessible)
     1457        return 0;
     1458
     1459    // We need to return the root accessibility object's first child
     1460    // to get to the actual ATK Object associated with the web view.
     1461    // See https://bugs.webkit.org/show_bug.cgi?id=51932
     1462    AtkObject* axRoot = rootAccessible->wrapper();
     1463    if (!axRoot || !ATK_IS_OBJECT(axRoot))
     1464        return 0;
     1465
     1466    AtkObject* axWebView = atk_object_ref_accessible_child(ATK_OBJECT(axRoot), 0);
     1467    if (!axWebView || !ATK_IS_OBJECT(axWebView))
     1468        return 0;
     1469
     1470    // We don't want the extra reference returned by ref_accessible_child.
     1471    g_object_unref(axWebView);
     1472    return axWebView;
    14601473}
    14611474
Note: See TracChangeset for help on using the changeset viewer.