Title: [183783] trunk
Revision
183783
Author
[email protected]
Date
2015-05-04 17:16:01 -0700 (Mon, 04 May 2015)

Log Message

AX: setting focus via accessibility object needs to set isSynchronizing in resulting selection intent
https://bugs.webkit.org/show_bug.cgi?id=144489

Patch by Doug Russell <[email protected]> on 2015-05-04
Reviewed by Chris Fleizach.

Resolves infinite looping when navigating rapidly between controls with the search API and then focusing
on the returned control.
Remove isSynchronizing flag from AXTextStateChangeIntent and put it on AXObjectCache.
Move AXTextStateChangeIntent logic in AccessibilityRenderObject into a helper method.
Call new AXTextStateChangeIntent helper from AccessibilityRenderObject::setFocus().
Add support for setSelectedVisibleTextRange() in accessibility tests.

Source/WebCore:

Test: platform/mac/accessibility/selection-sync.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::showIntent):
(WebCore::AXObjectCache::setTextSelectionIntent):
(WebCore::AXObjectCache::setIsSynchronizingSelection):
(WebCore::AXObjectCache::postTextStateChangeNotification):
* accessibility/AXObjectCache.h:
* accessibility/AXTextStateChangeIntent.h:
(WebCore::AXTextStateChangeIntent::AXTextStateChangeIntent):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::setTextSelectionIntent):
(WebCore::AccessibilityRenderObject::setSelectedTextRange):
(WebCore::AccessibilityRenderObject::setFocused):
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
(WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange): Deleted.
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):

Tools:

* DumpRenderTree/AccessibilityUIElement.cpp:
(setSelectedVisibleTextRangeCallback):
(AccessibilityUIElement::setSelectedVisibleTextRange):
(AccessibilityUIElement::getJSClass):
(AccessibilityUIElement::textMarkerForIndex): Deleted.
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::setSelectedVisibleTextRange):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange):
(WTR::AccessibilityUIElement::setSelectedTextRange): Deleted.
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange):

LayoutTests:

* platform/mac/accessibility/selection-sync-expected.txt: Added.
* platform/mac/accessibility/selection-sync.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (183782 => 183783)


--- trunk/LayoutTests/ChangeLog	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/LayoutTests/ChangeLog	2015-05-05 00:16:01 UTC (rev 183783)
@@ -1,3 +1,20 @@
+2015-05-04  Doug Russell  <[email protected]>
+
+        AX: setting focus via accessibility object needs to set isSynchronizing in resulting selection intent
+        https://bugs.webkit.org/show_bug.cgi?id=144489
+
+        Reviewed by Chris Fleizach.
+
+        Resolves infinite looping when navigating rapidly between controls with the search API and then focusing
+        on the returned control.
+        Remove isSynchronizing flag from AXTextStateChangeIntent and put it on AXObjectCache.
+        Move AXTextStateChangeIntent logic in AccessibilityRenderObject into a helper method.
+        Call new AXTextStateChangeIntent helper from AccessibilityRenderObject::setFocus().
+        Add support for setSelectedVisibleTextRange() in accessibility tests.
+
+        * platform/mac/accessibility/selection-sync-expected.txt: Added.
+        * platform/mac/accessibility/selection-sync.html: Added.
+
 2015-05-04  Chris Dumez  <[email protected]>
 
         Crash at com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::createWindow + 185

Added: trunk/LayoutTests/platform/mac/accessibility/selection-sync-expected.txt (0 => 183783)


