Title: [135485] trunk/Tools
- Revision
- 135485
- Author
- [email protected]
- Date
- 2012-11-21 23:54:52 -0800 (Wed, 21 Nov 2012)
Log Message
[GTK][WTR] Implement AccessibilityUIElement::stringValue
https://bugs.webkit.org/show_bug.cgi?id=102951
Reviewed by Martin Robinson.
Implement AccessibilityUIElement::stringValue in the ATK backend
in the same manner it is implemented in DumpRenderTree.
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::replaceCharactersForResults):
(WTR):
(WTR::AccessibilityUIElement::stringValue):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (135484 => 135485)
--- trunk/Tools/ChangeLog 2012-11-22 07:47:29 UTC (rev 135484)
+++ trunk/Tools/ChangeLog 2012-11-22 07:54:52 UTC (rev 135485)
@@ -1,3 +1,18 @@
+2012-11-21 Zan Dobersek <[email protected]>
+
+ [GTK][WTR] Implement AccessibilityUIElement::stringValue
+ https://bugs.webkit.org/show_bug.cgi?id=102951
+
+ Reviewed by Martin Robinson.
+
+ Implement AccessibilityUIElement::stringValue in the ATK backend
+ in the same manner it is implemented in DumpRenderTree.
+
+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+ (WTR::replaceCharactersForResults):
+ (WTR):
+ (WTR::AccessibilityUIElement::stringValue):
+
2012-11-21 Vineet Chaudhary <[email protected]>
Unreviewed. Adding myself to committers.py.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (135484 => 135485)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2012-11-22 07:47:29 UTC (rev 135484)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2012-11-22 07:54:52 UTC (rev 135485)
@@ -35,6 +35,9 @@
#include <wtf/Assertions.h>
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+#include <wtf/unicode/CharacterNames.h>
namespace WTR {
@@ -121,6 +124,22 @@
g_value_unset(¤tValue);
}
+static gchar* replaceCharactersForResults(gchar* str)
+{
+ WTF::String uString = WTF::String::fromUTF8(str);
+
+ // The object replacement character is passed along to ATs so we need to be
+ // able to test for their presence and do so without causing test failures.
+ uString.replace(objectReplacementCharacter, "<obj>");
+
+ // The presence of newline characters in accessible text of a single object
+ // is appropriate, but it makes test results (especially the accessible tree)
+ // harder to read.
+ uString.replace("\n", "<\\n>");
+
+ return g_strdup(uString.utf8().data());
+}
+
AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
: m_element(element)
{
@@ -406,8 +425,14 @@
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringValue()
{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
+ if (!m_element || !ATK_IS_TEXT(m_element))
+ return JSStringCreateWithCharacters(0, 0);
+
+ GOwnPtr<gchar> text(atk_text_get_text(ATK_TEXT(m_element), 0, -1));
+ GOwnPtr<gchar> textWithReplacedCharacters(replaceCharactersForResults(text.get()));
+ GOwnPtr<gchar> axValue(g_strdup_printf("AXValue: %s", textWithReplacedCharacters.get()));
+
+ return JSStringCreateWithUTF8CString(axValue.get());
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::language()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes