Changeset 180718 in webkit
- Timestamp:
- Feb 26, 2015 5:57:48 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r180715 r180718 1 2015-02-26 Doug Russell <d_russell@apple.com> 2 3 AX: Expose caret browsing preference to accessibility API 4 https://bugs.webkit.org/show_bug.cgi?id=141862 5 6 Reviewed by Chris Fleizach. 7 8 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). 9 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. 10 11 * accessibility/parent-delete-expected.txt: 12 * platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt: Added. 13 * platform/mac/accessibility/caret-browsing-arrow-nav.html: Added. 14 * platform/mac/accessibility/caret-browsing-attribute-expected.txt: Added. 15 * platform/mac/accessibility/caret-browsing-attribute.html: Added. 16 * platform/mac/accessibility/caret-browsing-tab-selection-expected.txt: Added. 17 * platform/mac/accessibility/caret-browsing-tab-selection.html: Added. 18 * platform/mac/accessibility/document-attributes-expected.txt: 19 * platform/mac/accessibility/resources/accessibility-helper.js: Added. 20 (clearSelectionAndFocusOnWebArea): 21 (elementAtStartMarkerOfSelectedTextMarkerRange): 22 (caretBrowsingEnabled): 23 (setCaretBrowsingEnabled): 24 1 25 2015-02-26 Joseph Pecoraro <pecoraro@apple.com> 2 26 -
trunk/LayoutTests/accessibility/parent-delete-expected.txt
r171360 r180718 28 28 AXLoadingProgress: 1 29 29 AXURL: LayoutTests/accessibility/parent-delete.html 30 AXCaretBrowsingEnabled: 0 30 31 AXElementBusy: 0 31 32 -
trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt
r171360 r180718 27 27 AXLoadingProgress: 1 28 28 AXURL: LayoutTests/platform/mac/accessibility/document-attributes.html 29 AXCaretBrowsingEnabled: 0 29 30 AXElementBusy: 0 30 31 -
trunk/Source/WebCore/ChangeLog
r180717 r180718 1 2015-02-26 Doug Russell <d_russell@apple.com> 2 3 AX: Expose caret browsing preference to accessibility API 4 https://bugs.webkit.org/show_bug.cgi?id=141862 5 6 Reviewed by Chris Fleizach. 7 8 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). 9 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. 10 11 Tests: platform/mac/accessibility/caret-browsing-arrow-nav.html 12 platform/mac/accessibility/caret-browsing-attribute.html 13 platform/mac/accessibility/caret-browsing-tab-selection.html 14 15 * accessibility/AccessibilityObject.h: 16 * accessibility/mac/AccessibilityObjectMac.mm: 17 (WebCore::AccessibilityObject::caretBrowsingEnabled): 18 (WebCore::AccessibilityObject::setCaretBrowsingEnabled): 19 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 20 (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]): 21 (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 22 (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]): 23 (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]): 24 (-[WebAccessibilityObjectWrapper _accessibilitySetTestValue:forAttribute:]): 25 1 26 2015-02-26 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 27 -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r180621 r180718 979 979 void updateBackingStore(); 980 980 981 #if PLATFORM(COCOA) && !PLATFORM(IOS) 982 bool caretBrowsingEnabled() const; 983 void setCaretBrowsingEnabled(bool); 984 #endif 985 981 986 protected: 982 987 AXID m_id; -
trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
r179228 r180718 29 29 #import "HTMLFieldSetElement.h" 30 30 #import "RenderObject.h" 31 #import "Settings.h" 31 32 32 33 #if HAVE(ACCESSIBILITY) … … 107 108 } 108 109 110 bool AccessibilityObject::caretBrowsingEnabled() const 111 { 112 Frame* frame = this->frame(); 113 return frame && frame->settings().caretBrowsingEnabled(); 114 } 115 116 void AccessibilityObject::setCaretBrowsingEnabled(bool on) 117 { 118 Frame* frame = this->frame(); 119 if (!frame) 120 return; 121 frame->settings().setCaretBrowsingEnabled(on); 122 } 123 109 124 } // WebCore 110 125 -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r180621 r180718 464 464 #define NSAccessibilityMathPrescriptsAttribute @"AXMathPrescripts" 465 465 #define NSAccessibilityMathPostscriptsAttribute @"AXMathPostscripts" 466 467 #ifndef NSAccessibilityCaretBrowsingEnabledAttribute 468 #define NSAccessibilityCaretBrowsingEnabledAttribute @"AXCaretBrowsingEnabled" 469 #endif 466 470 467 471 @implementation WebAccessibilityObjectWrapper … … 1355 1359 [tempArray addObject:NSAccessibilityLoadingProgressAttribute]; 1356 1360 [tempArray addObject:NSAccessibilityURLAttribute]; 1361 [tempArray addObject:NSAccessibilityCaretBrowsingEnabledAttribute]; 1357 1362 webAreaAttrs = [[NSArray alloc] initWithArray:tempArray]; 1358 1363 [tempArray release]; … … 2954 2959 return m_object->getAttribute(idAttr); 2955 2960 2961 if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute]) 2962 return [NSNumber numberWithBool:m_object->caretBrowsingEnabled()]; 2963 2956 2964 return nil; 2957 2965 } … … 3024 3032 3025 3033 if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute]) 3034 return YES; 3035 3036 if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute]) 3026 3037 return YES; 3027 3038 … … 3342 3353 } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute]) 3343 3354 m_object->setARIAGrabbed([number boolValue]); 3355 else if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute]) 3356 m_object->setCaretBrowsingEnabled([number boolValue]); 3357 } 3358 3359 // Used to set attributes synchronously on accessibility elements within tests. 3360 // For use with DumpRenderTree only. 3361 - (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName 3362 { 3363 [self _accessibilitySetValue:value forAttribute:attributeName]; 3344 3364 } 3345 3365 -
trunk/Tools/ChangeLog
r180705 r180718 1 2015-02-26 Doug Russell <d_russell@apple.com> 2 3 AX: Expose caret browsing preference to accessibility API 4 https://bugs.webkit.org/show_bug.cgi?id=141862 5 6 Reviewed by Chris Fleizach. 7 8 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). 9 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. 10 11 * DumpRenderTree/AccessibilityUIElement.cpp: 12 (setBoolAttributeValueCallback): 13 (selectedTextMarkerRangeCallback): 14 (resetSelectedTextMarkerRangeCallback): 15 (AccessibilityUIElement::setBoolAttributeValue): 16 (AccessibilityUIElement::selectedTextMarkerRange): 17 (AccessibilityUIElement::resetSelectedTextMarkerRange): 18 (AccessibilityUIElement::getJSClass): 19 * DumpRenderTree/AccessibilityUIElement.h: 20 * DumpRenderTree/mac/AccessibilityUIElementMac.mm: 21 (AccessibilityUIElement::setBoolAttributeValue): 22 (AccessibilityUIElement::selectedTextMarkerRange): 23 (AccessibilityUIElement::resetSelectedTextMarkerRange): 24 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: 25 (WTR::AccessibilityUIElement::selectedTextMarkerRange): 26 (WTR::AccessibilityUIElement::resetSelectedTextMarkerRange): 27 (WTR::AccessibilityUIElement::setBoolAttributeValue): 28 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: 29 * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: 30 * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: 31 (WTR::AccessibilityUIElement::setBoolAttributeValue): 32 (WTR::AccessibilityUIElement::selectedTextMarkerRange): 33 (WTR::AccessibilityUIElement::resetSelectedTextMarkerRange): 34 1 35 2015-02-26 Brent Fulgham <bfulgham@apple.com> 2 36 -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp
r176343 r180718 524 524 } 525 525 526 static JSValueRef setBoolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 527 { 528 JSStringRef attribute = nullptr; 529 bool value = false; 530 if (argumentCount == 2) { 531 attribute = JSValueToStringCopy(context, arguments[0], exception); 532 value = JSValueToBoolean(context, arguments[1]); 533 } 534 toAXElement(thisObject)->setBoolAttributeValue(attribute, value); 535 if (attribute) 536 JSStringRelease(attribute); 537 return JSValueMakeUndefined(context); 538 } 539 526 540 static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 527 541 { … … 702 716 703 717 return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForElement(uiElement)); 718 } 719 720 static JSValueRef selectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 721 { 722 return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->selectedTextMarkerRange()); 723 } 724 725 static JSValueRef resetSelectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 726 { 727 toAXElement(thisObject)->resetSelectedTextMarkerRange(); 728 return JSValueMakeUndefined(context); 704 729 } 705 730 … … 1367 1392 #endif 1368 1393 1394 #if !PLATFORM(MAC) 1395 void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { } 1396 #endif 1397 1369 1398 #if !SUPPORTS_AX_TEXTMARKERS 1370 1399 … … 1377 1406 { 1378 1407 return 0; 1408 } 1409 1410 AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange() 1411 { 1412 return nullptr; 1413 } 1414 1415 void AccessibilityUIElement::resetSelectedTextMarkerRange() 1416 { 1379 1417 } 1380 1418 … … 1601 1639 { "numberAttributeValue", numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1602 1640 { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1641 { "setBoolAttributeValue", setBoolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1603 1642 { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1604 1643 { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, … … 1627 1666 { "lineTextMarkerRangeForTextMarker", lineTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1628 1667 { "textMarkerRangeForElement", textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1668 { "selectedTextMarkerRange", selectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1669 { "resetSelectedTextMarkerRange", resetSelectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1629 1670 { "attributedStringForTextMarkerRangeContainsAttribute", attributedStringForTextMarkerRangeContainsAttributeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1630 1671 { "indexForTextMarker", indexForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, … … 1660 1701 { "decreaseTextSelection", decreaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1661 1702 { "assistiveTechnologySimulatedFocus", assistiveTechnologySimulatedFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1662 1663 1703 #endif 1664 1704 { 0, 0, 0 } -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.h
r176318 r180718 110 110 AccessibilityUIElement uiElementAttributeValue(JSStringRef attribute) const; 111 111 bool boolAttributeValue(JSStringRef attribute); 112 void setBoolAttributeValue(JSStringRef attribute, bool value); 112 113 bool isAttributeSupported(JSStringRef attribute); 113 114 bool isAttributeSettable(JSStringRef attribute); … … 252 253 AccessibilityTextMarker startTextMarker(); 253 254 AccessibilityTextMarker endTextMarker(); 255 AccessibilityTextMarkerRange selectedTextMarkerRange(); 256 void resetSelectedTextMarkerRange(); 254 257 255 258 JSStringRef stringForTextMarkerRange(AccessibilityTextMarkerRange*); -
trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
r179820 r180718 66 66 #endif 67 67 68 #ifndef NSAccessibilitySelectedTextMarkerRangeAttribute 69 #define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange" 70 #endif 71 68 72 typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context); 69 73 … … 72 76 - (NSUInteger)accessibilityIndexOfChild:(id)child; 73 77 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute; 78 - (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName; 74 79 @end 75 80 … … 579 584 } 580 585 586 void AccessibilityUIElement::setBoolAttributeValue(JSStringRef attribute, bool value) 587 { 588 BEGIN_AX_OBJC_EXCEPTIONS 589 [m_element _accessibilitySetTestValue:@(value) forAttribute:[NSString stringWithJSStringRef:attribute]]; 590 END_AX_OBJC_EXCEPTIONS 591 } 592 581 593 bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) 582 594 { … … 1561 1573 } 1562 1574 1575 AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange() 1576 { 1577 BEGIN_AX_OBJC_EXCEPTIONS 1578 id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute]; 1579 return AccessibilityTextMarkerRange(textMarkerRange); 1580 END_AX_OBJC_EXCEPTIONS 1581 1582 return nullptr; 1583 } 1584 1585 void AccessibilityUIElement::resetSelectedTextMarkerRange() 1586 { 1587 id start = [m_element accessibilityAttributeValue:@"AXStartTextMarker"]; 1588 if (!start) 1589 return; 1590 1591 NSArray* textMarkers = @[start, start]; 1592 id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers]; 1593 if (!textMarkerRange) 1594 return; 1595 1596 BEGIN_AX_OBJC_EXCEPTIONS 1597 [m_element _accessibilitySetTestValue:textMarkerRange forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute]; 1598 END_AX_OBJC_EXCEPTIONS 1599 } 1600 1563 1601 int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange* range) 1564 1602 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
r169483 r180718 212 212 #endif 213 213 214 #if !PLATFORM(MAC) || !HAVE(ACCESSIBILITY) 215 PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange() { return nullptr; } 216 void AccessibilityUIElement::resetSelectedTextMarkerRange() { } 217 void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { } 218 #endif 219 214 220 } // namespace WTR 215 221 -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
r169483 r180718 106 106 PassRefPtr<AccessibilityUIElement> uiElementAttributeValue(JSStringRef attribute) const; 107 107 bool boolAttributeValue(JSStringRef attribute); 108 void setBoolAttributeValue(JSStringRef attribute, bool value); 108 109 bool isAttributeSupported(JSStringRef attribute); 109 110 bool isAttributeSettable(JSStringRef attribute); … … 230 231 PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForElement(AccessibilityUIElement*); 231 232 PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker); 233 PassRefPtr<AccessibilityTextMarkerRange> selectedTextMarkerRange(); 234 void resetSelectedTextMarkerRange(); 232 235 PassRefPtr<AccessibilityTextMarker> startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*); 233 236 PassRefPtr<AccessibilityTextMarker> endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*); -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
r179820 r180718 63 63 AccessibilityUIElement uiElementAttributeValue(DOMString attr); 64 64 boolean boolAttributeValue(DOMString attr); 65 void setBoolAttributeValue(DOMString attr, boolean value); 65 66 boolean isAttributeSupported(DOMString attr); 66 67 boolean isAttributeSettable(DOMString attr); … … 175 176 AccessibilityTextMarkerRange textMarkerRangeForElement(AccessibilityUIElement element); 176 177 AccessibilityTextMarkerRange textMarkerRangeForMarkers(AccessibilityTextMarker startMarker, AccessibilityTextMarker endMarker); 178 AccessibilityTextMarkerRange selectedTextMarkerRange(); 179 void resetSelectedTextMarkerRange(); 177 180 AccessibilityTextMarker startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range); 178 181 AccessibilityTextMarker endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range); … … 202 205 boolean addNotificationListener(object callbackFunction); 203 206 boolean removeNotificationListener(); 204 205 207 }; 206 208 -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
r179820 r180718 70 70 #endif 71 71 72 #ifndef NSAccessibilitySelectedTextMarkerRangeAttribute 73 #define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange" 74 #endif 75 72 76 typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context); 73 77 … … 76 80 - (NSUInteger)accessibilityIndexOfChild:(id)child; 77 81 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute; 82 - (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName; 78 83 @end 79 84 … … 624 629 } 625 630 631 void AccessibilityUIElement::setBoolAttributeValue(JSStringRef attribute, bool value) 632 { 633 BEGIN_AX_OBJC_EXCEPTIONS 634 [m_element _accessibilitySetTestValue:@(value) forAttribute:[NSString stringWithJSStringRef:attribute]]; 635 END_AX_OBJC_EXCEPTIONS 636 } 637 626 638 bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) 627 639 { … … 1623 1635 1624 1636 return nullptr; 1637 } 1638 1639 PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange() 1640 { 1641 BEGIN_AX_OBJC_EXCEPTIONS 1642 id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute]; 1643 return AccessibilityTextMarkerRange::create(textMarkerRange); 1644 END_AX_OBJC_EXCEPTIONS 1645 1646 return nullptr; 1647 } 1648 1649 void AccessibilityUIElement::resetSelectedTextMarkerRange() 1650 { 1651 id start = [m_element accessibilityAttributeValue:@"AXStartTextMarker"]; 1652 if (!start) 1653 return; 1654 1655 NSArray* textMarkers = @[start, start]; 1656 id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers]; 1657 if (!textMarkerRange) 1658 return; 1659 1660 BEGIN_AX_OBJC_EXCEPTIONS 1661 [m_element _accessibilitySetTestValue:textMarkerRange forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute]; 1662 END_AX_OBJC_EXCEPTIONS 1625 1663 } 1626 1664
Note: See TracChangeset
for help on using the changeset viewer.