--- trunk/LayoutTests/platform/mac/accessibility/selection-sync-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-sync-expected.txt	2015-05-05 00:16:01 UTC (rev 183783)
@@ -0,0 +1,27 @@
+one two three. four five six.
+
+This tests that selection changes originating from accessibility API include AXTextStateSync=true.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS addedNotification is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS results[resultIndex]["AXTextStateChangeType"] is AXTextStateChangeTypeSelectionMove
+PASS results[resultIndex]["AXTextSelectionDirection"] is AXTextSelectionDirectionDiscontiguous
+PASS results[resultIndex]["AXTextStateSync"] is true
+PASS results[resultIndex]["AXTextStateChangeType"] is AXTextStateChangeTypeSelectionMove
+PASS results[resultIndex]["AXTextSelectionDirection"] is AXTextSelectionDirectionDiscontiguous
+PASS results[resultIndex]["AXTextStateSync"] is true
+PASS results[resultIndex]["AXTextStateChangeType"] is AXTextStateChangeTypeSelectionExtend
+PASS results[resultIndex]["AXTextSelectionDirection"] is AXTextSelectionDirectionDiscontiguous
+PASS results[resultIndex]["AXTextStateSync"] is true
+PASS results[resultIndex]["AXTextStateChangeType"] is AXTextStateChangeTypeSelectionMove
+PASS results[resultIndex]["AXTextSelectionDirection"] is AXTextSelectionDirectionDiscontiguous
+PASS results[resultIndex]["AXTextStateSync"] is true
+PASS results[resultIndex]["AXTextStateChangeType"] is AXTextStateChangeTypeSelectionExtend
+PASS results[resultIndex]["AXTextSelectionDirection"] is AXTextSelectionDirectionDiscontiguous
+PASS results[resultIndex]["AXTextStateSync"] is true
+

Added: trunk/LayoutTests/platform/mac/accessibility/selection-sync.html (0 => 183783)


