Title: [100597] trunk/Source
Revision
100597
Author
ma...@webkit.org
Date
2011-11-17 03:50:07 -0800 (Thu, 17 Nov 2011)

Log Message

[GTK] Consider parent AtkObject in webkit_accessible_get_parent(), if already set
https://bugs.webkit.org/show_bug.cgi?id=72525

Reviewed by Xan Lopez.

Source/WebCore:

* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(webkit_accessible_get_parent): Call to the implementation of
atk_object_get_parent in AtkObject class to check whether a parent
AtkObject has been previously set, before trying to find one.

Source/WebKit/gtk:

* tests/testatk.c:
(testWebkitAtkSetParentForObject): New unit test to check that
calls to atk_object_get_parent() over a WebKitGTK's accessibility
wrapper object returns its parent AtkObject if previously set.
(main): Added new test.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (100596 => 100597)


--- trunk/Source/WebCore/ChangeLog	2011-11-17 11:47:31 UTC (rev 100596)
+++ trunk/Source/WebCore/ChangeLog	2011-11-17 11:50:07 UTC (rev 100597)
@@ -1,3 +1,15 @@
+2011-11-17  Mario Sanchez Prada  <msanc...@igalia.com>
+
+        [GTK] Consider parent AtkObject in webkit_accessible_get_parent(), if already set
+        https://bugs.webkit.org/show_bug.cgi?id=72525
+
+        Reviewed by Xan Lopez.
+
+        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+        (webkit_accessible_get_parent): Call to the implementation of
+        atk_object_get_parent in AtkObject class to check whether a parent
+        AtkObject has been previously set, before trying to find one.
+
 2011-11-17  Pavel Feldman  <pfeld...@google.com>
 
         Not reviewed: fix IE user agents strings in the inspector.

Modified: trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp (100596 => 100597)


--- trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp	2011-11-17 11:47:31 UTC (rev 100596)
+++ trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp	2011-11-17 11:50:07 UTC (rev 100597)
@@ -295,6 +295,12 @@
 
 static AtkObject* webkit_accessible_get_parent(AtkObject* object)
 {
+    // Check first if the parent has been already set.
+    AtkObject* accessibleParent = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->get_parent(object);
+    if (accessibleParent)
+        return accessibleParent;
+
+    // Parent not set yet, so try to find it in the hierarchy.
     AccessibilityObject* coreObject = core(object);
     if (!coreObject)
         return 0;

Modified: trunk/Source/WebKit/gtk/ChangeLog (100596 => 100597)


--- trunk/Source/WebKit/gtk/ChangeLog	2011-11-17 11:47:31 UTC (rev 100596)
+++ trunk/Source/WebKit/gtk/ChangeLog	2011-11-17 11:50:07 UTC (rev 100597)
@@ -1,5 +1,18 @@
 2011-11-17  Mario Sanchez Prada  <msanc...@igalia.com>
 
+        [GTK] Consider parent AtkObject in webkit_accessible_get_parent(), if already set
+        https://bugs.webkit.org/show_bug.cgi?id=72525
+
+        Reviewed by Xan Lopez.
+
+        * tests/testatk.c:
+        (testWebkitAtkSetParentForObject): New unit test to check that
+        calls to atk_object_get_parent() over a WebKitGTK's accessibility
+        wrapper object returns its parent AtkObject if previously set.
+        (main): Added new test.
+
+2011-11-17  Mario Sanchez Prada  <msanc...@igalia.com>
+
         [GTK] ATK API tests failing because of patch for bug 72390
         https://bugs.webkit.org/show_bug.cgi?id=72592
 

Modified: trunk/Source/WebKit/gtk/tests/testatk.c (100596 => 100597)


--- trunk/Source/WebKit/gtk/tests/testatk.c	2011-11-17 11:47:31 UTC (rev 100596)
+++ trunk/Source/WebKit/gtk/tests/testatk.c	2011-11-17 11:50:07 UTC (rev 100597)
@@ -1641,6 +1641,44 @@
     g_object_unref(box);
 }
 
+static void testWebkitAtkSetParentForObject()
+{
+    WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+    GtkAllocation allocation = { 0, 0, 800, 600 };
+    gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);
+    webkit_web_view_load_string(webView, contents, 0, 0, 0);
+
+    /* Put the webview in a window to check the normal behaviour keeps
+       working as expected when the webview is inside a container. */
+    GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    g_object_ref_sink(window);
+    gtk_container_add(GTK_CONTAINER(window), webView);
+
+    AtkObject* axRoot = gtk_widget_get_accessible(GTK_WIDGET(webView));
+    g_assert(ATK_IS_OBJECT(axRoot));
+
+    AtkObject* axWindow = gtk_widget_get_accessible(window);
+    g_assert(ATK_IS_OBJECT(axWindow));
+
+    /* The parent of the root object is the window's a11y object. */
+    g_assert(atk_object_get_parent(axRoot) == axWindow);
+
+    /* We now need to use something as a an alternative parent for
+       the a11y object associated with the root of the DOM tree. */
+    GtkWidget* button = gtk_button_new();
+    g_object_ref_sink(button);
+
+    AtkObject* axButton = gtk_widget_get_accessible (button);
+    g_assert(ATK_IS_OBJECT(axButton));
+
+    /* Manually set the button's a11y object as the parent and check. */
+    atk_object_set_parent(axRoot, axButton);
+    g_assert(atk_object_get_parent(axRoot) == axButton);
+
+    g_object_unref(button);
+    g_object_unref(window);
+}
+
 int main(int argc, char** argv)
 {
     gtk_test_init(&argc, &argv, 0);
@@ -1669,6 +1707,7 @@
     g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
     g_test_add_func("/webkit/atk/textChangedNotifications", testWebkitAtkTextChangedNotifications);
     g_test_add_func("/webkit/atk/parentForRootObject", testWebkitAtkParentForRootObject);
+    g_test_add_func("/webkit/atk/setParentForObject", testWebkitAtkSetParentForObject);
     return g_test_run ();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to