AX: Mavericks: Text cursor does not move along with VoiceOver cursor for text fields
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Sep 2015 06:24:21 +0000 (06:24 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Sep 2015 06:24:21 +0000 (06:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148891

Reviewed by Mario Sanchez Prada.

Source/WebCore:

Undo the asynchronous dispatch of accessibility setting values on pre El Capitan machines
because it causes focus to not sync correctly.

Test: accessibility/mac/focus-moves-cursor.html

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
(-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):

LayoutTests:

* accessibility/mac/focus-moves-cursor-expected.txt: Added.
* accessibility/mac/focus-moves-cursor.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/mac/focus-moves-cursor-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/focus-moves-cursor.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 155503a..cff2ce3 100644 (file)
@@ -1,3 +1,13 @@
+2015-09-07  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Mavericks: Text cursor does not move along with VoiceOver cursor for text fields
+        https://bugs.webkit.org/show_bug.cgi?id=148891
+
+        Reviewed by Mario Sanchez Prada.
+
+        * accessibility/mac/focus-moves-cursor-expected.txt: Added.
+        * accessibility/mac/focus-moves-cursor.html: Added.
+
 2015-09-07  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, update iOS baseline for imported/w3c/web-platform-tests/html/dom/interfaces.html.
diff --git a/LayoutTests/accessibility/mac/focus-moves-cursor-expected.txt b/LayoutTests/accessibility/mac/focus-moves-cursor-expected.txt
new file mode 100644 (file)
index 0000000..9889860
--- /dev/null
@@ -0,0 +1,15 @@
+
+This tests that when setting focus, the cursor moves.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS textfield.stringValue is 'AXValue: '
+PASS textfield.stringValue is 'AXValue: '
+PASS textfield.isFocused is true
+PASS document.activeElement is document.getElementById('textfield')
+PASS textfield.stringValue is 'AXValue: a'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/mac/focus-moves-cursor.html b/LayoutTests/accessibility/mac/focus-moves-cursor.html
new file mode 100644 (file)
index 0000000..d9b8818
--- /dev/null
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+
+<input id="textfield" onfocus="setTimeout('sendTestEvents()', 0);">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that when setting focus, the cursor moves.");
+
+    var windowEventSender = window.eventSender;    
+    if (window.accessibilityController && window.eventSender) {
+        window.jsTestIsAsync = true;
+        var textfield = accessibilityController.accessibleElementById("textfield");
+        shouldBe("textfield.stringValue", "'AXValue: '");
+        eventSender.keyDown("a");
+        shouldBe("textfield.stringValue", "'AXValue: '");
+
+        textfield.takeFocus();
+    }
+
+    function sendTestEvents() {
+        var textfield = accessibilityController.accessibleElementById("textfield");
+        shouldBeTrue("textfield.isFocused");
+        shouldBe("document.activeElement", "document.getElementById('textfield')");
+
+        eventSender.keyDown("a");
+        shouldBe("textfield.stringValue", "'AXValue: a'");
+        finishJSTest();
+    }
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 68b2c49..9399fd1 100644 (file)
@@ -1179,6 +1179,10 @@ webkit.org/b/142142 media/video-volume-slider-drag.html [ Skip ]
 # Mavericks and prior do not support APNG.
 webkit.org/b/17022 [ MountainLion Mavericks ] fast/images/animated-png.html [ Skip ]
 
+# Pre-Capitan does not support asynchronous attribute setting.
+[ Mavericks Yosemite ] accessibility/mac/setting-attributes-is-asynchronous.html [ Skip ]
+[ Mavericks Yosemite ] accessibility/mac/focus-setting-selection-syncronizing-not-clearing.html [ Skip ]
+
 # OS X 10.10.3+ has the necessary glyphs.
 webkit.org/b/142548 [ Yosemite+ ] editing/selection/extend-by-character-007.html [ Pass ]
 
index 5c7ebe5..8c350a2 100644 (file)
@@ -1,3 +1,19 @@
+2015-09-07  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Mavericks: Text cursor does not move along with VoiceOver cursor for text fields
+        https://bugs.webkit.org/show_bug.cgi?id=148891
+
+        Reviewed by Mario Sanchez Prada.
+
+        Undo the asynchronous dispatch of accessibility setting values on pre El Capitan machines
+        because it causes focus to not sync correctly.
+
+        Test: accessibility/mac/focus-moves-cursor.html
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
+        (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
+
 2015-09-07  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         [CoordinatedGraphics] Remove ScrollingStateScrollingNodeCoordinatedGraphics.cpp
index f433230..210465f 100644 (file)
@@ -3393,11 +3393,16 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName
 {
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
     // In case anything we do by changing values causes an alert or other modal
     // behaviors, we need to return now, so that VoiceOver doesn't hang indefinitely.
     dispatch_async(dispatch_get_main_queue(), ^{
         [self _accessibilitySetValue:value forAttribute:attributeName];
     });
+#else
+    // dispatch_async on earlier versions can cause focus not to track.
+    [self _accessibilitySetValue:value forAttribute:attributeName];
+#endif
 }
 
 - (void)_accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName