[atk] Replace deprecated call to atk_document_get_locale() in DumpRenderTree
[WebKit-https.git] / Tools / DumpRenderTree / atk / AccessibilityUIElementAtk.cpp
index db894b59ff237d52f80a1a6d568a66f857660f6a..67a993edd33dd5300956b1d430025e17d23c7dc6 100644 (file)
@@ -432,21 +432,11 @@ JSStringRef AccessibilityUIElement::language()
     if (!m_element)
         return JSStringCreateWithCharacters(0, 0);
 
     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))
+    const gchar* locale = atk_object_get_object_locale(ATK_OBJECT(m_element));
+    if (!locale)
         return JSStringCreateWithCharacters(0, 0);
 
         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);
+    return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", locale));
 }
 
 double AccessibilityUIElement::x()
 }
 
 double AccessibilityUIElement::x()