Hi, I've recently started to look at a11y issues in WebKitGtk (nothing too impressive, just taking a look by the moment :-)), and I found the implementation a bit strange, and not sure whethers there's a reason for that I'm missing (most likely, I'd say):
// WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp AccessibilityUIElement AccessibilityController::rootElement() { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); // The presumed, desired rootElement is the parent of the web view. GtkWidget* webViewParent = gtk_widget_get_parent(GTK_WIDGET(view)); AtkObject* axObject = gtk_widget_get_accessible(webViewParent); return AccessibilityUIElement(axObject); } As far as I can understand that code, the AtkObject being returned here is the a11y object for the parent of the WebView widget, which it's going to be another GtkWidget, most likely an GtkVBox, or some kind of container like that. However, as I can extract from the (a11y) tests, the root element should return instead the a11y object associated to the root of the document being rendered, which seems to be the <body> element, as far as I can understand from other similar tests. Hence, if my guessings are right, that would mean the implementation of this function would be wrong and that perhaps some kind of solution as the proposed in the attached patch would be a better one, but not sure enough yet as to file a bug, so I'd appreaciate if someone could shed some light on this topic before. So that's it... any idea/comment on this? Thanks in advance, Mario PS: FYI, the proposed patch gets the same results wrt a11y tests (same number of failed/succeeded tests) with just a difference: the test aria-controls-with-tabs.html stops outputting the following error to stderr: atk_object_ref_accessible_child: assertion `ATK_IS_OBJECT (accessible)' failed atk_object_ref_accessible_child: assertion `ATK_IS_OBJECT (accessible)' failed atk_object_ref_accessible_child: assertion `ATK_IS_OBJECT (accessible)' failed So maybe it's not a so bad patch after all :-)
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 2642d50..d1a02c6 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -325,6 +325,9 @@ extern "C" { webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame); WEBKIT_API AtkObject* + webkit_web_frame_get_root_accessible_element(WebKitWebFrame* frame); + + WEBKIT_API AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame); WEBKIT_API gchar* diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp index 344f94e..49002d1 100644 --- a/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/WebKit/gtk/webkit/webkitwebframe.cpp @@ -1116,7 +1116,7 @@ gsize webkit_gc_count_javascript_objects() } -AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame) +AtkObject* webkit_web_frame_get_root_accessible_element(WebKitWebFrame* frame) { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); @@ -1133,10 +1133,22 @@ AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame return NULL; AtkObject* wrapper = priv->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper(); - if (!wrapper) + return wrapper; +#else + return NULL; +#endif +} + +AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + +#if HAVE(ACCESSIBILITY) + AtkObject* root = webkit_web_frame_get_root_accessible_element (frame); + if (!root) return NULL; - return webkit_accessible_get_focused_element(WEBKIT_ACCESSIBLE(wrapper)); + return webkit_accessible_get_focused_element(WEBKIT_ACCESSIBLE(root)); #else return NULL; #endif diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp index ab9f021..022ced1 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp @@ -35,6 +35,7 @@ #include <webkit/webkit.h> extern "C" { +extern AtkObject* webkit_web_frame_get_root_accessible_element(WebKitWebFrame*); extern AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame*); } @@ -63,13 +64,11 @@ AccessibilityUIElement AccessibilityController::focusedElement() AccessibilityUIElement AccessibilityController::rootElement() { - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + AtkObject* accessible = webkit_web_frame_get_root_accessible_element(mainFrame); + if (!accessible) + return 0; - // The presumed, desired rootElement is the parent of the web view. - GtkWidget* webViewParent = gtk_widget_get_parent(GTK_WIDGET(view)); - AtkObject* axObject = gtk_widget_get_accessible(webViewParent); - - return AccessibilityUIElement(axObject); + return AccessibilityUIElement(accessible); } void AccessibilityController::setLogFocusEvents(bool)
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev