Title: [165870] trunk
Revision
165870
Author
[email protected]
Date
2014-03-18 23:16:40 -0700 (Tue, 18 Mar 2014)

Log Message

AX: Not able to use arrow keys to read text with VoiceOver before selection is set someplace (anyplace).
https://bugs.webkit.org/show_bug.cgi?id=130250

Reviewed by Chris Fleizach.

Source/WebCore:

If initial selection isn't set when we handle selection movement for accessibility, we need to set it. If we don't, using arrow
keys to read text with VoiceOver doesn't work as expected. Things will only start working after the user holds shift and arrows
around to select any arbitrary thing to force selection to get set. This logic handles that special case more gracefully.

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

* page/EventHandler.cpp:
(WebCore::handleKeyboardSelectionMovement):
(WebCore::EventHandler::handleKeyboardSelectionMovementForAccessibility):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):

Source/WebKit:

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

Source/WebKit/mac:

Added ability to toggle enhanced accessibility on and off to support tests that require it.

* WebView/WebFrame.mm:
(-[WebFrame enhancedAccessibilityEnabled]):
(-[WebFrame setEnhancedAccessibility:]):
* WebView/WebFramePrivate.h:

Source/WebKit2:

Added ability to toggle enhanced accessibility on and off to support tests that require it.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKAccessibilityEnableEnhancedAccessibility):
(WKAccessibilityEnhancedAccessibilityEnabled):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:

Tools:

Added ability to toggle enhanced accessibility on and off to support tests that require it.

* DumpRenderTree/AccessibilityController.cpp:
(enableEnhancedAccessibilityCallback):
(getEnhancedAccessibilityEnabledCallback):
(AccessibilityController::getJSClass):
* DumpRenderTree/AccessibilityController.h:
* DumpRenderTree/atk/AccessibilityControllerAtk.cpp:
(AccessibilityController::enableEnhancedAccessibility):
(AccessibilityController::enhancedAccessibilityEnabled):
* DumpRenderTree/ios/AccessibilityControllerIOS.mm:
(AccessibilityController::enableEnhancedAccessibility):
(AccessibilityController::enhancedAccessibilityEnabled):
* DumpRenderTree/mac/AccessibilityControllerMac.mm:
(AccessibilityController::enableEnhancedAccessibility):
(AccessibilityController::enhancedAccessibilityEnabled):
* DumpRenderTree/win/AccessibilityControllerWin.cpp:
(AccessibilityController::enableEnhancedAccessibility):
(AccessibilityController::enhancedAccessibilityEnabled):
* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
(WTR::AccessibilityController::enableEnhancedAccessibility):
(WTR::AccessibilityController::enhancedAccessibilityEnabled):
* WebKitTestRunner/InjectedBundle/AccessibilityController.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:

LayoutTests:

Added test to ensure that initial selection gets set when enhanced accessibility is enabled and an arrow key is pressed.

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (165869 => 165870)


--- trunk/LayoutTests/ChangeLog	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/LayoutTests/ChangeLog	2014-03-19 06:16:40 UTC (rev 165870)
@@ -1,3 +1,15 @@
+2014-03-18  Samuel White  <[email protected]>
+
+        AX: Not able to use arrow keys to read text with VoiceOver before selection is set someplace (anyplace).
+        https://bugs.webkit.org/show_bug.cgi?id=130250
+
+        Reviewed by Chris Fleizach.
+
+        Added test to ensure that initial selection gets set when enhanced accessibility is enabled and an arrow key is pressed.
+
+        * platform/mac/accessibility/selection-initial-expected.txt: Added.
+        * platform/mac/accessibility/selection-initial.html: Added.
+
 2014-03-18  Brent Fulgham  <[email protected]>
 
         TextTrackRegion Not Implemented

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


--- trunk/LayoutTests/platform/mac/accessibility/selection-initial-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-initial-expected.txt	2014-03-19 06:16:40 UTC (rev 165870)
@@ -0,0 +1,22 @@
+This tests that initial selection is set when arrow keys are pressed and no selection exists.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS isSelectionAtStartOfDocument() is false
+PASS isSelectionAtStartOfDocument() is false
+PASS accessibilityController.enhancedAccessibilityEnabled is true
+PASS isSelectionAtStartOfDocument() is false
+PASS isSelectionAtStartOfDocument() is true
+PASS isSelectionAtStartOfDocument() is false
+PASS isSelectionAtStartOfDocument() is true
+PASS isSelectionAtStartOfDocument() is false
+PASS isSelectionAtStartOfDocument() is true
+PASS isSelectionAtStartOfDocument() is false
+PASS isSelectionAtStartOfDocument() is true
+PASS isSelectionAtStartOfDocument() is false
+PASS isSelectionAtStartOfDocument() is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

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


