⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 201568 in webkit


Ignore:
Timestamp:
Jun 1, 2016, 2:27:04 PM (10 years ago)
Author:
Chris Fleizach
Message:

AX: iOS: VoiceOver can't access attachments in mail messages
https://bugs.webkit.org/show_bug.cgi?id=158198

Reviewed by Joanmarie Diggs.

Source/WebCore:

Replaced elements, like attachemnts, were not being exposed in the attributed string returned to VoiceOver.
Make sure they are exposed with the attachment character, pointing to the actual element.

Test: accessibility/ios-simulator/attributed-string-for-range.html

  • accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:

(AccessibilityUnignoredAncestor):
(-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):

Tools:

  • DumpRenderTree/ios/AccessibilityUIElementIOS.mm:

(AccessibilityUIElement::stringForRange):
(AccessibilityUIElement::attributedStringForRange):
(AccessibilityUIElement::attributedStringRangeIsMisspelled):

  • WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:

(WTR::AccessibilityUIElement::attributedStringForRange):
(WTR::AccessibilityUIElement::attributedStringRangeIsMisspelled):

LayoutTests:

  • accessibility/ios-simulator/attributed-string-for-range.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201566 r201568  
     12016-06-01  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: iOS: VoiceOver can't access attachments in mail messages
     4        https://bugs.webkit.org/show_bug.cgi?id=158198
     5
     6        Reviewed by Joanmarie Diggs.
     7
     8        * accessibility/ios-simulator/attributed-string-for-range.html: Added.
     9
    1102016-06-01  Commit Queue  <commit-queue@webkit.org>
    211
  • trunk/Source/WebCore/ChangeLog

    r201567 r201568  
     12016-06-01  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: iOS: VoiceOver can't access attachments in mail messages
     4        https://bugs.webkit.org/show_bug.cgi?id=158198
     5
     6        Reviewed by Joanmarie Diggs.
     7
     8        Replaced elements, like attachemnts, were not being exposed in the attributed string returned to VoiceOver.
     9        Make sure they are exposed with the attachment character, pointing to the actual element.
     10
     11        Test: accessibility/ios-simulator/attributed-string-for-range.html
     12
     13        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     14        (AccessibilityUnignoredAncestor):
     15        (-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):
     16
    1172016-06-01  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r200415 r201568  
    6262#import <CoreText/CoreText.h>
    6363
     64enum {
     65    NSAttachmentCharacter = 0xfffc    /* To denote attachments. */
     66};
     67
    6468@interface NSObject (AccessibilityPrivate)
    6569- (void)_accessibilityUnregister;
     
    107111static NSString * const UIAccessibilityTokenUnderline = @"UIAccessibilityTokenUnderline";
    108112static NSString * const UIAccessibilityTokenLanguage = @"UIAccessibilityTokenLanguage";
     113static NSString * const UIAccessibilityTokenAttachment = @"UIAccessibilityTokenAttachment";
    109114
    110115static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityObjectWrapper *wrapper)
     
    22862291    id returnValue = [[(NSString *)[returnClass alloc] init] autorelease];
    22872292   
     2293    const unichar attachmentChar = NSAttachmentCharacter;
    22882294    NSInteger count = [array count];
    22892295    for (NSInteger k = 0; k < count; ++k) {
    22902296        id object = [array objectAtIndex:k];
    22912297
     2298        if (attributed && [object isKindOfClass:[WebAccessibilityObjectWrapper class]])
     2299            object = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithCharacters:&attachmentChar length:1] attributes:@{ UIAccessibilityTokenAttachment : object }] autorelease];
     2300       
    22922301        if (![object isKindOfClass:returnClass])
    22932302            continue;
     
    28562865}
    28572866
     2867- (NSString *)description
     2868{
    28582869#ifndef NDEBUG
    2859 - (NSString *)description
    2860 {
    28612870    CGRect frame = [self accessibilityFrame];
    28622871    return [NSString stringWithFormat:@"Role: (%d) - Text: %@: Value: %@ -- Frame: %f %f %f %f", m_object ? m_object->roleValue() : 0, [self accessibilityLabel], [self accessibilityValue], frame.origin.x, frame.origin.y, frame.size.width, frame.size.height];
    2863 }
     2872#else
     2873    return [NSString stringWithFormat:@"%@: %@", [self class], [self accessibilityLabel]];
    28642874#endif
     2875}
    28652876
    28662877@end
  • trunk/Tools/ChangeLog

    r201550 r201568  
     12016-06-01  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: iOS: VoiceOver can't access attachments in mail messages
     4        https://bugs.webkit.org/show_bug.cgi?id=158198
     5
     6        Reviewed by Joanmarie Diggs.
     7
     8        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
     9        (AccessibilityUIElement::stringForRange):
     10        (AccessibilityUIElement::attributedStringForRange):
     11        (AccessibilityUIElement::attributedStringRangeIsMisspelled):
     12        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
     13        (WTR::AccessibilityUIElement::attributedStringForRange):
     14        (WTR::AccessibilityUIElement::attributedStringRangeIsMisspelled):
     15
    1162016-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
    217
  • trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm

    r196699 r201568  
    7474- (NSString *)accessibilityPlaceholderValue;
    7575- (NSString *)stringForRange:(NSRange)range;
     76- (NSAttributedString *)attributedStringForRange:(NSRange)range;
    7677- (NSArray *)elementsForRange:(NSRange)range;
    7778- (NSString *)selectionRangeString;
     
    366367}
    367368
    368 JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
    369 {
    370     return JSStringCreateWithCharacters(0, 0);
     369JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
     370{
     371    NSRange range = NSMakeRange(location, length);
     372    NSAttributedString* string = [m_element attributedStringForRange:range];
     373    if (![string isKindOfClass:[NSAttributedString class]])
     374        return 0;
     375   
     376    NSString* stringWithAttrs = [string description];
     377    return [stringWithAttrs createJSStringRef];
    371378}
    372379
  • trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

    r196699 r201568  
    5151- (NSString *)accessibilityPlaceholderValue;
    5252- (NSString *)stringForRange:(NSRange)range;
     53- (NSAttributedString *)attributedStringForRange:(NSRange)range;
    5354- (NSArray *)elementsForRange:(NSRange)range;
    5455- (NSString *)selectionRangeString;
     
    624625JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
    625626{
    626     return JSStringCreateWithCharacters(0, 0);
     627    NSAttributedString *stringForRange = [m_element attributedStringForRange:NSMakeRange(location, length)];
     628    if (!stringForRange)
     629        return nullptr;
     630   
     631    return [[stringForRange description] createJSStringRef];
    627632}
    628633
Note: See TracChangeset for help on using the changeset viewer.