Title: [139250] trunk
Revision
139250
Author
commit-qu...@webkit.org
Date
2013-01-09 16:09:41 -0800 (Wed, 09 Jan 2013)

Log Message

[GTK] accessibility/aria-labelledby-overrides-label.html requires a proper baseline
https://bugs.webkit.org/show_bug.cgi?id=105638

Patch by Joanmarie Diggs <jdi...@igalia.com> on 2013-01-09
Reviewed by Martin Robinson.

The test was failing for two reasons:
- AccessibilityRenderObject::correspondingLabelForControlElement() was
  not ignoring the ARIA labelled-by property
- AccessibilityController::accessibleElementById() was not implemented

Because getting an element by ID cannot be done in the UIProcess, the
decision was made to expose the element's ID as an accessible attribute
of the object.

In addition, fixing the bug in AccessibilityRenderObject made it possible
to eliminate the Gtk platform-specific expectations for another test.

Source/WebCore:

No new tests; instead, the failing test was unskipped and a proper baseline
provided.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::correspondingLabelForControlElement):
Return null for objects where hasTextAlternative() is true.
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes): Expose the element's ID as an accessible
attribute.

Tools:

* DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
(childElementById): Added. Walks the tree looking for the AtkObject
Attribute which exposes the HTML element's ID.
(AccessibilityController::accessibleElementById): Implemented.
* DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
(AccessibilityUIElement::title): Modified to print out "AXTitle: " even
when there is no title, as is done with the Mac port.
* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
(WTR):
* WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp:
(WTR::childElementById): Added. Walks the tree looking for the AtkObject
Attribute which exposes the HTML element's ID.
(WTR):
(WTR::AccessibilityController::accessibleElementById): Implemented.
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::title): Modified to print out "AXTitle: "
even when there is no title, as is done with the Mac port.

LayoutTests:

* accessibility/aria-labelledby-overrides-label-expected.txt: Added.
* accessibility/radio-button-title-label-expected.txt: Modified based on
null check which was added and which gets included in the test output.
* accessibility/radio-button-title-label.html: Check to see that we have
a titleUIElement before attempting to get its title.
* platform/gtk/TestExpectations: Unskipped the previously failing test.
* platform/gtk/accessibility/radio-button-title-label-expected.txt: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139249 => 139250)


--- trunk/LayoutTests/ChangeLog	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/LayoutTests/ChangeLog	2013-01-10 00:09:41 UTC (rev 139250)
@@ -1,3 +1,30 @@
+2013-01-09  Joanmarie Diggs  <jdi...@igalia.com>
+
+        [GTK] accessibility/aria-labelledby-overrides-label.html requires a proper baseline
+        https://bugs.webkit.org/show_bug.cgi?id=105638
+
+        Reviewed by Martin Robinson.
+
+        The test was failing for two reasons:
+        - AccessibilityRenderObject::correspondingLabelForControlElement() was
+          not ignoring the ARIA labelled-by property
+        - AccessibilityController::accessibleElementById() was not implemented
+
+        Because getting an element by ID cannot be done in the UIProcess, the
+        decision was made to expose the element's ID as an accessible attribute
+        of the object.
+
+        In addition, fixing the bug in AccessibilityRenderObject made it possible
+        to eliminate the Gtk platform-specific expectations for another test.
+
+        * accessibility/aria-labelledby-overrides-label-expected.txt: Added.
+        * accessibility/radio-button-title-label-expected.txt: Modified based on
+        null check which was added and which gets included in the test output.
+        * accessibility/radio-button-title-label.html: Check to see that we have
+        a titleUIElement before attempting to get its title.
+        * platform/gtk/TestExpectations: Unskipped the previously failing test.
+        * platform/gtk/accessibility/radio-button-title-label-expected.txt: Removed.
+
 2013-01-09  Max Vujovic  <mvujo...@adobe.com>
 
         [CSS Shaders] Detached identifier after mesh box type is not applied

Added: trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt (0 => 139250)


--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt	2013-01-10 00:09:41 UTC (rev 139250)
@@ -0,0 +1,13 @@
+Shut down computer after  minutes
+This tests that if aria-labelledby is used, then label elements are not used
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS text.description is 'AXDescription: Shut down computer after 10 minutes'
+PASS text.titleUIElement() != null && text.titleUIElement().isValid is false
+Label element role is: AXRole: AXLabel
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/accessibility/radio-button-title-label-expected.txt (139249 => 139250)


--- trunk/LayoutTests/accessibility/radio-button-title-label-expected.txt	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/LayoutTests/accessibility/radio-button-title-label-expected.txt	2013-01-10 00:09:41 UTC (rev 139250)
@@ -10,7 +10,7 @@
 PASS !titleUIElement || titleUIElement.title == 'AXTitle: ' is true
 PASS focusedElement.description is 'AXDescription: radio3'
 PASS focusedElement.title is 'AXTitle: '
-PASS titleUIElement.title is 'AXTitle: '
+PASS !titleUIElement || titleUIElement.title == 'AXTitle: ' is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/radio-button-title-label.html (139249 => 139250)


--- trunk/LayoutTests/accessibility/radio-button-title-label.html	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/LayoutTests/accessibility/radio-button-title-label.html	2013-01-10 00:09:41 UTC (rev 139250)
@@ -50,7 +50,7 @@
             titleUIElement = focusedElement.titleUIElement();
             shouldBe("focusedElement.description", "'AXDescription: radio3'");
             shouldBe("focusedElement.title", "'AXTitle: '");
-            shouldBe("titleUIElement.title", "'AXTitle: '");
+            shouldBeTrue("!titleUIElement || titleUIElement.title == 'AXTitle: '");
 
         }
     </script>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (139249 => 139250)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2013-01-10 00:09:41 UTC (rev 139250)
@@ -47,7 +47,6 @@
 webkit.org/b/70606 accessibility/menu-list-sends-change-notification.html [ Missing ]
 webkit.org/b/70606 accessibility/multiselect-list-reports-active-option.html [ Missing ]
 webkit.org/b/70606 accessibility/notification-listeners.html [ Missing ]
-webkit.org/b/105638 accessibility/aria-labelledby-overrides-label.html [ Missing ]
 
 webkit.org/b/105639 fast/inline/justify-emphasis-inline-box.html [ Missing ]
 

Deleted: trunk/LayoutTests/platform/gtk/accessibility/radio-button-title-label-expected.txt (139249 => 139250)


--- trunk/LayoutTests/platform/gtk/accessibility/radio-button-title-label-expected.txt	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/LayoutTests/platform/gtk/accessibility/radio-button-title-label-expected.txt	2013-01-10 00:09:41 UTC (rev 139250)
@@ -1,22 +0,0 @@
-This test checks that radio buttons expose title ui elements correctly under a variety of cirmcumstances. In general, the should disappear and act as the title for the radio button.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS focusedElement.title is 'AXTitle: LABEL'
-PASS !titleUIElement || titleUIElement.title == 'AXTitle: ' is true
-PASS focusedElement.description is 'AXDescription: LABEL2a'
-FAIL focusedElement.title should be AXTitle: . Was AXTitle: LABEL2.
-PASS !titleUIElement || titleUIElement.title == 'AXTitle: ' is true
-PASS focusedElement.description is 'AXDescription: radio3'
-FAIL focusedElement.title should be AXTitle: . Was AXTitle: LABEL3.
-PASS titleUIElement.title is 'AXTitle: '
-PASS successfullyParsed is true
-
-TEST COMPLETE
-Test
-LABEL  Test
-LABEL2
-LABEL2a
-Test
-LABEL3

Modified: trunk/Source/WebCore/ChangeLog (139249 => 139250)


--- trunk/Source/WebCore/ChangeLog	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Source/WebCore/ChangeLog	2013-01-10 00:09:41 UTC (rev 139250)
@@ -1,3 +1,32 @@
+2013-01-09  Joanmarie Diggs  <jdi...@igalia.com>
+
+        [GTK] accessibility/aria-labelledby-overrides-label.html requires a proper baseline
+        https://bugs.webkit.org/show_bug.cgi?id=105638
+
+        Reviewed by Martin Robinson.
+
+        The test was failing for two reasons:
+        - AccessibilityRenderObject::correspondingLabelForControlElement() was
+          not ignoring the ARIA labelled-by property
+        - AccessibilityController::accessibleElementById() was not implemented
+
+        Because getting an element by ID cannot be done in the UIProcess, the
+        decision was made to expose the element's ID as an accessible attribute
+        of the object.
+
+        In addition, fixing the bug in AccessibilityRenderObject made it possible
+        to eliminate the Gtk platform-specific expectations for another test.
+
+        No new tests; instead, the failing test was unskipped and a proper baseline
+        provided.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::correspondingLabelForControlElement):
+        Return null for objects where hasTextAlternative() is true.
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (webkitAccessibleGetAttributes): Expose the element's ID as an accessible
+        attribute.
+
 2013-01-09  Tony Gentilcore  <to...@chromium.org>
 
         Remove unused includes from HTMLTreeBuilder

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (139249 => 139250)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-01-10 00:09:41 UTC (rev 139250)
@@ -2347,6 +2347,11 @@
     if (!m_renderer)
         return 0;
 