--- trunk/LayoutTests/platform/mac/accessibility/selection-initial.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-initial.html	2014-03-19 06:16:40 UTC (rev 165870)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<title>Selection Initial</title>
+</head>
+<body>
+
+<p id="text">Text.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that initial selection is set when arrow keys are pressed and no selection exists.");
+    
+    function clearSelection() {
+        window.getSelection().removeAllRanges();
+    }
+    
+    function isSelectionAtStartOfDocument() {
+        var selection = window.getSelection();
+        return selection.rangeCount >= 1 && selection.getRangeAt(0).endOffset === 0 && selection.getRangeAt(0).startOffset === 0;
+    }
+    
+    if (window.accessibilityController && window.eventSender) {
+        // Down arrow key (should NOT set initial selection before enhanced accessibility is enabled).
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        eventSender.keyDown("downArrow");
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        clearSelection();
+        
+        // Enable enhanced accessibility (necessary for accessibility specific selection handling).
+        accessibilityController.enableEnhancedAccessibility(true);
+        shouldBe("accessibilityController.enhancedAccessibilityEnabled", "true");
+        
+        // Down arrow key.
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        eventSender.keyDown("downArrow");
+        shouldBe("isSelectionAtStartOfDocument()", "true");
+        clearSelection();
+        
+        // Left arrow key.
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        eventSender.keyDown("leftArrow");
+        shouldBe("isSelectionAtStartOfDocument()", "true");
+        clearSelection();
+        
+        // Right arrow key.
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        eventSender.keyDown("rightArrow");
+        shouldBe("isSelectionAtStartOfDocument()", "true");
+        clearSelection();
+        
+        // Up arrow key.
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        eventSender.keyDown("upArrow");
+        shouldBe("isSelectionAtStartOfDocument()", "true");
+        clearSelection();
+        
+        // Z key (only arrow keys should set initial selection if no selection exists).
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        eventSender.keyDown("Z");
+        shouldBe("isSelectionAtStartOfDocument()", "false");
+        
+        // Hide superfluous text.
+        document.getElementById("text").style.display = "none";
+    }
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (165869 => 165870)


--- trunk/Source/WebCore/ChangeLog	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebCore/ChangeLog	2014-03-19 06:16:40 UTC (rev 165870)
@@ -1,3 +1,22 @@
+2014-03-18  Samuel White  <[email protected]>
+
+        AX: Not able to use arrow keys to read text with VoiceOver before selection is set someplace (anyplace).
+        https://bugs.webkit.org/show_bug.cgi?id=130250
+
+        Reviewed by Chris Fleizach.
+
+        If initial selection isn't set when we handle selection movement for accessibility, we need to set it. If we don't, using arrow
+        keys to read text with VoiceOver doesn't work as expected. Things will only start working after the user holds shift and arrows
+        around to select any arbitrary thing to force selection to get set. This logic handles that special case more gracefully.
+
+        Test: platform/mac/accessibility/selection-initial.html
+
+        * page/EventHandler.cpp:
+        (WebCore::handleKeyboardSelectionMovement):
+        (WebCore::EventHandler::handleKeyboardSelectionMovementForAccessibility):
+        * testing/Internals.cpp:
+        (WebCore::Internals::resetToConsistentState):
+
 2014-03-18  Brent Fulgham  <[email protected]>
 
         TextTrackRegion Not Implemented

Modified: trunk/Source/WebCore/page/EventHandler.cpp (165869 => 165870)


--- trunk/Source/WebCore/page/EventHandler.cpp	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2014-03-19 06:16:40 UTC (rev 165870)
@@ -91,6 +91,7 @@
 #include "TextIterator.h"
 #include "UserGestureIndicator.h"
 #include "UserTypingGestureIndicator.h"
+#include "VisibleUnits.h"
 #include "WheelEvent.h"
 #include "WindowsKeyboardCodes.h"
 #include <wtf/Assertions.h>
@@ -3045,14 +3046,18 @@
     return retVal;
 }
 
