AX: WK2: iOS: text editing does not work
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jun 2014 17:19:05 +0000 (17:19 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jun 2014 17:19:05 +0000 (17:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133666

Reviewed by Mario Sanchez Prada.

In WK2, all the text editing is handled by the WebProcess, so selectedTextRange and setSelectedTextRange
need to be implemented, as well as posting the right value change notification.

* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper postValueChangedNotification]):
(-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]):
(-[WebAccessibilityObjectWrapper _accessibilitySetSelectedTextRange:]):

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

Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

index 929894a..3e643b6 100644 (file)
@@ -1,3 +1,21 @@
+2014-06-10  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: WK2: iOS: text editing does not work
+        https://bugs.webkit.org/show_bug.cgi?id=133666
+
+        Reviewed by Mario Sanchez Prada.
+
+        In WK2, all the text editing is handled by the WebProcess, so selectedTextRange and setSelectedTextRange
+        need to be implemented, as well as posting the right value change notification.
+
+        * accessibility/ios/AXObjectCacheIOS.mm:
+        (WebCore::AXObjectCache::postPlatformNotification):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper postValueChangedNotification]):
+        (-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]):
+        (-[WebAccessibilityObjectWrapper _accessibilitySetSelectedTextRange:]):
+
 2014-06-10  Andreas Kling  <akling@apple.com>
 
         [iOS WebKit2] Stay in "memory pressure" mode until told otherwise.
index cc65bc7..b48b51e 100644 (file)
@@ -82,8 +82,10 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific
         case AXInvalidStatusChanged:
             [obj->wrapper() postInvalidStatusChangedNotification];
             break;
-        case AXSelectedChildrenChanged:
         case AXValueChanged:
+            [obj->wrapper() postValueChangedNotification];
+            break;
+        case AXSelectedChildrenChanged:
         case AXCheckedStateChanged:
         default:
             break;
index cba74f7..ea7e080 100644 (file)
@@ -62,6 +62,7 @@
 - (void)postInvalidStatusChangedNotification;
 - (void)postLiveRegionCreatedNotification;
 - (void)postScrollStatusChangeNotification;
+- (void)postValueChangedNotification;
 
 @end
 
index 7fd0c57..332bd92 100644 (file)
@@ -1479,6 +1479,11 @@ static RenderObject* rendererForView(WAKView* view)
     // The UIKit accessibility wrapper will override and post appropriate notification.        
 }
 
+- (void)postValueChangedNotification
+{
+    // The UIKit accessibility wrapper will override and post appropriate notification.
+}
+
 - (void)postScrollStatusChangeNotification
 {
     // The UIKit accessibility wrapper will override and post appropriate notification.
@@ -2030,6 +2035,25 @@ static void AXAttributedStringAppendText(NSMutableAttributedString* attrString,
     return [self _stringForRange:range attributed:YES];
 }
 
+- (NSRange)_accessibilitySelectedTextRange
+{
+    if (![self _prepareAccessibilityCall] || !m_object->isTextControl())
+        return NSMakeRange(NSNotFound, 0);
+    
+    PlainTextRange textRange = m_object->selectedTextRange();
+    if (textRange.isNull())
+        return NSMakeRange(NSNotFound, 0);
+    return NSMakeRange(textRange.start, textRange.length);    
+}
+
+- (void)_accessibilitySetSelectedTextRange:(NSRange)range
+{
+    if (![self _prepareAccessibilityCall] || !m_object->isTextControl())
+        return;
+    
+    m_object->setSelectedTextRange(PlainTextRange(range.location, range.length));
+}
+
 // A convenience method for getting the accessibility objects of a NSRange. Currently used only by DRT.
 - (NSArray *)elementsForRange:(NSRange)range
 {