Changeset 180718 in webkit


Ignore:
Timestamp:
Feb 26, 2015 5:57:48 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

AX: Expose caret browsing preference to accessibility API
https://bugs.webkit.org/show_bug.cgi?id=141862

Patch by Doug Russell <d_russell@apple.com> on 2015-02-26
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.

Source/WebCore:

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:]):

Tools:

  • 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):

LayoutTests:

  • 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):

Location:
trunk
Files:
7 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r180715 r180718  
     12015-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
    1252015-02-26  Joseph Pecoraro  <pecoraro@apple.com>
    226
  • trunk/LayoutTests/accessibility/parent-delete-expected.txt

    r171360 r180718  
    2828AXLoadingProgress: 1
    2929AXURL: LayoutTests/accessibility/parent-delete.html
     30AXCaretBrowsingEnabled: 0
    3031AXElementBusy: 0
    3132
  • trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt

    r171360 r180718  
    2727AXLoadingProgress: 1
    2828AXURL: LayoutTests/platform/mac/accessibility/document-attributes.html
     29AXCaretBrowsingEnabled: 0
    2930AXElementBusy: 0
    3031
  • trunk/Source/WebCore/ChangeLog

    r180717 r180718  
     12015-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
    1262015-02-26  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    227
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r180621 r180718  
    979979    void updateBackingStore();
    980980   
     981#if PLATFORM(COCOA) && !PLATFORM(IOS)
     982    bool caretBrowsingEnabled() const;
     983    void setCaretBrowsingEnabled(bool);
     984#endif
     985   
    981986protected:
    982987    AXID m_id;
  • trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm

    r179228 r180718  
    2929#import "HTMLFieldSetElement.h"
    3030#import "RenderObject.h"
     31#import "Settings.h"
    3132
    3233#if HAVE(ACCESSIBILITY)
     
    107108}
    108109   
     110bool AccessibilityObject::caretBrowsingEnabled() const
     111{
     112    Frame* frame = this->frame();
     113    return frame && frame->settings().caretBrowsingEnabled();
     114}
     115
     116void AccessibilityObject::setCaretBrowsingEnabled(bool on)
     117{
     118    Frame* frame = this->frame();
     119    if (!frame)
     120        return;
     121    frame->settings().setCaretBrowsingEnabled(on);
     122}
     123
    109124} // WebCore
    110125
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r180621 r180718  
    464464#define NSAccessibilityMathPrescriptsAttribute @"AXMathPrescripts"
    465465#define NSAccessibilityMathPostscriptsAttribute @"AXMathPostscripts"
     466
     467#ifndef NSAccessibilityCaretBrowsingEnabledAttribute
     468#define NSAccessibilityCaretBrowsingEnabledAttribute @"AXCaretBrowsingEnabled"
     469#endif
    466470
    467471@implementation WebAccessibilityObjectWrapper
     
    13551359        [tempArray addObject:NSAccessibilityLoadingProgressAttribute];
    13561360        [tempArray addObject:NSAccessibilityURLAttribute];
     1361        [tempArray addObject:NSAccessibilityCaretBrowsingEnabledAttribute];
    13571362        webAreaAttrs = [[NSArray alloc] initWithArray:tempArray];
    13581363        [tempArray release];
     
    29542959        return m_object->getAttribute(idAttr);
    29552960   
     2961    if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
     2962        return [NSNumber numberWithBool:m_object->caretBrowsingEnabled()];
     2963   
    29562964    return nil;
    29572965}
     
    30243032   
    30253033    if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
     3034        return YES;
     3035   
     3036    if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
    30263037        return YES;
    30273038   
     
    33423353    } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
    33433354        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];
    33443364}
    33453365
  • trunk/Tools/ChangeLog

    r180705 r180718  
     12015-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
    1352015-02-26  Brent Fulgham  <bfulgham@apple.com>
    236
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp

    r176343 r180718  
    524524}
    525525
     526static 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
    526540static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    527541{
     
    702716   
    703717    return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForElement(uiElement));
     718}
     719
     720static 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
     725static 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);
    704729}
    705730
     
    13671392#endif
    13681393
     1394#if !PLATFORM(MAC)
     1395void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
     1396#endif
     1397
    13691398#if !SUPPORTS_AX_TEXTMARKERS
    13701399
     
    13771406{
    13781407    return 0;
     1408}
     1409
     1410AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange()
     1411{
     1412    return nullptr;
     1413}
     1414
     1415void AccessibilityUIElement::resetSelectedTextMarkerRange()
     1416{
    13791417}
    13801418
     
    16011639        { "numberAttributeValue", numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16021640        { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1641        { "setBoolAttributeValue", setBoolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16031642        { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16041643        { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    16271666        { "lineTextMarkerRangeForTextMarker", lineTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16281667        { "textMarkerRangeForElement", textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1668        { "selectedTextMarkerRange", selectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1669        { "resetSelectedTextMarkerRange", resetSelectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16291670        { "attributedStringForTextMarkerRangeContainsAttribute", attributedStringForTextMarkerRangeContainsAttributeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16301671        { "indexForTextMarker", indexForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    16601701        { "decreaseTextSelection", decreaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16611702        { "assistiveTechnologySimulatedFocus", assistiveTechnologySimulatedFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1662        
    16631703#endif
    16641704        { 0, 0, 0 }
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.h

    r176318 r180718  
    110110    AccessibilityUIElement uiElementAttributeValue(JSStringRef attribute) const;   
    111111    bool boolAttributeValue(JSStringRef attribute);
     112    void setBoolAttributeValue(JSStringRef attribute, bool value);
    112113    bool isAttributeSupported(JSStringRef attribute);
    113114    bool isAttributeSettable(JSStringRef attribute);
     
    252253    AccessibilityTextMarker startTextMarker();
    253254    AccessibilityTextMarker endTextMarker();
     255    AccessibilityTextMarkerRange selectedTextMarkerRange();
     256    void resetSelectedTextMarkerRange();
    254257   
    255258    JSStringRef stringForTextMarkerRange(AccessibilityTextMarkerRange*);
  • trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r179820 r180718  
    6666#endif
    6767
     68#ifndef NSAccessibilitySelectedTextMarkerRangeAttribute
     69#define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange"
     70#endif
     71
    6872typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
    6973
     
    7276- (NSUInteger)accessibilityIndexOfChild:(id)child;
    7377- (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
     78- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName;
    7479@end
    7580
     
    579584}
    580585
     586void 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
    581593bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
    582594{
     
    15611573}
    15621574
     1575AccessibilityTextMarkerRange 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
     1585void 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
    15631601int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange* range)
    15641602{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp

    r169483 r180718  
    212212#endif
    213213
     214#if !PLATFORM(MAC) || !HAVE(ACCESSIBILITY)
     215PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange() { return nullptr; }
     216void AccessibilityUIElement::resetSelectedTextMarkerRange() { }
     217void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
     218#endif
     219
    214220} // namespace WTR
    215221
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

    r169483 r180718  
    106106    PassRefPtr<AccessibilityUIElement> uiElementAttributeValue(JSStringRef attribute) const;
    107107    bool boolAttributeValue(JSStringRef attribute);
     108    void setBoolAttributeValue(JSStringRef attribute, bool value);
    108109    bool isAttributeSupported(JSStringRef attribute);
    109110    bool isAttributeSettable(JSStringRef attribute);
     
    230231    PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForElement(AccessibilityUIElement*);   
    231232    PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker);
     233    PassRefPtr<AccessibilityTextMarkerRange> selectedTextMarkerRange();
     234    void resetSelectedTextMarkerRange();
    232235    PassRefPtr<AccessibilityTextMarker> startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
    233236    PassRefPtr<AccessibilityTextMarker> endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl

    r179820 r180718  
    6363    AccessibilityUIElement uiElementAttributeValue(DOMString attr); 
    6464    boolean boolAttributeValue(DOMString attr);
     65    void setBoolAttributeValue(DOMString attr, boolean value);
    6566    boolean isAttributeSupported(DOMString attr);
    6667    boolean isAttributeSettable(DOMString attr);
     
    175176    AccessibilityTextMarkerRange textMarkerRangeForElement(AccessibilityUIElement element);   
    176177    AccessibilityTextMarkerRange textMarkerRangeForMarkers(AccessibilityTextMarker startMarker, AccessibilityTextMarker endMarker);
     178    AccessibilityTextMarkerRange selectedTextMarkerRange();
     179    void resetSelectedTextMarkerRange();
    177180    AccessibilityTextMarker startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
    178181    AccessibilityTextMarker endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
     
    202205    boolean addNotificationListener(object callbackFunction);
    203206    boolean removeNotificationListener();
    204    
    205207};
    206208
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r179820 r180718  
    7070#endif
    7171
     72#ifndef NSAccessibilitySelectedTextMarkerRangeAttribute
     73#define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange"
     74#endif
     75
    7276typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
    7377
     
    7680- (NSUInteger)accessibilityIndexOfChild:(id)child;
    7781- (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
     82- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName;
    7883@end
    7984
     
    624629}
    625630
     631void 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
    626638bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
    627639{
     
    16231635   
    16241636    return nullptr;
     1637}
     1638   
     1639PassRefPtr<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
     1649void 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
    16251663}
    16261664
Note: See TracChangeset for help on using the changeset viewer.