--- trunk/LayoutTests/platform/mac/accessibility/selection-sync.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-sync.html	2015-05-05 00:16:01 UTC (rev 183783)
@@ -0,0 +1,92 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div role="textbox" tabindex=0 id="textbox" contenteditable=true>
+<p>one two three. four five six.</p>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+<div id="notifications"></div>
+
+<script>
+
+    description("This tests that selection changes originating from accessibility API include AXTextStateSync=true.");
+
+    var AXTextStateChangeTypeSelectionMove = 2;
+    var AXTextStateChangeTypeSelectionExtend = AXTextStateChangeTypeSelectionMove + 1;
+
+    var AXTextSelectionDirectionDiscontiguous = 5;
+
+    var webArea = 0;
+    var count = 0;
+    var results = [];
+    var resultIndex = 0;
+    function notificationCallback(notification, userInfo) {
+        if (notification == "AXSelectedTextChanged") {
+            count++;
+            if (userInfo)
+                results.push(userInfo);
+            if (count == 5) {
+                shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeSelectionMove");
+                shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionDiscontiguous");
+                shouldBe("results[resultIndex][\"AXTextStateSync\"]", "true");
+
+                resultIndex++;
+                shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeSelectionMove");
+                shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionDiscontiguous");
+                shouldBe("results[resultIndex][\"AXTextStateSync\"]", "true");
+
+                resultIndex++;
+                shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeSelectionExtend");
+                shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionDiscontiguous");
+                shouldBe("results[resultIndex][\"AXTextStateSync\"]", "true");
+
+                resultIndex++;
+                shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeSelectionMove");
+                shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionDiscontiguous");
+                shouldBe("results[resultIndex][\"AXTextStateSync\"]", "true");
+
+                resultIndex++;
+                shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeSelectionExtend");
+                shouldBe("results[resultIndex][\"AXTextSelectionDirection\"]", "AXTextSelectionDirectionDiscontiguous");
+                shouldBe("results[resultIndex][\"AXTextStateSync\"]", "true");
+
+                webArea.removeNotificationListener();
+                window.testRunner.notifyDone();
+            }
+        }
+    }
+
+    if (window.accessibilityController) {
+        window.testRunner.waitUntilDone();
+
+        accessibilityController.enableEnhancedAccessibility(true);
+
+        webArea = accessibilityController.rootElement.childAtIndex(0);
+        var addedNotification = webArea.addNotificationListener(notificationCallback);
+        shouldBe("addedNotification", "true");
+
+        textbox = document.getElementById("textbox");
+        var axTextbox = accessibilityController.accessibleElementById("textbox");
+        axTextbox.takeFocus();
+        axTextbox.setSelectedTextRange(4,0);
+        axTextbox.setSelectedTextRange(0,3);
+
+        var markerThree = axTextbox.textMarkerForIndex(3);
+        var markerFour = axTextbox.textMarkerForIndex(4);
+        var moveRange = axTextbox.textMarkerRangeForMarkers(markerThree, markerThree);
+        var extendRange = axTextbox.textMarkerRangeForMarkers(markerThree, markerFour);
+        webArea.setSelectedVisibleTextRange(moveRange);
+        webArea.setSelectedVisibleTextRange(extendRange);
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (183782 => 183783)


--- trunk/Source/WebCore/ChangeLog	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Source/WebCore/ChangeLog	2015-05-05 00:16:01 UTC (rev 183783)
@@ -1,3 +1,36 @@
+2015-05-04  Doug Russell  <[email protected]>
+
+        AX: setting focus via accessibility object needs to set isSynchronizing in resulting selection intent
+        https://bugs.webkit.org/show_bug.cgi?id=144489
+
+        Reviewed by Chris Fleizach.
+
+        Resolves infinite looping when navigating rapidly between controls with the search API and then focusing
+        on the returned control.
+        Remove isSynchronizing flag from AXTextStateChangeIntent and put it on AXObjectCache.
+        Move AXTextStateChangeIntent logic in AccessibilityRenderObject into a helper method.
+        Call new AXTextStateChangeIntent helper from AccessibilityRenderObject::setFocus().
+        Add support for setSelectedVisibleTextRange() in accessibility tests.
+
+        Test: platform/mac/accessibility/selection-sync.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::showIntent):
+        (WebCore::AXObjectCache::setTextSelectionIntent):
+        (WebCore::AXObjectCache::setIsSynchronizingSelection):
+        (WebCore::AXObjectCache::postTextStateChangeNotification):
+        * accessibility/AXObjectCache.h:
+        * accessibility/AXTextStateChangeIntent.h:
+        (WebCore::AXTextStateChangeIntent::AXTextStateChangeIntent):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::setTextSelectionIntent):
+        (WebCore::AccessibilityRenderObject::setSelectedTextRange):
+        (WebCore::AccessibilityRenderObject::setFocused):
+        (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
+        (WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange): Deleted.
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
+
 2015-05-04  Eric Carlson  <[email protected]>
 
         [Mac] Audio-only files should not have a device picker

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (183782 => 183783)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-05-05 00:16:01 UTC (rev 183783)
@@ -984,16 +984,19 @@
         }
         break;
     }
-    if (intent.isSynchronizing)
-        dataLog("-Sync");
     dataLog("\n");
 }
 #endif
 
-void AXObjectCache::setTextSelectionIntent(AXTextStateChangeIntent intent)
+void AXObjectCache::setTextSelectionIntent(const AXTextStateChangeIntent& intent)
 {
     m_textSelectionIntent = intent;
 }
+    
+void AXObjectCache::setIsSynchronizingSelection(bool isSynchronizing)
+{
+    m_isSynchronizingSelection = isSynchronizing;
+}
 
 static bool isPasswordFieldOrContainedByPasswordField(AccessibilityObject* object)
 {
@@ -1015,7 +1018,7 @@
         object = object->observableObject();
     }
 
-    postTextStateChangePlatformNotification(object, (intent.type == AXTextStateChangeTypeUnknown) ? m_textSelectionIntent : intent, selection);
+    postTextStateChangePlatformNotification(object, (intent.type == AXTextStateChangeTypeUnknown || m_isSynchronizingSelection) ? m_textSelectionIntent : intent, selection);
 #else
     postNotification(node->renderer(), AXObjectCache::AXSelectedTextChanged, TargetObservableParent);
     UNUSED_PARAM(intent);
@@ -1023,6 +1026,7 @@
 #endif
 
     setTextSelectionIntent(AXTextStateChangeIntent());
