Title: [137114] trunk
Revision
137114
Author
commit-qu...@webkit.org
Date
2012-12-10 00:17:53 -0800 (Mon, 10 Dec 2012)

Log Message

[GTK] accessibility/language-attribute.html is failing
https://bugs.webkit.org/show_bug.cgi?id=98369

Patch by Joanmarie Diggs <jdi...@igalia.com> on 2012-12-10
Reviewed by Chris Fleizach.

The test is failing for two reasons: Not exposing the language
for accessible objects and AccessibilityUIElement::language() not
being implemented.

Source/WebCore:

No new tests; instead, unskipped the previously-failing test.

* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(getAttributeSetForAccessibilityObject): Expose the language via AtkText attribute

Tools:

* DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
(AccessibilityUIElement::language): Implemented.

LayoutTests:

* accessibility/language-attribute.html: Modified the test to work with
both Mac and Atk platforms. (The former exposes static text objects as
accessibles; the latter folds the text into the parent element.)
* platform/gtk/TestExpectations: Unskipped the previously-failing test.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (137113 => 137114)


--- trunk/LayoutTests/ChangeLog	2012-12-10 08:04:49 UTC (rev 137113)
+++ trunk/LayoutTests/ChangeLog	2012-12-10 08:17:53 UTC (rev 137114)
@@ -1,5 +1,21 @@
 2012-12-10  Joanmarie Diggs  <jdi...@igalia.com>
 
+        [GTK] accessibility/language-attribute.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=98369
+
+        Reviewed by Chris Fleizach.
+
+        The test is failing for two reasons: Not exposing the language
+        for accessible objects and AccessibilityUIElement::language() not
+        being implemented.
+
+        * accessibility/language-attribute.html: Modified the test to work with
+        both Mac and Atk platforms. (The former exposes static text objects as
+        accessibles; the latter folds the text into the parent element.)
+        * platform/gtk/TestExpectations: Unskipped the previously-failing test.
+
+2012-12-10  Joanmarie Diggs  <jdi...@igalia.com>
+
         [GTK] accessibility/editable-webarea-context-menu-point.html is failing
         https://bugs.webkit.org/show_bug.cgi?id=98364
 

Modified: trunk/LayoutTests/accessibility/language-attribute.html (137113 => 137114)


--- trunk/LayoutTests/accessibility/language-attribute.html	2012-12-10 08:04:49 UTC (rev 137113)
+++ trunk/LayoutTests/accessibility/language-attribute.html	2012-12-10 08:17:53 UTC (rev 137114)
@@ -2,6 +2,15 @@
 <script>
     if (window.testRunner)
         testRunner.dumpAsText();
+
+    // The Mac port exposes static text objects as an accessible child of an element with text.
+    // The Atk port folds static text objects into the parent element.
+    function getTextChild(accessibilityObject) {
+        if (accessibilityObject.childrenCount)
+            return accessibilityObject.childAtIndex(0);
+
+        return accessibilityObject;
+    }
 </script>
 <head>
 <meta http-equiv="content-language" content="en-gb"> 
@@ -25,10 +34,10 @@
             var webArea = accessibilityController.focusedElement;
             var result = document.getElementById("result");
 