-static void handleKeyboardSelectionMovement(FrameSelection& selection, KeyboardEvent* event)
+static void handleKeyboardSelectionMovement(Frame& frame, KeyboardEvent* event)
 {
     if (!event)
         return;
 
+    FrameSelection& selection = frame.selection();
+
+    bool isCommanded = event->getModifierState("Meta");
     bool isOptioned = event->getModifierState("Alt");
-    bool isCommanded = event->getModifierState("Meta");
+    bool isSelection = !selection.isNone();
 
+    FrameSelection::EAlteration alternation = event->getModifierState("Shift") ? FrameSelection::AlterationExtend : FrameSelection::AlterationMove;
     SelectionDirection direction = DirectionForward;
     TextGranularity granularity = CharacterGranularity;
 
@@ -3081,8 +3086,11 @@
         break;
     }
 
-    FrameSelection::EAlteration alternation = event->getModifierState("Shift") ? FrameSelection::AlterationExtend : FrameSelection::AlterationMove;
-    selection.modify(alternation, direction, granularity, UserTriggered);
+    if (isSelection)
+        selection.modify(alternation, direction, granularity, UserTriggered);
+    else
+        selection.setSelection(startOfDocument(frame.document()), FrameSelection::defaultSetSelectionOptions(UserTriggered));
+
     event->setDefaultHandled();
 }
 
@@ -3090,7 +3098,7 @@
 {
     if (event->type() == eventNames().keydownEvent) {
         if (AXObjectCache::accessibilityEnhancedUserInterfaceEnabled())
-            handleKeyboardSelectionMovement(m_frame.selection(), event);
+            handleKeyboardSelectionMovement(m_frame, event);
     }
 }
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (165869 => 165870)


--- trunk/Source/WebCore/testing/Internals.cpp	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebCore/testing/Internals.cpp	2014-03-19 06:16:40 UTC (rev 165870)
@@ -293,6 +293,7 @@
     MediaSessionManager::sharedManager().resetRestrictions();
 #endif
 #if HAVE(ACCESSIBILITY)
+    AXObjectCache::setEnhancedUserInterfaceAccessibility(false);
     AXObjectCache::disableAccessibility();
 #endif
 }

Modified: trunk/Source/WebKit/ChangeLog (165869 => 165870)


--- trunk/Source/WebKit/ChangeLog	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit/ChangeLog	2014-03-19 06:16:40 UTC (rev 165870)
@@ -1,3 +1,12 @@
+2014-03-18  Samuel White  <[email protected]>
+
+        AX: Not able to use arrow keys to read text with VoiceOver before selection is set someplace (anyplace).
+        https://bugs.webkit.org/show_bug.cgi?id=130250
+
+        Reviewed by Chris Fleizach.
+
+        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
+
 2014-03-17  Ryosuke Niwa  <[email protected]>
 
         Revert the erroneous change made by Xcode.

Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (165869 => 165870)


--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2014-03-19 06:16:40 UTC (rev 165870)
@@ -475,6 +475,7 @@
         symbolWithPointer(?completeURL@Document@WebCore@@UBE?AVURL@2@ABVString@WTF@@@Z, ?completeURL@Document@WebCore@@UEBA?AVURL@2@AEBVString@WTF@@@Z)
         symbolWithPointer(??1DOMWindow@WebCore@@UAE@XZ, ??1DOMWindow@WebCore@@UEAA@XZ)
         symbolWithPointer(?visibleContentRect@ScrollableArea@WebCore@@QBE?AVIntRect@2@W4VisibleContentRectBehavior@12@@Z, ?visibleContentRect@ScrollableArea@WebCore@@QEBA?AVIntRect@2@W4VisibleContentRectBehavior@12@@Z)
+        symbolWithPointer(?gAccessibilityEnhancedUserInterfaceEnabled@AXObjectCache@WebCore@@0_NA, ?gAccessibilityEnhancedUserInterfaceEnabled@AXObjectCache@WebCore@@0_NA)
         symbolWithPointer(?disableAccessibility@AXObjectCache@WebCore@@SAXXZ, ?disableAccessibility@AXObjectCache@WebCore@@SAXXZ)
         symbolWithPointer(?sessionID@Page@WebCore@@QBE?AVSessionID@2@XZ, ?sessionID@Page@WebCore@@QEBA?AVSessionID@2@XZ)
         symbolWithPointer(?resourceForURL@MemoryCache@WebCore@@QAEPAVCachedResource@2@ABVURL@2@VSessionID@2@@Z, ?resourceForURL@MemoryCache@WebCore@@QEAAPEAVCachedResource@2@AEBVURL@2@VSessionID@2@@Z)