+    setIsSynchronizingSelection(false);
 }
 
 void AXObjectCache::postTextStateChangeNotification(Node* node, AXTextEditType type, const String& text, const VisiblePosition& position)

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (183782 => 183783)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2015-05-05 00:16:01 UTC (rev 183783)
@@ -199,7 +199,8 @@
     void showIntent(const AXTextStateChangeIntent&);
 #endif
 
-    void setTextSelectionIntent(AXTextStateChangeIntent);
+    void setTextSelectionIntent(const AXTextStateChangeIntent&);
+    void setIsSynchronizingSelection(bool);
 
     void postTextStateChangeNotification(Node*, AXTextEditType, const String&, const VisiblePosition&);
     void postTextReplacementNotification(Node*, AXTextEditType deletionType, const String& deletedText, AXTextEditType insertionType, const String& insertedText, const VisiblePosition&);
@@ -285,6 +286,7 @@
     ListHashSet<RefPtr<AccessibilityObject>> m_passwordNotificationsToPost;
 
     AXTextStateChangeIntent m_textSelectionIntent;
+    bool m_isSynchronizingSelection { false };
 };
 
 class AXAttributeCacheEnabler

Modified: trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h (183782 => 183783)


--- trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h	2015-05-05 00:16:01 UTC (rev 183783)
@@ -78,7 +78,6 @@
         AXTextSelection selection;
         AXTextEditType change;
     };
-    bool isSynchronizing { false };
 
     AXTextStateChangeIntent(AXTextStateChangeType type = AXTextStateChangeTypeUnknown, AXTextSelection selection = AXTextSelection())
         : type(type)
@@ -89,14 +88,6 @@
         : type(AXTextStateChangeTypeEdit)
         , change(change)
     { }
-
-    AXTextStateChangeIntent(AXTextStateChangeType type, bool isSynchronizing)
-        : type(type)
-        , selection()
-        , isSynchronizing(isSynchronizing)
-    {
-        ASSERT(type == AXTextStateChangeTypeSelectionMove || type == AXTextStateChangeTypeSelectionExtend);
-    }
 };
 
 }

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (183782 => 183783)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-05-05 00:16:01 UTC (rev 183783)
@@ -1488,11 +1488,20 @@
     return documentBasedSelectedTextRange();
 }
 
+static void setTextSelectionIntent(const AccessibilityRenderObject& renderObject, AXTextStateChangeType type)
+{
+    AXObjectCache* cache = renderObject.axObjectCache();
+    if (!cache)
+        return;
+    AXTextStateChangeIntent intent(type, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
+    cache->setTextSelectionIntent(intent);
+    cache->setIsSynchronizingSelection(true);
+}
+
 void AccessibilityRenderObject::setSelectedTextRange(const PlainTextRange& range)
 {
     if (isNativeTextControl()) {
-        if (AXObjectCache* cache = axObjectCache())
-            cache->setTextSelectionIntent(AXTextStateChangeIntent(range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove, true));
+        setTextSelectionIntent(*this, range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove);
         HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement();
         textControl.setSelectionRange(range.start, range.start + range.length);
         return;
@@ -1500,8 +1509,8 @@
 
     Node* node = m_renderer->node();
     VisibleSelection newSelection(Position(node, range.start, Position::PositionIsOffsetInAnchor), Position(node, range.start + range.length, Position::PositionIsOffsetInAnchor), DOWNSTREAM);
-    AXTextStateChangeIntent newIntent(range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove, true);
-    m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), newIntent);
+    setTextSelectionIntent(*this, range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove);
+    m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions());
 }
 
 URL AccessibilityRenderObject::url() const
@@ -1655,6 +1664,7 @@
     if (document->focusedElement() == node)
         document->setFocusedElement(nullptr);
 
+    setTextSelectionIntent(*this, AXTextStateChangeTypeSelectionMove);
     downcast<Element>(*node).focus();
 }
 
