AX: Screen braille input doesn't work on forms.
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Nov 2014 15:47:16 +0000 (15:47 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Nov 2014 15:47:16 +0000 (15:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138804

Reviewed by Mario Sanchez Prada.

Source/WebCore:

Allow iOS to set values of text fields through the API.

Test: platform/ios-sim/accessibility/set-value.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilitySetValue:]):

Tools:

Add a method to setValue through the AX API in DRT.

* DumpRenderTree/AccessibilityUIElement.cpp:
(setValueCallback):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::setValue):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::setValue):

LayoutTests:

* platform/ios-sim: Copied from LayoutTests/platform/ios-sim.
* platform/ios-sim/accessibility/set-value-expected.txt: Added.
* platform/ios-sim/accessibility/set-value.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176318 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/ios-sim/accessibility/set-value-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios-sim/accessibility/set-value.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Tools/ChangeLog
Tools/DumpRenderTree/AccessibilityUIElement.cpp
Tools/DumpRenderTree/AccessibilityUIElement.h
Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm
Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

index e0ced9d..3cf3d7f 100644 (file)
@@ -1,3 +1,14 @@
+2014-11-19  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Screen braille input doesn't work on forms.
+        https://bugs.webkit.org/show_bug.cgi?id=138804
+
+        Reviewed by Mario Sanchez Prada.
+
+        * platform/ios-sim: Copied from LayoutTests/platform/ios-sim.
+        * platform/ios-sim/accessibility/set-value-expected.txt: Added.
+        * platform/ios-sim/accessibility/set-value.html: Added.
+
 2014-11-19  Dhi Aurrahman  <diorahman@rockybars.com>
 
         Add selector checker for :lang pseudo class in Selectors level 4
diff --git a/LayoutTests/platform/ios-sim/accessibility/set-value-expected.txt b/LayoutTests/platform/ios-sim/accessibility/set-value-expected.txt
new file mode 100644 (file)
index 0000000..72a58c1
--- /dev/null
@@ -0,0 +1,12 @@
+
+This makes sure that you can set the ax value through accessibility.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Initial value : AXValue: 
+Final value : AXValue: TEST
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/ios-sim/accessibility/set-value.html b/LayoutTests/platform/ios-sim/accessibility/set-value.html
new file mode 100644 (file)
index 0000000..e3c0ef5
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../../resources/js-test-pre.js"></script>
+<script>
+var successfullyParsed = false;
+</script>
+</head>
+<body id="body">
+
+<input type="text" id="text">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This makes sure that you can set the ax value through accessibility.");
+
+    if (window.accessibilityController) {
+
+        var textField = accessibilityController.accessibleElementById("text");
+        debug("Initial value : " + textField.iphoneValue);
+        textField.setValue("TEST");
+        debug("Final value : " + textField.iphoneValue);
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
+
index 93dbe51..15dc336 100644 (file)
@@ -1,3 +1,17 @@
+2014-11-19  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Screen braille input doesn't work on forms.
+        https://bugs.webkit.org/show_bug.cgi?id=138804
+
+        Reviewed by Mario Sanchez Prada.
+
+        Allow iOS to set values of text fields through the API.
+
+        Test: platform/ios-sim/accessibility/set-value.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper _accessibilitySetValue:]):
+
 2014-11-19  Zalan Bujtas  <zalan@apple.com>
 
         Simple line layout: Add renderer based rect collecting to RunResolver.
index 6a41b97..aa062de 100644 (file)
@@ -1625,6 +1625,13 @@ static RenderObject* rendererForView(WAKView* view)
     return YES;
 }
 
+- (void)_accessibilitySetValue:(NSString *)string
+{
+    if (![self _prepareAccessibilityCall])
+        return;
+    m_object->setValue(string);
+}
+
 - (NSString *)stringForTextMarkers:(NSArray *)markers
 {
     if (![self _prepareAccessibilityCall])
index fb199a6..ee7f04f 100644 (file)
@@ -1,3 +1,21 @@
+2014-11-19  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Screen braille input doesn't work on forms.
+        https://bugs.webkit.org/show_bug.cgi?id=138804
+
+        Reviewed by Mario Sanchez Prada.
+
+        Add a method to setValue through the AX API in DRT.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (setValueCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+        (AccessibilityUIElement::setValue):
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::setValue):
+
 2014-11-18  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Remove the WinCairo buildbot
index c2d9897..b0bc9c6 100644 (file)
@@ -438,6 +438,19 @@ static JSValueRef isEqualCallback(JSContextRef context, JSObjectRef function, JS
     return JSValueMakeBoolean(context, toAXElement(thisObject)->isEqual(toAXElement(otherElement)));
 }
 
+static JSValueRef setValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    JSRetainPtr<JSStringRef> valueText = 0;
+    if (argumentCount == 1) {
+        if (JSValueIsString(context, arguments[0]))
+            valueText.adopt(JSValueToStringCopy(context, arguments[0], exception));
+    }
+    
+    toAXElement(thisObject)->setValue(valueText.get());
+    
+    return JSValueMakeUndefined(context);
+}
+
 static JSValueRef setSelectedChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     JSObjectRef element = 0;
@@ -1337,6 +1350,7 @@ AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringR
 
 #if !PLATFORM(MAC) && !PLATFORM(IOS)
 JSStringRef AccessibilityUIElement::pathDescription() const { return 0; }
+void AccessibilityUIElement::setValue(JSStringRef);
 #endif
 
 #if !PLATFORM(COCOA)
@@ -1628,6 +1642,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "previousTextMarker", previousTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "stringForTextMarkerRange", stringForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setSelectedChild", setSelectedChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "setValue", setValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "scrollToMakeVisible", scrollToMakeVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
 #if PLATFORM(GTK) || PLATFORM(EFL)
index 310c0cf..28a6d13 100644 (file)
@@ -123,6 +123,7 @@ public:
     JSStringRef language();
     JSStringRef stringValue();
     JSStringRef accessibilityValue() const;
+    void setValue(JSStringRef);
     JSStringRef helpText() const;
     JSStringRef orientation() const;
     double x();
index 692651e..eda5df7 100644 (file)
@@ -76,6 +76,7 @@ AccessibilityUIElement::~AccessibilityUIElement()
 - (void)accessibilitySetPostedNotificationCallback:(AXPostedNotificationCallback)function withContext:(void*)context;
 - (CGFloat)_accessibilityMinValue;
 - (CGFloat)_accessibilityMaxValue;
+- (void)_accessibilitySetValue:(NSString *)value;
 @end
 
 @interface NSObject (WebAccessibilityObjectWrapperPrivate)
@@ -526,6 +527,11 @@ double AccessibilityUIElement::maxValue()
     return [m_element _accessibilityMaxValue];
 }
 
+void AccessibilityUIElement::setValue(JSStringRef valueText)
+{
+    [m_element _accessibilitySetValue:[NSString stringWithJSStringRef:valueText]];
+}
+
 JSStringRef AccessibilityUIElement::valueDescription()
 {
     return JSStringCreateWithCharacters(0, 0);
index 18f849a..bdb3b4b 100644 (file)
@@ -1343,6 +1343,13 @@ void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned le
     END_AX_OBJC_EXCEPTIONS
 }
 
+void AccessibilityUIElement::setValue(JSStringRef valueText)
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    [m_element accessibilitySetValue:[NSString stringWithJSStringRef:valueText] forAttribute:NSAccessibilityValueAttribute];
+    END_AX_OBJC_EXCEPTIONS
+}
+
 void AccessibilityUIElement::increment()
 {
     BEGIN_AX_OBJC_EXCEPTIONS