+    // ARIA: section 2A, bullet #3 says if aria-labeledby or aria-label appears, it should
+    // override the "label" element association.
+    if (hasTextAlternative())
+        return 0;
+
     Node* node = m_renderer->node();
     if (node && node->isHTMLElement()) {
         HTMLLabelElement* label = labelForElement(static_cast<Element*>(node));

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (139249 => 139250)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-01-10 00:09:41 UTC (rev 139250)
@@ -447,6 +447,16 @@
     if (!coreObject)
         return attributeSet;
 
+    // Hack needed for WebKit2 tests because obtaining an element by its ID
+    // cannot be done from the UIProcess. Assistive technologies have no need
+    // for this information.
+    Node* node = coreObject->node();
+    if (node && node->isElementNode()) {
+        String id = toElement(node)->getIdAttribute().string();
+        if (!id.isEmpty())
+            attributeSet = addToAtkAttributeSet(attributeSet, "html-id", id.utf8().data());
+    }
+
     int headingLevel = coreObject->headingLevel();
     if (headingLevel) {
         String value = String::number(headingLevel);

Modified: trunk/Tools/ChangeLog (139249 => 139250)


--- trunk/Tools/ChangeLog	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Tools/ChangeLog	2013-01-10 00:09:41 UTC (rev 139250)
@@ -1,3 +1,40 @@
+2013-01-09  Joanmarie Diggs  <jdi...@igalia.com>
+
+        [GTK] accessibility/aria-labelledby-overrides-label.html requires a proper baseline
+        https://bugs.webkit.org/show_bug.cgi?id=105638
+
+        Reviewed by Martin Robinson.
+
+        The test was failing for two reasons:
+        - AccessibilityRenderObject::correspondingLabelForControlElement() was
+          not ignoring the ARIA labelled-by property
+        - AccessibilityController::accessibleElementById() was not implemented
+
+        Because getting an element by ID cannot be done in the UIProcess, the
+        decision was made to expose the element's ID as an accessible attribute
+        of the object.
+
+        In addition, fixing the bug in AccessibilityRenderObject made it possible
+        to eliminate the Gtk platform-specific expectations for another test.
+
+        * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
+        (childElementById): Added. Walks the tree looking for the AtkObject
+        Attribute which exposes the HTML element's ID.
+        (AccessibilityController::accessibleElementById): Implemented.
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+        (AccessibilityUIElement::title): Modified to print out "AXTitle: " even
+        when there is no title, as is done with the Mac port.
+        * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
+        (WTR):
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp:
+        (WTR::childElementById): Added. Walks the tree looking for the AtkObject
+        Attribute which exposes the HTML element's ID.
+        (WTR):
+        (WTR::AccessibilityController::accessibleElementById): Implemented.
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::title): Modified to print out "AXTitle: "
+        even when there is no title, as is done with the Mac port.
+
 2013-01-09  Gregg Tavares  <g...@google.com>
 
         Add Gregg Tavares as a committer

Modified: trunk/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp (139249 => 139250)


--- trunk/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp	2013-01-10 00:09:41 UTC (rev 139250)
@@ -35,6 +35,7 @@
 #include <atk/atk.h>
 #include <gtk/gtk.h>
 #include <webkit/webkit.h>
+#include <wtf/gobject/GOwnPtr.h>
 
 static bool loggingAccessibilityEvents = false;
 
@@ -70,10 +71,47 @@
     return AccessibilityUIElement(accessible);
 }
 
