Diff
Modified: trunk/LayoutTests/ChangeLog (180717 => 180718)
--- trunk/LayoutTests/ChangeLog 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/LayoutTests/ChangeLog 2015-02-27 01:57:48 UTC (rev 180718)
@@ -1,3 +1,27 @@
+2015-02-26 Doug Russell <[email protected]>
+
+ AX: Expose caret browsing preference to accessibility API
+ https://bugs.webkit.org/show_bug.cgi?id=141862
+
+ Reviewed by Chris Fleizach.
+
+ Exposing the caret browsing setting on WebCore::Frame via the accessibility API would allow assistive tech apps to enable it contextually (for example, when the assistive tech app is running).
+ Enabling caret browsing when assistive tech apps are running greatly improves the reliability of keyboard navigation on the web. Most especially in cases where selection would be disrupted by focus events.
+
+ * accessibility/parent-delete-expected.txt:
+ * platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt: Added.
+ * platform/mac/accessibility/caret-browsing-arrow-nav.html: Added.
+ * platform/mac/accessibility/caret-browsing-attribute-expected.txt: Added.
+ * platform/mac/accessibility/caret-browsing-attribute.html: Added.
+ * platform/mac/accessibility/caret-browsing-tab-selection-expected.txt: Added.
+ * platform/mac/accessibility/caret-browsing-tab-selection.html: Added.
+ * platform/mac/accessibility/document-attributes-expected.txt:
+ * platform/mac/accessibility/resources/accessibility-helper.js: Added.
+ (clearSelectionAndFocusOnWebArea):
+ (elementAtStartMarkerOfSelectedTextMarkerRange):
+ (caretBrowsingEnabled):
+ (setCaretBrowsingEnabled):
+
2015-02-26 Joseph Pecoraro <[email protected]>
Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
Modified: trunk/LayoutTests/accessibility/parent-delete-expected.txt (180717 => 180718)
--- trunk/LayoutTests/accessibility/parent-delete-expected.txt 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/LayoutTests/accessibility/parent-delete-expected.txt 2015-02-27 01:57:48 UTC (rev 180718)
@@ -27,5 +27,6 @@
AXLayoutCount: 2
AXLoadingProgress: 1
AXURL: LayoutTests/accessibility/parent-delete.html
+AXCaretBrowsingEnabled: 0
AXElementBusy: 0
Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt (0 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt 2015-02-27 01:57:48 UTC (rev 180718)
@@ -0,0 +1,26 @@
+Foo
+Bar
+Baz
+This tests caret browsing when a keydown handler moves focus.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS webArea.role is 'AXRole: AXWebArea'
+PASS caretBrowsingEnabled(webArea) is false
+PASS accessibilityController.enhancedAccessibilityEnabled is true
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Bar'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Baz'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS caretBrowsingEnabled(webArea) is true
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Bar'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Bar'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav.html (0 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav.html 2015-02-27 01:57:48 UTC (rev 180718)
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body id="body" _onkeydown_="keydown(event)">
+ <script>
+ function keydown(event) {
+ var key = event.keyCode;
+ var currentId = parseInt(document.activeElement.id);
+ if (isNaN(currentId)) { currentId = 0; }
+ if (key == 39) { currentId++; }
+ if (currentId < 1) { currentId = 3; }
+ else if (currentId > 3) { currentId = 1; }
+ document.getElementById(currentId).focus();
+ }
+ </script>
+ <div>
+ <ul>
+ <li><a id="1" href=""
+ <li><a id="2" href=""
+ <li><a id="3" href=""
+ </ul>
+ </div>
+ <div id="console"></div>
+ <script>
+ description("This tests caret browsing when a keydown handler moves focus.");
+ if (window.testRunner) {
+
+ testRunner.dumpAsText();
+
+ if (window.accessibilityController && window.eventSender) {
+
+ var webArea = clearSelectionAndFocusOnWebArea();
+
+ // Enable enhanced accessibility (necessary for accessibility specific selection handling).
+ accessibilityController.enableEnhancedAccessibility(true);
+ shouldBe("accessibilityController.enhancedAccessibilityEnabled", "true");
+
+ // Focus into first link
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Foo'");
+
+ // Navigating with arrows, without caret browsing, will pull selection into the different links
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Bar'");
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Baz'");
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Foo'");
+
+ // Do it again with caret browsing on
+ setCaretBrowsingEnabled(webArea, true);
+ shouldBe("caretBrowsingEnabled(webArea)", "true");
+
+ // Arrow to the start of Foo
+ eventSender.keyDown("leftArrow");
+ eventSender.keyDown("leftArrow");
+ eventSender.keyDown("leftArrow");
+
+ // Navigating with arrows, with caret browsing, will move the caret through the characters of the element before moving to the next element
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Foo'");
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Foo'");
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Foo'");
+ eventSender.keyDown("rightArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Bar'");
+
+ // Up & down arrows should move through the list items
+ eventSender.keyDown("upArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Foo'");
+ eventSender.keyDown("downArrow");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: Bar'");
+
+ setCaretBrowsingEnabled(webArea, false);
+ }
+ }
+ </script>
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute-expected.txt (0 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute-expected.txt 2015-02-27 01:57:48 UTC (rev 180718)
@@ -0,0 +1,11 @@
+This tests setting caret browsing preference via ax api.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS caretBrowsingEnabled(webArea) is true
+PASS caretBrowsingEnabled(webArea) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute.html (0 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute.html 2015-02-27 01:57:48 UTC (rev 180718)
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body id="body">
+<script>
+description("This tests setting caret browsing preference via ax api.");
+if (window.testRunner) {
+
+ testRunner.dumpAsText();
+
+ if (window.accessibilityController) {
+
+ var webArea = accessibilityController.rootElement.childAtIndex(0);
+
+ setCaretBrowsingEnabled(webArea, true);
+ shouldBe("caretBrowsingEnabled(webArea)", "true");
+
+ setCaretBrowsingEnabled(webArea, false);
+ shouldBe("caretBrowsingEnabled(webArea)", "false");
+ }
+}
+</script>
+<script src=""
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection-expected.txt (0 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection-expected.txt 2015-02-27 01:57:48 UTC (rev 180718)
@@ -0,0 +1,21 @@
+foo
+A paragraph with a single line
+
+bar
+This tests caret browsing for html select elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS webArea.role is 'AXRole: AXWebArea'
+PASS caretBrowsingEnabled(webArea) is false
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: foo'
+PASS accessibilityController.enhancedAccessibilityEnabled is true
+PASS caretBrowsingEnabled(webArea) is true
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: bar'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection.html (0 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection.html 2015-02-27 01:57:48 UTC (rev 180718)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body id="body">
+ <a href=""
+ <p id="par1">A paragraph with a single line</p>
+ <a href=""
+ <div id="console"></div>
+ <script>
+ description("This tests caret browsing for html select elements.");
+ if (window.testRunner) {
+
+ testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+ testRunner.dumpAsText();
+
+ if (window.accessibilityController && window.eventSender) {
+
+ var webArea = clearSelectionAndFocusOnWebArea();
+
+ accessibilityController.enableEnhancedAccessibility(false);
+
+ // Tab (should NOT move selection before enhanced accessibility is enabled).
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: foo'");
+ eventSender.keyDown("\t");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: foo'");
+
+ // Enable enhanced accessibility (necessary for accessibility specific selection handling).
+ accessibilityController.enableEnhancedAccessibility(true);
+ shouldBe("accessibilityController.enhancedAccessibilityEnabled", "true");
+
+ // Enable caret browsing so that tabbing will modify selection
+ setCaretBrowsingEnabled(webArea, true);
+ shouldBe("caretBrowsingEnabled(webArea)", "true");
+
+ // Tab to move focus to next link
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: foo'");
+ eventSender.keyDown("\t");
+ shouldBe("elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue", "'AXValue: bar'");
+
+ setCaretBrowsingEnabled(webArea, false);
+ }
+ }
+ </script>
+ <script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt (180717 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt 2015-02-27 01:57:48 UTC (rev 180718)
@@ -26,6 +26,7 @@
AXLayoutCount: 2
AXLoadingProgress: 1
AXURL: LayoutTests/platform/mac/accessibility/document-attributes.html
+AXCaretBrowsingEnabled: 0
AXElementBusy: 0
Added: trunk/LayoutTests/platform/mac/accessibility/resources/accessibility-helper.js (0 => 180718)
--- trunk/LayoutTests/platform/mac/accessibility/resources/accessibility-helper.js (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/resources/accessibility-helper.js 2015-02-27 01:57:48 UTC (rev 180718)
@@ -0,0 +1,23 @@
+function clearSelectionAndFocusOnWebArea() {
+ webArea = accessibilityController.rootElement.childAtIndex(0);
+ webArea.resetSelectedTextMarkerRange();
+ setCaretBrowsingEnabled(webArea, false);
+ shouldBe("webArea.role", "'AXRole: AXWebArea'");
+ shouldBe("caretBrowsingEnabled(webArea)", "false");
+ return webArea;
+}
+
+function elementAtStartMarkerOfSelectedTextMarkerRange(webArea) {
+ var range = webArea.selectedTextMarkerRange();
+ var start = webArea.startTextMarkerForTextMarkerRange(range);
+ var element = webArea.accessibilityElementForTextMarker(start);
+ return element;
+}
+
+function caretBrowsingEnabled(webArea) {
+ return webArea.boolAttributeValue("AXCaretBrowsingEnabled");
+}
+
+function setCaretBrowsingEnabled(webArea, value) {
+ webArea.setBoolAttributeValue("AXCaretBrowsingEnabled", value);
+}
Modified: trunk/Source/WebCore/ChangeLog (180717 => 180718)
--- trunk/Source/WebCore/ChangeLog 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/ChangeLog 2015-02-27 01:57:48 UTC (rev 180718)
@@ -1,3 +1,28 @@
+2015-02-26 Doug Russell <[email protected]>
+
+ AX: Expose caret browsing preference to accessibility API
+ https://bugs.webkit.org/show_bug.cgi?id=141862
+
+ Reviewed by Chris Fleizach.
+
+ Exposing the caret browsing setting on WebCore::Frame via the accessibility API would allow assistive tech apps to enable it contextually (for example, when the assistive tech app is running).
+ Enabling caret browsing when assistive tech apps are running greatly improves the reliability of keyboard navigation on the web. Most especially in cases where selection would be disrupted by focus events.
+
+ Tests: platform/mac/accessibility/caret-browsing-arrow-nav.html
+ platform/mac/accessibility/caret-browsing-attribute.html
+ platform/mac/accessibility/caret-browsing-tab-selection.html
+
+ * accessibility/AccessibilityObject.h:
+ * accessibility/mac/AccessibilityObjectMac.mm:
+ (WebCore::AccessibilityObject::caretBrowsingEnabled):
+ (WebCore::AccessibilityObject::setCaretBrowsingEnabled):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+ (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
+ (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
+ (-[WebAccessibilityObjectWrapper _accessibilitySetTestValue:forAttribute:]):
+
2015-02-26 Gyuyoung Kim <[email protected]>
Remove unnecessary create() factory functions
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (180717 => 180718)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2015-02-27 01:57:48 UTC (rev 180718)
@@ -978,6 +978,11 @@
// other operations update type operations
void updateBackingStore();
+#if PLATFORM(COCOA) && !PLATFORM(IOS)
+ bool caretBrowsingEnabled() const;
+ void setCaretBrowsingEnabled(bool);
+#endif
+
protected:
AXID m_id;
AccessibilityChildrenVector m_children;
Modified: trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm (180717 => 180718)
--- trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm 2015-02-27 01:57:48 UTC (rev 180718)
@@ -28,6 +28,7 @@
#import "ElementAncestorIterator.h"
#import "HTMLFieldSetElement.h"
#import "RenderObject.h"
+#import "Settings.h"
#if HAVE(ACCESSIBILITY)
@@ -106,6 +107,20 @@
return DefaultBehavior;
}
+bool AccessibilityObject::caretBrowsingEnabled() const
+{
+ Frame* frame = this->frame();
+ return frame && frame->settings().caretBrowsingEnabled();
+}
+
+void AccessibilityObject::setCaretBrowsingEnabled(bool on)
+{
+ Frame* frame = this->frame();
+ if (!frame)
+ return;
+ frame->settings().setCaretBrowsingEnabled(on);
+}
+
} // WebCore
#endif // HAVE(ACCESSIBILITY)
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (180717 => 180718)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2015-02-27 01:57:48 UTC (rev 180718)
@@ -464,6 +464,10 @@
#define NSAccessibilityMathPrescriptsAttribute @"AXMathPrescripts"
#define NSAccessibilityMathPostscriptsAttribute @"AXMathPostscripts"
+#ifndef NSAccessibilityCaretBrowsingEnabledAttribute
+#define NSAccessibilityCaretBrowsingEnabledAttribute @"AXCaretBrowsingEnabled"
+#endif
+
@implementation WebAccessibilityObjectWrapper
- (void)unregisterUniqueIdForUIElement
@@ -1354,6 +1358,7 @@
[tempArray addObject:@"AXLayoutCount"];
[tempArray addObject:NSAccessibilityLoadingProgressAttribute];
[tempArray addObject:NSAccessibilityURLAttribute];
+ [tempArray addObject:NSAccessibilityCaretBrowsingEnabledAttribute];
webAreaAttrs = [[NSArray alloc] initWithArray:tempArray];
[tempArray release];
}
@@ -2953,6 +2958,9 @@
if ([attributeName isEqualToString:@"AXDRTElementIdAttribute"])
return m_object->getAttribute(idAttr);
+ if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
+ return [NSNumber numberWithBool:m_object->caretBrowsingEnabled()];
+
return nil;
}
@@ -3025,6 +3033,9 @@
if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
return YES;
+ if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
+ return YES;
+
return NO;
}
@@ -3341,8 +3352,17 @@
m_object->setSelectedRows(selectedRows);
} else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
m_object->setARIAGrabbed([number boolValue]);
+ else if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
+ m_object->setCaretBrowsingEnabled([number boolValue]);
}
+// Used to set attributes synchronously on accessibility elements within tests.
+// For use with DumpRenderTree only.
+- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName
+{
+ [self _accessibilitySetValue:value forAttribute:attributeName];
+}
+
static RenderObject* rendererForView(NSView* view)
{
if (![view conformsToProtocol:@protocol(WebCoreFrameView)])
Modified: trunk/Tools/ChangeLog (180717 => 180718)
--- trunk/Tools/ChangeLog 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/ChangeLog 2015-02-27 01:57:48 UTC (rev 180718)
@@ -1,3 +1,37 @@
+2015-02-26 Doug Russell <[email protected]>
+
+ AX: Expose caret browsing preference to accessibility API
+ https://bugs.webkit.org/show_bug.cgi?id=141862
+
+ Reviewed by Chris Fleizach.
+
+ Exposing the caret browsing setting on WebCore::Frame via the accessibility API would allow assistive tech apps to enable it contextually (for example, when the assistive tech app is running).
+ Enabling caret browsing when assistive tech apps are running greatly improves the reliability of keyboard navigation on the web. Most especially in cases where selection would be disrupted by focus events.
+
+ * DumpRenderTree/AccessibilityUIElement.cpp:
+ (setBoolAttributeValueCallback):
+ (selectedTextMarkerRangeCallback):
+ (resetSelectedTextMarkerRangeCallback):
+ (AccessibilityUIElement::setBoolAttributeValue):
+ (AccessibilityUIElement::selectedTextMarkerRange):
+ (AccessibilityUIElement::resetSelectedTextMarkerRange):
+ (AccessibilityUIElement::getJSClass):
+ * DumpRenderTree/AccessibilityUIElement.h:
+ * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+ (AccessibilityUIElement::setBoolAttributeValue):
+ (AccessibilityUIElement::selectedTextMarkerRange):
+ (AccessibilityUIElement::resetSelectedTextMarkerRange):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+ (WTR::AccessibilityUIElement::selectedTextMarkerRange):
+ (WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):
+ (WTR::AccessibilityUIElement::setBoolAttributeValue):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+ * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+ * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+ (WTR::AccessibilityUIElement::setBoolAttributeValue):
+ (WTR::AccessibilityUIElement::selectedTextMarkerRange):
+ (WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):
+
2015-02-26 Brent Fulgham <[email protected]>
[Win] Remove WebKitExportGenerator project (and related)
Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp (180717 => 180718)
--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp 2015-02-27 01:57:48 UTC (rev 180718)
@@ -523,6 +523,20 @@
return result;
}
+static JSValueRef setBoolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSStringRef attribute = nullptr;
+ bool value = false;
+ if (argumentCount == 2) {
+ attribute = JSValueToStringCopy(context, arguments[0], exception);
+ value = JSValueToBoolean(context, arguments[1]);
+ }
+ toAXElement(thisObject)->setBoolAttributeValue(attribute, value);
+ if (attribute)
+ JSStringRelease(attribute);
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
JSStringRef attribute = 0;
@@ -703,6 +717,17 @@
return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForElement(uiElement));
}
+static JSValueRef selectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->selectedTextMarkerRange());
+}
+
+static JSValueRef resetSelectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ toAXElement(thisObject)->resetSelectedTextMarkerRange();
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef attributedStringForTextMarkerRangeContainsAttributeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
AccessibilityTextMarkerRange* markerRange = 0;
@@ -1366,6 +1391,10 @@
}
#endif
+#if !PLATFORM(MAC)
+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
+#endif
+
#if !SUPPORTS_AX_TEXTMARKERS
AccessibilityTextMarkerRange AccessibilityUIElement::lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*)
@@ -1378,6 +1407,15 @@
return 0;
}
+AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange()
+{
+ return nullptr;
+}
+
+void AccessibilityUIElement::resetSelectedTextMarkerRange()
+{
+}
+
int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*)
{
return 0;
@@ -1600,6 +1638,7 @@
{ "uiElementAttributeValue", uiElementAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberAttributeValue", numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setBoolAttributeValue", setBoolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isPressActionSupported", isPressActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -1626,6 +1665,8 @@
{ "removeSelection", removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "lineTextMarkerRangeForTextMarker", lineTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "textMarkerRangeForElement", textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "selectedTextMarkerRange", selectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "resetSelectedTextMarkerRange", resetSelectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "attributedStringForTextMarkerRangeContainsAttribute", attributedStringForTextMarkerRangeContainsAttributeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "indexForTextMarker", indexForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isTextMarkerValid", isTextMarkerValidCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -1659,7 +1700,6 @@
{ "increaseTextSelection", increaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "decreaseTextSelection", decreaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "assistiveTechnologySimulatedFocus", assistiveTechnologySimulatedFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
-
#endif
{ 0, 0, 0 }
};
Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.h (180717 => 180718)
--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.h 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.h 2015-02-27 01:57:48 UTC (rev 180718)
@@ -109,6 +109,7 @@
void uiElementArrayAttributeValue(JSStringRef attribute, Vector<AccessibilityUIElement>& elements) const;
AccessibilityUIElement uiElementAttributeValue(JSStringRef attribute) const;
bool boolAttributeValue(JSStringRef attribute);
+ void setBoolAttributeValue(JSStringRef attribute, bool value);
bool isAttributeSupported(JSStringRef attribute);
bool isAttributeSettable(JSStringRef attribute);
bool isPressActionSupported();
@@ -251,6 +252,8 @@
AccessibilityUIElement accessibilityElementForTextMarker(AccessibilityTextMarker*);
AccessibilityTextMarker startTextMarker();
AccessibilityTextMarker endTextMarker();
+ AccessibilityTextMarkerRange selectedTextMarkerRange();
+ void resetSelectedTextMarkerRange();
JSStringRef stringForTextMarkerRange(AccessibilityTextMarkerRange*);
int textMarkerRangeLength(AccessibilityTextMarkerRange*);
Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (180717 => 180718)
--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm 2015-02-27 01:57:48 UTC (rev 180718)
@@ -65,12 +65,17 @@
#define NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute @"AXStartTextMarkerForBounds"
#endif
+#ifndef NSAccessibilitySelectedTextMarkerRangeAttribute
+#define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange"
+#endif
+
typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
@interface NSObject (WebKitAccessibilityAdditions)
- (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
- (NSUInteger)accessibilityIndexOfChild:(id)child;
- (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
+- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName;
@end
AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
@@ -578,6 +583,13 @@
return false;
}
+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef attribute, bool value)
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ [m_element _accessibilitySetTestValue:@(value) forAttribute:[NSString stringWithJSStringRef:attribute]];
+ END_AX_OBJC_EXCEPTIONS
+}
+
bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
{
BEGIN_AX_OBJC_EXCEPTIONS
@@ -1560,6 +1572,32 @@
return nullptr;
}
+AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange()
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute];
+ return AccessibilityTextMarkerRange(textMarkerRange);
+ END_AX_OBJC_EXCEPTIONS
+
+ return nullptr;
+}
+
+void AccessibilityUIElement::resetSelectedTextMarkerRange()
+{
+ id start = [m_element accessibilityAttributeValue:@"AXStartTextMarker"];
+ if (!start)
+ return;
+
+ NSArray* textMarkers = @[start, start];
+ id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers];
+ if (!textMarkerRange)
+ return;
+
+ BEGIN_AX_OBJC_EXCEPTIONS
+ [m_element _accessibilitySetTestValue:textMarkerRange forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
+ END_AX_OBJC_EXCEPTIONS
+}
+
int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange* range)
{
BEGIN_AX_OBJC_EXCEPTIONS
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (180717 => 180718)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp 2015-02-27 01:57:48 UTC (rev 180718)
@@ -211,5 +211,11 @@
#endif
+#if !PLATFORM(MAC) || !HAVE(ACCESSIBILITY)
+PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange() { return nullptr; }
+void AccessibilityUIElement::resetSelectedTextMarkerRange() { }
+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
+#endif
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (180717 => 180718)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2015-02-27 01:57:48 UTC (rev 180718)
@@ -105,6 +105,7 @@
JSValueRef uiElementArrayAttributeValue(JSStringRef attribute) const;
PassRefPtr<AccessibilityUIElement> uiElementAttributeValue(JSStringRef attribute) const;
bool boolAttributeValue(JSStringRef attribute);
+ void setBoolAttributeValue(JSStringRef attribute, bool value);
bool isAttributeSupported(JSStringRef attribute);
bool isAttributeSettable(JSStringRef attribute);
bool isPressActionSupported();
@@ -229,6 +230,8 @@
PassRefPtr<AccessibilityTextMarkerRange> lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*);
PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForElement(AccessibilityUIElement*);
PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker);
+ PassRefPtr<AccessibilityTextMarkerRange> selectedTextMarkerRange();
+ void resetSelectedTextMarkerRange();
PassRefPtr<AccessibilityTextMarker> startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
PassRefPtr<AccessibilityTextMarker> endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
PassRefPtr<AccessibilityTextMarker> endTextMarkerForBounds(int x, int y, int width, int height);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (180717 => 180718)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl 2015-02-27 01:57:48 UTC (rev 180718)
@@ -62,6 +62,7 @@
object uiElementArrayAttributeValue(DOMString attr);
AccessibilityUIElement uiElementAttributeValue(DOMString attr);
boolean boolAttributeValue(DOMString attr);
+ void setBoolAttributeValue(DOMString attr, boolean value);
boolean isAttributeSupported(DOMString attr);
boolean isAttributeSettable(DOMString attr);
boolean isPressActionSupported();
@@ -174,6 +175,8 @@
AccessibilityTextMarkerRange lineTextMarkerRangeForTextMarker(AccessibilityTextMarker textMarker);
AccessibilityTextMarkerRange textMarkerRangeForElement(AccessibilityUIElement element);
AccessibilityTextMarkerRange textMarkerRangeForMarkers(AccessibilityTextMarker startMarker, AccessibilityTextMarker endMarker);
+ AccessibilityTextMarkerRange selectedTextMarkerRange();
+ void resetSelectedTextMarkerRange();
AccessibilityTextMarker startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
AccessibilityTextMarker endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
AccessibilityTextMarker endTextMarkerForBounds(int x, int y, int width, int height);
@@ -201,6 +204,5 @@
// Notification support.
boolean addNotificationListener(object callbackFunction);
boolean removeNotificationListener();
-
};
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (180717 => 180718)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2015-02-27 01:57:48 UTC (rev 180718)
@@ -69,12 +69,17 @@
#define NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute @"AXStartTextMarkerForBounds"
#endif
+#ifndef NSAccessibilitySelectedTextMarkerRangeAttribute
+#define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange"
+#endif
+
typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
@interface NSObject (WebKitAccessibilityAdditions)
- (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
- (NSUInteger)accessibilityIndexOfChild:(id)child;
- (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
+- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName;
@end
namespace WTR {
@@ -623,6 +628,13 @@
return false;
}
+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef attribute, bool value)
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ [m_element _accessibilitySetTestValue:@(value) forAttribute:[NSString stringWithJSStringRef:attribute]];
+ END_AX_OBJC_EXCEPTIONS
+}
+
bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
{
BEGIN_AX_OBJC_EXCEPTIONS
@@ -1623,7 +1635,33 @@
return nullptr;
}
+
+PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange()
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute];
+ return AccessibilityTextMarkerRange::create(textMarkerRange);
+ END_AX_OBJC_EXCEPTIONS
+
+ return nullptr;
+}
+void AccessibilityUIElement::resetSelectedTextMarkerRange()
+{
+ id start = [m_element accessibilityAttributeValue:@"AXStartTextMarker"];
+ if (!start)
+ return;
+
+ NSArray* textMarkers = @[start, start];
+ id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers];
+ if (!textMarkerRange)
+ return;
+
+ BEGIN_AX_OBJC_EXCEPTIONS
+ [m_element _accessibilitySetTestValue:textMarkerRange forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
+ END_AX_OBJC_EXCEPTIONS
+}
+
PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range)
{
BEGIN_AX_OBJC_EXCEPTIONS