-            var text1 = webArea.childAtIndex(0).childAtIndex(0);
-            var text2 = webArea.childAtIndex(1).childAtIndex(0);
-            var text3 = webArea.childAtIndex(2).childAtIndex(0);
-            var text4 = webArea.childAtIndex(3).childAtIndex(0);
+            var text1 = getTextChild(webArea.childAtIndex(0));
+            var text2 = getTextChild(webArea.childAtIndex(1));
+            var text3 = getTextChild(webArea.childAtIndex(2));
+            var text4 = getTextChild(webArea.childAtIndex(3));
 
             if ( webArea.language == "AXLanguage: en-gb" && text1.language == "AXLanguage: en-gb" && 
                  text2.language == "AXLanguage: de" && text3.language == "AXLanguage: ja" && 

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (137113 => 137114)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2012-12-10 08:04:49 UTC (rev 137113)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2012-12-10 08:17:53 UTC (rev 137114)
@@ -745,7 +745,6 @@
 webkit.org/b/98361 accessibility/button-press-action.html [ Failure ]
 webkit.org/b/98363 accessibility/canvas-fallback-content-2.html [ Failure ]
 webkit.org/b/98365 accessibility/ellipsis-text.html [ Failure ]
-webkit.org/b/98369 accessibility/language-attribute.html [ Failure ]
 webkit.org/b/98370 accessibility/loading-iframe-sends-notification.html [ Failure ]
 webkit.org/b/98371 accessibility/loading-iframe-updates-axtree.html [ Failure ]
 webkit.org/b/98372 accessibility/onclick-handlers.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (137113 => 137114)


--- trunk/Source/WebCore/ChangeLog	2012-12-10 08:04:49 UTC (rev 137113)
+++ trunk/Source/WebCore/ChangeLog	2012-12-10 08:17:53 UTC (rev 137114)
@@ -1,3 +1,19 @@
+2012-12-10  Joanmarie Diggs  <jdi...@igalia.com>
+
+        [GTK] accessibility/language-attribute.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=98369
+
+        Reviewed by Chris Fleizach.
+
+        The test is failing for two reasons: Not exposing the language
+        for accessible objects and AccessibilityUIElement::language() not
+        being implemented.
+
+        No new tests; instead, unskipped the previously-failing test.
+
+        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+        (getAttributeSetForAccessibilityObject): Expose the language via AtkText attribute
+
 2012-12-09  Takashi Sakamoto  <ta...@google.com>
 
         [Shadow DOM]: reset-style-inheritance doesn't work for insertion point

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (137113 => 137114)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp	2012-12-10 08:04:49 UTC (rev 137113)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp	2012-12-10 08:17:53 UTC (rev 137114)
@@ -319,6 +319,10 @@
 
     result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_EDITABLE), object->isReadOnly() ? "false" : "true");
 
+    String language = object->language();
+    if (!language.isEmpty())
+        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE), language.utf8().data());
+
     return result;
 }
 

Modified: trunk/Tools/ChangeLog (137113 => 137114)


--- trunk/Tools/ChangeLog	2012-12-10 08:04:49 UTC (rev 137113)
+++ trunk/Tools/ChangeLog	2012-12-10 08:17:53 UTC (rev 137114)
@@ -1,5 +1,19 @@
 2012-12-10  Joanmarie Diggs  <jdi...@igalia.com>
 
+        [GTK] accessibility/language-attribute.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=98369
+
+        Reviewed by Chris Fleizach.
+
+        The test is failing for two reasons: Not exposing the language
+        for accessible objects and AccessibilityUIElement::language() not
+        being implemented.
+
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+        (AccessibilityUIElement::language): Implemented.
+
+2012-12-10  Joanmarie Diggs  <jdi...@igalia.com>
+
         [GTK] accessibility/editable-webarea-context-menu-point.html is failing
         https://bugs.webkit.org/show_bug.cgi?id=98364
 

Modified: trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp (137113 => 137114)


--- trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp	2012-12-10 08:04:49 UTC (rev 137113)
+++ trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp	2012-12-10 08:17:53 UTC (rev 137114)
@@ -424,7 +424,23 @@
 
 JSStringRef AccessibilityUIElement::language()
 {
-    // FIXME: implement
+    if (!m_element)
+        return JSStringCreateWithCharacters(0, 0);
+
+    // In ATK, the document language is exposed as the document's locale.
+    if (atk_object_get_role(ATK_OBJECT(m_element)) == ATK_ROLE_DOCUMENT_FRAME)
+        return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", atk_document_get_locale(ATK_DOCUMENT(m_element))));
+
+    // For all other objects, the language is exposed as an AtkText attribute.
+    if (!ATK_IS_TEXT(m_element))
+        return JSStringCreateWithCharacters(0, 0);
+
+    for (GSList* textAttributes = atk_text_get_default_attributes(ATK_TEXT(m_element)); textAttributes; textAttributes = textAttributes->next) {
+        AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(textAttributes->data);
+        if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE)))
+            return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", atkAttribute->value));
+    }
+
     return JSStringCreateWithCharacters(0, 0);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to