Changeset 151524 in webkit
- Timestamp:
- Jun 12, 2013 2:39:42 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151522 r151524 1 2013-06-12 Eduardo Lima Mitev <elima@igalia.com> 2 3 [atk] Replace deprecated call to atk_document_get_locale() in DumpRenderTree 4 https://bugs.webkit.org/show_bug.cgi?id=115647 5 6 Reviewed by Martin Robinson. 7 8 Override the get_object_locale() method of WebkitAccessibleWrapperAtk's internal 9 AtkObject, to include custom implementations for AtkDocument and AtkText objects, 10 taking the logic as-is from AtkDocument::get_document_locale() and DumpRenderTree's 11 AccessibilityUIElementAtk::language(), respectively. 12 13 Apart from improving encapsulation, this avoids calling deprecated get_document_locale() 14 method. 15 16 No new functionality, no new tests. 17 18 * accessibility/atk/WebKitAccessibleInterfaceDocument.cpp: 19 (webkitAccessibleDocumentInterfaceInit): Chains implementation of 20 AtkDocument::get_document_locale() to AtkObject::get_object_locale(). 21 * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: 22 (webkitAccessibleGetObjectLocale): Add implementation of locale resolution for 23 objects of type AtkDocument and AtkText. 24 (webkitAccessibleClassInit): Override AtkObject::get_object_locale() method. 25 1 26 2013-06-12 Zan Dobersek <zdobersek@igalia.com> 2 27 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp
r144636 r151524 98 98 static const gchar* webkitAccessibleDocumentGetLocale(AtkDocument* document) 99 99 { 100 // T ODO: Should we fall back on lang xml:lang when the following comes up empty?101 String language = core(document)->language();102 if (!language.isEmpty())103 return cacheAndReturnAtkProperty(ATK_OBJECT(document), AtkCachedDocumentLocale, language);104 105 return 0;100 // The logic to resolve locale has been moved to 101 // AtkObject::get_object_locale() virtual method. However, to avoid breaking 102 // clients expecting the deprecated AtkDocumentIface::get_document_locale() 103 // to be overriden, method is kept and chained up to 104 // AtkObject::get_object_locale(). <https://bugs.webkit.org/show_bug.cgi?id=115647> 105 return atk_object_get_object_locale(ATK_OBJECT(document)); 106 106 } 107 107 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
r148921 r151524 793 793 } 794 794 795 static const gchar* webkitAccessibleGetObjectLocale(AtkObject* object) 796 { 797 if (ATK_IS_DOCUMENT(object)) { 798 AccessibilityObject* coreObject = core(object); 799 if (!coreObject) 800 return 0; 801 802 // TODO: Should we fall back on lang xml:lang when the following comes up empty? 803 String language = coreObject->language(); 804 if (!language.isEmpty()) 805 return cacheAndReturnAtkProperty(object, AtkCachedDocumentLocale, language); 806 807 } else if (ATK_IS_TEXT(object)) { 808 const gchar* locale = 0; 809 810 AtkAttributeSet* textAttributes = atk_text_get_default_attributes(ATK_TEXT(object)); 811 for (GSList* attributes = textAttributes; attributes; attributes = attributes->next) { 812 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); 813 if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) { 814 locale = cacheAndReturnAtkProperty(object, AtkCachedDocumentLocale, String::fromUTF8(atkAttribute->value)); 815 break; 816 } 817 } 818 819 atk_attribute_set_free(textAttributes); 820 821 return locale; 822 } 823 824 return 0; 825 } 826 795 827 static void webkitAccessibleFinalize(GObject* object) 796 828 { … … 817 849 klass->get_attributes = webkitAccessibleGetAttributes; 818 850 klass->ref_relation_set = webkitAccessibleRefRelationSet; 851 klass->get_object_locale = webkitAccessibleGetObjectLocale; 819 852 820 853 g_type_class_add_private(klass, sizeof(WebKitAccessiblePrivate)); -
trunk/Tools/ChangeLog
r151523 r151524 1 2013-06-12 Eduardo Lima Mitev <elima@igalia.com> 2 3 [atk] Replace deprecated call to atk_document_get_locale() in DumpRenderTree 4 https://bugs.webkit.org/show_bug.cgi?id=115647 5 6 Reviewed by Martin Robinson. 7 8 Locale resolution is moved to WebKitAccessibleWrapperAtk using 9 AtkObject::get_object_locale() API. Now, implementation of 10 AccessibilityUIElement::language() in both DumpRenderTree and WebKitTestRunner can 11 be leveraged to get_object_locale() of AtkObject. 12 13 Apart from improving encapsulation, this avoids calling deprecated get_document_locale() 14 method. 15 16 No new functionality, no new tests. 17 18 * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: 19 (AccessibilityUIElement::language): Leverage locale resolution to 20 AtkObject::get_object_locale(). 21 * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: 22 (WTR::AccessibilityUIElement::language): Leverage locale resolution to 23 AtkObject::get_object_locale(). 24 1 25 2013-06-12 Hugo Parente Lima <hugo.lima@openbossa.org> 2 26 -
trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp
r151179 r151524 433 433 return JSStringCreateWithCharacters(0, 0); 434 434 435 // In ATK, the document language is exposed as the document's locale. 436 if (atk_object_get_role(ATK_OBJECT(m_element)) == ATK_ROLE_DOCUMENT_FRAME) 437 return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", atk_document_get_locale(ATK_DOCUMENT(m_element)))); 438 439 // For all other objects, the language is exposed as an AtkText attribute. 440 if (!ATK_IS_TEXT(m_element)) 441 return JSStringCreateWithCharacters(0, 0); 442 443 for (GSList* textAttributes = atk_text_get_default_attributes(ATK_TEXT(m_element)); textAttributes; textAttributes = textAttributes->next) { 444 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(textAttributes->data); 445 if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) 446 return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", atkAttribute->value)); 447 } 448 449 return JSStringCreateWithCharacters(0, 0); 435 const gchar* locale = atk_object_get_object_locale(ATK_OBJECT(m_element)); 436 if (!locale) 437 return JSStringCreateWithCharacters(0, 0); 438 439 return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", locale)); 450 440 } 451 441 -
trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
r151179 r151524 619 619 return JSStringCreateWithCharacters(0, 0); 620 620 621 GOwnPtr<gchar> language; 622 // In ATK, the document language is exposed as the document's locale. 623 if (atk_object_get_role(ATK_OBJECT(m_element.get())) == ATK_ROLE_DOCUMENT_FRAME) { 624 language.set(g_strdup_printf("AXLanguage: %s", atk_document_get_locale(ATK_DOCUMENT(m_element.get())))); 625 return JSStringCreateWithUTF8CString(language.get()); 626 } 627 628 // For all other objects, the language is exposed as an AtkText attribute. 629 if (!ATK_IS_TEXT(m_element.get())) 630 return JSStringCreateWithCharacters(0, 0); 631 632 GOwnPtr<GSList> textAttributes(atk_text_get_default_attributes(ATK_TEXT(m_element.get()))); 633 for (GSList* attributes = textAttributes.get(); attributes; attributes = attributes->next) { 634 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); 635 if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) { 636 language.set(g_strdup_printf("AXLanguage: %s", atkAttribute->value)); 637 break; 638 } 639 } 640 641 attributesClear(textAttributes.get()); 642 643 return JSStringCreateWithUTF8CString(language.get()); 621 const gchar* locale = atk_object_get_object_locale(ATK_OBJECT(m_element.get())); 622 if (!locale) 623 return JSStringCreateWithCharacters(0, 0); 624 625 return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", locale)); 644 626 } 645 627
Note: See TracChangeset
for help on using the changeset viewer.