Modified: trunk/Source/WebKit/mac/ChangeLog (165869 => 165870)


--- trunk/Source/WebKit/mac/ChangeLog	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-03-19 06:16:40 UTC (rev 165870)
@@ -1,3 +1,17 @@
+2014-03-18  Samuel White  <[email protected]>
+
+        AX: Not able to use arrow keys to read text with VoiceOver before selection is set someplace (anyplace).
+        https://bugs.webkit.org/show_bug.cgi?id=130250
+
+        Reviewed by Chris Fleizach.
+
+        Added ability to toggle enhanced accessibility on and off to support tests that require it.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame enhancedAccessibilityEnabled]):
+        (-[WebFrame setEnhancedAccessibility:]):
+        * WebView/WebFramePrivate.h:
+
 2014-03-17  Filip Pizlo  <[email protected]>
 
         More FTL enabling.

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (165869 => 165870)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2014-03-19 06:16:40 UTC (rev 165870)
@@ -2157,6 +2157,22 @@
 #endif
 }
 
+- (BOOL)enhancedAccessibilityEnabled
+{
+#if HAVE(ACCESSIBILITY)
+    return AXObjectCache::accessibilityEnhancedUserInterfaceEnabled();
+#else
+    return NO;
+#endif
+}
+
+- (void)setEnhancedAccessibility:(BOOL)enable
+{
+#if HAVE(ACCESSIBILITY)
+    AXObjectCache::setEnhancedUserInterfaceAccessibility(enable);
+#endif
+}
+
 - (NSString*)_layerTreeAsText
 {
     Frame* coreFrame = _private->coreFrame;

Modified: trunk/Source/WebKit/mac/WebView/WebFramePrivate.h (165869 => 165870)


--- trunk/Source/WebKit/mac/WebView/WebFramePrivate.h	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit/mac/WebView/WebFramePrivate.h	2014-03-19 06:16:40 UTC (rev 165870)
@@ -262,6 +262,10 @@
 // Sets the name presented to accessibility clients for the web area object.
 - (void)setAccessibleName:(NSString *)name;
 
+// Enhanced accessibility.
+- (BOOL)enhancedAccessibilityEnabled;
+- (void)setEnhancedAccessibility:(BOOL)enable;
+
 - (NSString*)_layerTreeAsText;
 
 // The top of the accessibility tree.

Modified: trunk/Source/WebKit2/ChangeLog (165869 => 165870)


--- trunk/Source/WebKit2/ChangeLog	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-19 06:16:40 UTC (rev 165870)
@@ -1,3 +1,17 @@
+2014-03-18  Samuel White  <[email protected]>
+
+        AX: Not able to use arrow keys to read text with VoiceOver before selection is set someplace (anyplace).
+        https://bugs.webkit.org/show_bug.cgi?id=130250
+
+        Reviewed by Chris Fleizach.
+
+        Added ability to toggle enhanced accessibility on and off to support tests that require it.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKAccessibilityEnableEnhancedAccessibility):
+        (WKAccessibilityEnhancedAccessibilityEnabled):
+        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+
 2014-03-18  Ryuan Choi  <[email protected]>
 
         [EFL][WK2] Rename async APIs for better consistency with EFL

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (165869 => 165870)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2014-03-19 06:16:40 UTC (rev 165870)
@@ -264,6 +264,22 @@
 #endif
 }
 
+void WKAccessibilityEnableEnhancedAccessibility(bool enable)
+{
+#if HAVE(ACCESSIBILITY)
+    WebCore::AXObjectCache::setEnhancedUserInterfaceAccessibility(enable);
+#endif
+}
+
+bool WKAccessibilityEnhancedAccessibilityEnabled()
+{
+#if HAVE(ACCESSIBILITY)
+    return WebCore::AXObjectCache::accessibilityEnhancedUserInterfaceEnabled();
+#else
+    return false;
+#endif
+}
+
 void WKBundlePageStopLoading(WKBundlePageRef pageRef)
 {
     toImpl(pageRef)->stopLoading();

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (165869 => 165870)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2014-03-19 06:16:40 UTC (rev 165870)
@@ -80,6 +80,9 @@
 WK_EXPORT void* WKAccessibilityRootObject(WKBundlePageRef);
 WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef);
 
