Title: [148737] trunk
Revision
148737
Author
[email protected]
Date
2013-04-19 03:37:22 -0700 (Fri, 19 Apr 2013)

Log Message

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

Patch by Krzysztof Czech <[email protected]> on 2013-04-19
Reviewed by Gyuyoung Kim.

Tools:

Adds support for getting language information.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::language):

LayoutTests:

Unskipping accessibility/language-attribute.html.

* platform/gtk-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148736 => 148737)


--- trunk/LayoutTests/ChangeLog	2013-04-19 09:59:11 UTC (rev 148736)
+++ trunk/LayoutTests/ChangeLog	2013-04-19 10:37:22 UTC (rev 148737)
@@ -1,3 +1,14 @@
+2013-04-19  Krzysztof Czech  <[email protected]>
+
+        [GTK][WK2] accessibility/language-attribute.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=106342
+
+        Reviewed by Gyuyoung Kim.
+
+        Unskipping accessibility/language-attribute.html.
+
+        * platform/gtk-wk2/TestExpectations:
+
 2013-04-19  Dan Beam  <[email protected]>
 
         Remove unmaintained feature REQUEST_AUTOCOMPLETE

Modified: trunk/LayoutTests/platform/gtk-wk2/TestExpectations (148736 => 148737)


--- trunk/LayoutTests/platform/gtk-wk2/TestExpectations	2013-04-19 09:59:11 UTC (rev 148736)
+++ trunk/LayoutTests/platform/gtk-wk2/TestExpectations	2013-04-19 10:37:22 UTC (rev 148737)
@@ -304,7 +304,6 @@
 webkit.org/b/106338 accessibility/aria-hidden-updates-alldescendants.html [ Failure ]
 webkit.org/b/106340 accessibility/img-fallsback-to-title.html [ Failure ]
 webkit.org/b/106341 accessibility/label-for-control-hittest.html [ Failure ]
-webkit.org/b/106342 accessibility/language-attribute.html [ Failure ]
 webkit.org/b/106343 accessibility/loading-iframe-sends-notification.html [ Failure ]
 webkit.org/b/106344 accessibility/placeholder.html [ Failure ]
 webkit.org/b/106346 accessibility/svg-remote-element.html [ Timeout ]

Modified: trunk/Tools/ChangeLog (148736 => 148737)


--- trunk/Tools/ChangeLog	2013-04-19 09:59:11 UTC (rev 148736)
+++ trunk/Tools/ChangeLog	2013-04-19 10:37:22 UTC (rev 148737)
@@ -1,3 +1,15 @@
+2013-04-19  Krzysztof Czech  <[email protected]>
+
+        [GTK][WK2] accessibility/language-attribute.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=106342
+
+        Reviewed by Gyuyoung Kim.
+
+        Adds support for getting language information.
+
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::language):
+
 2013-04-19  Zan Dobersek  <[email protected]>
 
         [Dashboard] Remove the isToTWebKit member variable from the BuilderGroup interface

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (148736 => 148737)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-04-19 09:59:11 UTC (rev 148736)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2013-04-19 10:37:22 UTC (rev 148737)
@@ -43,10 +43,21 @@
 
 namespace WTR {
 
+static void attributesClear(AtkAttributeSet* attributesSet)
+{
+    for (GSList* attributes = attributesSet; attributes; attributes = attributes->next) {
+        AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
+        g_free(atkAttribute->name);
+        g_free(atkAttribute->value);
+        g_free(atkAttribute);
+    }
+}
+
 static gchar* attributeSetToString(AtkAttributeSet* attributeSet)
 {
+    GOwnPtr<GSList> atkAttributes(attributeSet);
     GString* str = g_string_new(0);
-    for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
+    for (GSList* attributes = atkAttributes.get(); attributes; attributes = attributes->next) {
         AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
         GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL));
         g_string_append(str, attributeData.get());
@@ -54,6 +65,8 @@
             g_string_append(str, ", ");
     }
 
+    attributesClear(atkAttributes.get());
+
     return g_string_free(str, FALSE);
 }
 
@@ -571,8 +584,32 @@
 
 JSRetainPtr<JSStringRef> AccessibilityUIElement::language()
 {
-    // FIXME: implement
-    return JSStringCreateWithCharacters(0, 0);
+    if (!m_element || !ATK_IS_OBJECT(m_element))
+        return JSStringCreateWithCharacters(0, 0);
+
+    GOwnPtr<gchar> language;
+    // 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) {
+        language.set(g_strdup_printf("AXLanguage: %s", atk_document_get_locale(ATK_DOCUMENT(m_element))));
+        return JSStringCreateWithUTF8CString(language.get());
+    }
+
+    // For all other objects, the language is exposed as an AtkText attribute.
+    if (!ATK_IS_TEXT(m_element))
+        return JSStringCreateWithCharacters(0, 0);
+
+    GOwnPtr<GSList> textAttributes(atk_text_get_default_attributes(ATK_TEXT(m_element)));
+    for (GSList* attributes = textAttributes.get(); attributes; attributes = attributes->next) {
+        AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
+        if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) {
+            language.set(g_strdup_printf("AXLanguage: %s", atkAttribute->value));
+            break;
+        }
+    }
+
+    attributesClear(textAttributes.get());
+
+    return JSStringCreateWithUTF8CString(language.get());
 }
 
 JSRetainPtr<JSStringRef> AccessibilityUIElement::helpText() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to