+static AtkObject* childElementById(AtkObject* parent, const char* id)
+{
+    if (!ATK_IS_OBJECT(parent))
+        return 0;
+
+    AtkAttributeSet* attributeSet = atk_object_get_attributes(parent);
+    for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
+        AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
+        if (!strcmp(attribute->name, "html-id")) {
+            if (!strcmp(attribute->value, id))
+                return parent;
+            break;
+        }
+    }
+
+    int childCount = atk_object_get_n_accessible_children(parent);
+    for (int i = 0; i < childCount; i++) {
+        AtkObject* result = childElementById(atk_object_ref_accessible_child(parent, i), id);
+        if (ATK_IS_OBJECT(result))
+            return result;
+    }
+
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef id)
 {
-    // FIXME: implement
+    AtkObject* root = DumpRenderTreeSupportGtk::getRootAccessibleElement(mainFrame);
+    if (!root)
+        return 0;
+
+    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(id);
+    GOwnPtr<gchar> idBuffer(static_cast<gchar*>(g_malloc(bufferSize)));
+    JSStringGetUTF8CString(id, idBuffer.get(), bufferSize);
+
+    AtkObject* result = childElementById(root, idBuffer.get());
+    if (ATK_IS_OBJECT(result))
+        return AccessibilityUIElement(result);
+
     return 0;
+
 }
 
 void AccessibilityController::setLogFocusEvents(bool)

Modified: trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp (139249 => 139250)


--- trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp	2013-01-10 00:09:41 UTC (rev 139250)
@@ -388,12 +388,8 @@
 JSStringRef AccessibilityUIElement::title()
 {
     const gchar* name = atk_object_get_name(ATK_OBJECT(m_element));
+    GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name ? name : ""));
 
-    if (!name)
-        return JSStringCreateWithCharacters(0, 0);
-
-    GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name));
-
     return JSStringCreateWithUTF8CString(axTitle.get());
 }
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp (139249 => 139250)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2013-01-10 00:09:41 UTC (rev 139250)
@@ -106,6 +106,9 @@
 #if !PLATFORM(MAC)
 bool AccessibilityController::addNotificationListener(JSValueRef) { return false; }
 bool AccessibilityController::removeNotificationListener() { return false; }
+#endif
+
+#if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(EFL)
 PassRefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef attribute) { return 0; }
 #endif
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp (139249 => 139250)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp	2013-01-10 00:09:41 UTC (rev 139250)
@@ -29,6 +29,9 @@
 #include "AccessibilityController.h"
 
 #include "InjectedBundle.h"
+#include "InjectedBundlePage.h"
+
+#include <WebKit2/WKBundlePagePrivate.h>
 #include <atk/atk.h>
 #include <cstdio>
 #include <wtf/gobject/GOwnPtr.h>
@@ -147,4 +150,46 @@
     }
 }
 
+static AtkObject* childElementById(AtkObject* parent, const char* id)
+{
+    if (!ATK_IS_OBJECT(parent))
+        return 0;
+
+    AtkAttributeSet* attributeSet = atk_object_get_attributes(parent);
+    for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
+        AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
+        if (!strcmp(attribute->name, "html-id")) {
+            if (!strcmp(attribute->value, id))
+                return parent;
+            break;
+        }
+    }
+
+    int childCount = atk_object_get_n_accessible_children(parent);
+    for (int i = 0; i < childCount; i++) {
+        AtkObject* result = childElementById(atk_object_ref_accessible_child(parent, i), id);
+        if (ATK_IS_OBJECT(result))
+            return result;
+    }
+
+    return 0;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef id)
+{
+    AtkObject* root = ATK_OBJECT(WKAccessibilityRootObject(InjectedBundle::shared().page()->page()));
+    if (!root)
+        return 0;
+
+    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(id);
+    GOwnPtr<gchar> idBuffer(static_cast<gchar*>(g_malloc(bufferSize)));
+    JSStringGetUTF8CString(id, idBuffer.get(), bufferSize);
+
+    AtkObject* result = childElementById(root, idBuffer.get());
+    if (ATK_IS_OBJECT(result))
+        return AccessibilityUIElement::create(result);
+
+    return 0;
+}
+
 } // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (139249 => 139250)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-01-09 23:19:03 UTC (rev 139249)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-01-10 00:09:41 UTC (rev 139250)
@@ -520,11 +520,8 @@
         return JSStringCreateWithCharacters(0, 0);
 
     const gchar* name = atk_object_get_name(ATK_OBJECT(m_element));
-    if (!name)
-        return JSStringCreateWithCharacters(0, 0);
+    GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name ? name : ""));
 
-    GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name));
-
     return JSStringCreateWithUTF8CString(axTitle.get());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to