+WK_EXPORT void WKAccessibilityEnableEnhancedAccessibility(bool);
+WK_EXPORT bool WKAccessibilityEnhancedAccessibilityEnabled();
+
 WK_EXPORT WKStringRef WKBundlePageCopyContextMenuItemTitle(WKContextMenuItemRef);
 WK_EXPORT void WKBundlePageClickMenuItem(WKBundlePageRef, WKContextMenuItemRef);
 WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuItems(WKBundlePageRef);

Modified: trunk/Tools/ChangeLog (165869 => 165870)


--- trunk/Tools/ChangeLog	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/ChangeLog	2014-03-19 06:16:40 UTC (rev 165870)
@@ -1,3 +1,35 @@
+2014-03-18  Samuel White  <[email protected]>
+
+        AX: Not able to use arrow keys to read text with VoiceOver before selection is set someplace (anyplace).
+        https://bugs.webkit.org/show_bug.cgi?id=130250
+
+        Reviewed by Chris Fleizach.
+
+        Added ability to toggle enhanced accessibility on and off to support tests that require it.
+
+        * DumpRenderTree/AccessibilityController.cpp:
+        (enableEnhancedAccessibilityCallback):
+        (getEnhancedAccessibilityEnabledCallback):
+        (AccessibilityController::getJSClass):
+        * DumpRenderTree/AccessibilityController.h:
+        * DumpRenderTree/atk/AccessibilityControllerAtk.cpp:
+        (AccessibilityController::enableEnhancedAccessibility):
+        (AccessibilityController::enhancedAccessibilityEnabled):
+        * DumpRenderTree/ios/AccessibilityControllerIOS.mm:
+        (AccessibilityController::enableEnhancedAccessibility):
+        (AccessibilityController::enhancedAccessibilityEnabled):
+        * DumpRenderTree/mac/AccessibilityControllerMac.mm:
+        (AccessibilityController::enableEnhancedAccessibility):
+        (AccessibilityController::enhancedAccessibilityEnabled):
+        * DumpRenderTree/win/AccessibilityControllerWin.cpp:
+        (AccessibilityController::enableEnhancedAccessibility):
+        (AccessibilityController::enhancedAccessibilityEnabled):
+        * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
+        (WTR::AccessibilityController::enableEnhancedAccessibility):
+        (WTR::AccessibilityController::enhancedAccessibilityEnabled):
+        * WebKitTestRunner/InjectedBundle/AccessibilityController.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:
+
 2014-03-18  Filip Pizlo  <[email protected]>
 
         Unreviewed, add some contributors, and fix Nadav's entry (he's not really a reviewer

Modified: trunk/Tools/DumpRenderTree/AccessibilityController.cpp (165869 => 165870)


--- trunk/Tools/DumpRenderTree/AccessibilityController.cpp	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/DumpRenderTree/AccessibilityController.cpp	2014-03-19 06:16:40 UTC (rev 165870)
@@ -130,6 +130,20 @@
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef enableEnhancedAccessibilityCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
+    if (argumentCount == 1)
+        controller->enableEnhancedAccessibility(JSValueToBoolean(context, arguments[0]));
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef getEnhancedAccessibilityEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
+    return JSValueMakeBoolean(context, controller->enhancedAccessibilityEnabled());
+}
+
 static JSValueRef getPlatformNameCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
 {
     AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
@@ -150,12 +164,14 @@
         { "accessibleElementById", getAccessibleElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "addNotificationListener", addNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "removeNotificationListener", removeNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "enableEnhancedAccessibility", enableEnhancedAccessibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
     };
 
     static JSStaticValue staticValues[] = {
         { "focusedElement", getFocusedElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "rootElement", getRootElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "enhancedAccessibilityEnabled", getEnhancedAccessibilityEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "platformName", getPlatformNameCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0, 0 }
     };

Modified: trunk/Tools/DumpRenderTree/AccessibilityController.h (165869 => 165870)


--- trunk/Tools/DumpRenderTree/AccessibilityController.h	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/DumpRenderTree/AccessibilityController.h	2014-03-19 06:16:40 UTC (rev 165870)
@@ -64,6 +64,10 @@
     bool addNotificationListener(JSObjectRef functionCallback);
     void removeNotificationListener();
 
+    // Enhanced accessibility.
+    void enableEnhancedAccessibility(bool);
+    bool enhancedAccessibilityEnabled();
+
     JSRetainPtr<JSStringRef> platformName() const;
 
 #if PLATFORM(WIN)

Modified: trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp (165869 => 165870)


--- trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp	2014-03-19 06:16:40 UTC (rev 165870)
@@ -106,6 +106,17 @@
     m_globalNotificationHandler = nullptr;
 }
 