@@ -1969,13 +1979,13 @@
 
     // make selection and tell the document to use it. if it's zero length, then move to that position
     if (range.start == range.end) {
-        if (AXObjectCache* cache = axObjectCache())
-            cache->setTextSelectionIntent(AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, true));
+        setTextSelectionIntent(*this, AXTextStateChangeTypeSelectionMove);
         m_renderer->frame().selection().moveTo(range.start, UserTriggered);
     }
     else {
+        setTextSelectionIntent(*this, AXTextStateChangeTypeSelectionExtend);
         VisibleSelection newSelection = VisibleSelection(range.start, range.end);
-        m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), AXTextStateChangeIntent(AXTextStateChangeTypeSelectionExtend, true));
+        m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions());
     }
 }
 

Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (183782 => 183783)


--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2015-05-05 00:16:01 UTC (rev 183783)
@@ -224,7 +224,7 @@
         return;
 
     NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] initWithCapacity:5];
-    if (intent.isSynchronizing)
+    if (m_isSynchronizingSelection)
         [userInfo setObject:[NSNumber numberWithBool:YES] forKey:NSAccessibilityTextStateSyncKey];
     if (intent.type != AXTextStateChangeTypeUnknown) {
         [userInfo setObject:[NSNumber numberWithInt:intent.type] forKey:NSAccessibilityTextStateChangeTypeKey];

Modified: trunk/Tools/ChangeLog (183782 => 183783)


--- trunk/Tools/ChangeLog	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/ChangeLog	2015-05-05 00:16:01 UTC (rev 183783)
@@ -1,3 +1,37 @@
+2015-05-04  Doug Russell  <[email protected]>
+
+        AX: setting focus via accessibility object needs to set isSynchronizing in resulting selection intent
+        https://bugs.webkit.org/show_bug.cgi?id=144489
+
+        Reviewed by Chris Fleizach.
+
+        Resolves infinite looping when navigating rapidly between controls with the search API and then focusing
+        on the returned control.
+        Remove isSynchronizing flag from AXTextStateChangeIntent and put it on AXObjectCache.
+        Move AXTextStateChangeIntent logic in AccessibilityRenderObject into a helper method.
+        Call new AXTextStateChangeIntent helper from AccessibilityRenderObject::setFocus().
+        Add support for setSelectedVisibleTextRange() in accessibility tests.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (setSelectedVisibleTextRangeCallback):
+        (AccessibilityUIElement::setSelectedVisibleTextRange):
+        (AccessibilityUIElement::getJSClass):
+        (AccessibilityUIElement::textMarkerForIndex): Deleted.
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::setSelectedVisibleTextRange):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+        (WTR::AccessibilityUIElement::setSelectedVisibleTextRange):
+        (WTR::AccessibilityUIElement::setSelectedTextRange): Deleted.
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::setSelectedVisibleTextRange):
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::setSelectedVisibleTextRange):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::setSelectedVisibleTextRange):
+
 2015-05-04  Brent Fulgham  <[email protected]>
 
         [Win] Implement the "--show-webview" option for Windows

Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp (183782 => 183783)


--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp	2015-05-05 00:16:01 UTC (rev 183783)
@@ -901,6 +901,19 @@
     return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->endTextMarker());
 }
 
+static JSValueRef setSelectedVisibleTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    AccessibilityUIElement* uiElement = toAXElement(thisObject);
+    AccessibilityTextMarkerRange* textMarkerRange = nullptr;
+    if (argumentCount == 1)
+        textMarkerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
+
+    if (uiElement)
+        return JSValueMakeBoolean(context, uiElement->setSelectedVisibleTextRange(textMarkerRange));
+
+    return JSValueMakeBoolean(context, false);
+}
+
 // Static Value Getters
 
 static JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
@@ -1501,6 +1514,11 @@
     return nullptr;
 }
 
+bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*)
+{
+    return false;
+}
+
 #endif
 
 // Destruction