+void AccessibilityController::enableEnhancedAccessibility(bool)
+{
+    // FIXME: implement
+}
+
+bool AccessibilityController::enhancedAccessibilityEnabled()
+{
+    // FIXME: implement
+    return false;
+}
+
 JSRetainPtr<JSStringRef> AccessibilityController::platformName() const
 {
     JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("atk"));

Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm (165869 => 165870)


--- trunk/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm	2014-03-19 06:16:40 UTC (rev 165870)
@@ -127,6 +127,16 @@
 {
 }
 
+void AccessibilityController::enableEnhancedAccessibility(bool enable)
+{
+    [mainFrame setEnhancedAccessibility:enable];
+}
+
+bool AccessibilityController::enhancedAccessibilityEnabled()
+{
+    return [mainFrame enhancedAccessibilityEnabled];
+}
+
 JSRetainPtr<JSStringRef> AccessibilityController::platformName() const
 {
     JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("ios"));

Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm (165869 => 165870)


--- trunk/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm	2014-03-19 06:16:40 UTC (rev 165870)
@@ -145,6 +145,16 @@
     // No longer a need to cleanup for tests, since resetToConsistentState will remove the listener.
 }
 
+void AccessibilityController::enableEnhancedAccessibility(bool enable)
+{
+    [mainFrame setEnhancedAccessibility:enable];
+}
+
+bool AccessibilityController::enhancedAccessibilityEnabled()
+{
+    return [mainFrame enhancedAccessibilityEnabled];
+}
+
 JSRetainPtr<JSStringRef> AccessibilityController::platformName() const
 {
     JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("mac"));

Modified: trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp (165869 => 165870)


--- trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2014-03-19 06:16:40 UTC (rev 165870)
@@ -394,6 +394,17 @@
     m_notificationListeners.add(element, functionCallback);
 }
 
+void AccessibilityController::enableEnhancedAccessibility(bool)
+{
+    // FIXME: implement
+}
+
+bool AccessibilityController::enhancedAccessibilityEnabled()
+{
+    // FIXME: implement
+    return false;
+}
+
 JSRetainPtr<JSStringRef> AccessibilityController::platformName() const
 {
     JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("win"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp (165869 => 165870)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2014-03-19 06:16:40 UTC (rev 165870)
@@ -61,6 +61,16 @@
     return JSAccessibilityController::accessibilityControllerClass();
 }
 
+void AccessibilityController::enableEnhancedAccessibility(bool enable)
+{
+    WKAccessibilityEnableEnhancedAccessibility(enable);
+}
+
+bool AccessibilityController::enhancedAccessibilityEnabled()
+{
+    return WKAccessibilityEnhancedAccessibilityEnabled();
+}
+
 #if !PLATFORM(GTK) && !PLATFORM(EFL)
 PassRefPtr<AccessibilityUIElement> AccessibilityController::rootElement()
 {

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h (165869 => 165870)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h	2014-03-19 06:16:40 UTC (rev 165870)
@@ -44,6 +44,10 @@
     void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
     virtual JSClassRef wrapperClass();
     
+    // Enhanced accessibility.
+    void enableEnhancedAccessibility(bool);
+    bool enhancedAccessibilityEnabled();
+    
     JSRetainPtr<JSStringRef> platformName();
 
     // Controller Methods - platform-independent implementations.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl (165869 => 165870)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl	2014-03-19 04:44:22 UTC (rev 165869)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl	2014-03-19 06:16:40 UTC (rev 165870)
@@ -24,6 +24,9 @@
  */
 
 interface AccessibilityController {
+    void enableEnhancedAccessibility(boolean enable);
+    readonly attribute boolean enhancedAccessibilityEnabled;
+
     readonly attribute DOMString platformName;
     readonly attribute AccessibilityUIElement rootElement;
     readonly attribute AccessibilityUIElement focusedElement;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to