@@ -1684,6 +1702,7 @@
         { "stringForTextMarkerRange", stringForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setSelectedChild", setSelectedChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setValue", setValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "setSelectedVisibleTextRange", setSelectedVisibleTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "scrollToMakeVisible", scrollToMakeVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
 #if PLATFORM(GTK) || PLATFORM(EFL)

Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.h (183782 => 183783)


--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.h	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.h	2015-05-05 00:16:01 UTC (rev 183783)
@@ -254,6 +254,7 @@
     AccessibilityTextMarker endTextMarker();
     AccessibilityTextMarkerRange selectedTextMarkerRange();
     void resetSelectedTextMarkerRange();
+    bool setSelectedVisibleTextRange(AccessibilityTextMarkerRange*);
     
     JSStringRef stringForTextMarkerRange(AccessibilityTextMarkerRange*);
     int textMarkerRangeLength(AccessibilityTextMarkerRange*);

Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (183782 => 183783)


--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm	2015-05-05 00:16:01 UTC (rev 183783)
@@ -1775,6 +1775,15 @@
     return nullptr;
 }
 
+bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange* markerRange)
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    [m_element accessibilitySetValue:(id)markerRange->platformTextMarkerRange() forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
+    END_AX_OBJC_EXCEPTIONS
+    
+    return true;
+}
+
 #endif // SUPPORTS_AX_TEXTMARKERS
 
 JSStringRef AccessibilityUIElement::supportedActions()

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (183782 => 183783)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2015-05-05 00:16:01 UTC (rev 183783)
@@ -173,6 +173,7 @@
 JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForPosition(int, int) { return 0; }
 JSRetainPtr<JSStringRef> AccessibilityUIElement::boundsForRange(unsigned, unsigned) { return 0; }
 bool AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned) { return false; }
+bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*) { return false; }
 JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned, unsigned) { return 0; }
 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) { return 0; }
 bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) { return false; }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (183782 => 183783)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2015-05-05 00:16:01 UTC (rev 183783)
@@ -248,6 +248,7 @@
     PassRefPtr<AccessibilityTextMarker> textMarkerForIndex(int);
     PassRefPtr<AccessibilityTextMarker> startTextMarker();
     PassRefPtr<AccessibilityTextMarker> endTextMarker();
+    bool setSelectedVisibleTextRange(AccessibilityTextMarkerRange*);
 
     // Returns an ordered list of supported actions for an element.
     JSRetainPtr<JSStringRef> supportedActions() const;

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (183782 => 183783)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2015-05-05 00:16:01 UTC (rev 183783)
@@ -193,6 +193,7 @@
     AccessibilityTextMarker textMarkerForIndex(int textIndex);
     readonly attribute AccessibilityTextMarker startTextMarker;
     readonly attribute AccessibilityTextMarker endTextMarker;
+    boolean setSelectedVisibleTextRange(AccessibilityTextMarkerRange range);
 
     // Returns an ordered list of supported actions for an element.
     readonly attribute DOMString supportedActions;

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (183782 => 183783)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2015-05-05 00:16:01 UTC (rev 183783)
@@ -1912,6 +1912,11 @@
     return nullptr;
 }
 
+bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*)
+{
+    return nullptr;
+}
+
 void AccessibilityUIElement::scrollToMakeVisible()
 {
     // FIXME: implement

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (183782 => 183783)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2015-05-05 00:16:01 UTC (rev 183783)
@@ -562,6 +562,11 @@
     return JSStringCreateWithCharacters(0, 0);
 }
 
+bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*)
+{
+    return false;
+}
+
 bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
 {
     return false;

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (183782 => 183783)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2015-05-05 00:08:28 UTC (rev 183782)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2015-05-05 00:16:01 UTC (rev 183783)
@@ -1392,6 +1392,15 @@
     return true;
 }
 
+bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange* markerRange)
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    [m_element accessibilitySetValue:(id)markerRange->platformTextMarkerRange() forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
+    END_AX_OBJC_EXCEPTIONS
+
+    return true;
+}
+
 void AccessibilityUIElement::increment()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to