- Revision
- 201568
- Author
- [email protected]
- Date
- 2016-06-01 14:27:04 -0700 (Wed, 01 Jun 2016)
Log 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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (201567 => 201568)
--- trunk/LayoutTests/ChangeLog 2016-06-01 20:55:30 UTC (rev 201567)
+++ trunk/LayoutTests/ChangeLog 2016-06-01 21:27:04 UTC (rev 201568)
@@ -1,3 +1,12 @@
+2016-06-01 Chris Fleizach <[email protected]>
+
+ AX: iOS: VoiceOver can't access attachments in mail messages
+ https://bugs.webkit.org/show_bug.cgi?id=158198
+
+ Reviewed by Joanmarie Diggs.
+
+ * accessibility/ios-simulator/attributed-string-for-range.html: Added.
+
2016-06-01 Commit Queue <[email protected]>
Unreviewed, rolling out r201488.
Added: trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range-expected.txt (0 => 201568)
--- trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range-expected.txt 2016-06-01 21:27:04 UTC (rev 201568)
@@ -0,0 +1,27 @@
+hello world
+This test ensures that attributed string for range works
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Attributed string: hello {
+ UIAccessibilityTokenFontFamily = "Times New Roman";
+ UIAccessibilityTokenFontName = "Times New Roman";
+ UIAccessibilityTokenFontSize = 16;
+}{
+ UIAccessibilityTokenAttachment = "WebAccessibilityObjectWrapper: cake";
+} {
+ UIAccessibilityTokenFontFamily = "Times New Roman";
+ UIAccessibilityTokenFontName = "Times New Roman";
+ UIAccessibilityTokenFontSize = 16;
+}{
+ UIAccessibilityTokenAttachment = "WebAccessibilityObjectWrapper: title, subtitle, action";
+} {
+ UIAccessibilityTokenFontFamily = "Times New Roman";
+ UIAccessibilityTokenFontName = "Times New Roman";
+ UIAccessibilityTokenFontSize = 16;
+}
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range.html (0 => 201568)
--- trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range.html (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range.html 2016-06-01 21:27:04 UTC (rev 201568)
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script>
+var successfullyParsed = false;
+</script>
+<script>
+ if (window.internals)
+ window.internals.settings.setAttachmentElementEnabled(true)
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<div id="content">
+hello
+
+<img src="" alt="cake">
+<attachment id="attachment" title="title" subtitle="subtitle" action="" progress="0.5"></attachment>
+
+world
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This test ensures that attributed string for range works");
+
+ if (window.accessibilityController) {
+
+ var obj = accessibilityController.accessibleElementById("content");
+ var text = obj.attributedStringForRange(0, 10);
+ debug("Attributed string: " + text);
+ }
+
+ successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (201567 => 201568)
--- trunk/Source/WebCore/ChangeLog 2016-06-01 20:55:30 UTC (rev 201567)
+++ trunk/Source/WebCore/ChangeLog 2016-06-01 21:27:04 UTC (rev 201568)
@@ -1,3 +1,19 @@
+2016-06-01 Chris Fleizach <[email protected]>
+
+ AX: iOS: VoiceOver can't access attachments in mail messages
+ https://bugs.webkit.org/show_bug.cgi?id=158198
+
+ Reviewed by Joanmarie Diggs.
+
+ 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:]):
+
2016-06-01 Jer Noble <[email protected]>
setVideoFullscreenGravity() has no effect on the fullscreen video layer
Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (201567 => 201568)
--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2016-06-01 20:55:30 UTC (rev 201567)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2016-06-01 21:27:04 UTC (rev 201568)
@@ -61,6 +61,10 @@
#import <CoreText/CoreText.h>
+enum {
+ NSAttachmentCharacter = 0xfffc /* To denote attachments. */
+};
+
@interface NSObject (AccessibilityPrivate)
- (void)_accessibilityUnregister;
- (NSString *)accessibilityLabel;
@@ -106,6 +110,7 @@
static NSString * const UIAccessibilityTokenItalic = @"UIAccessibilityTokenItalic";
static NSString * const UIAccessibilityTokenUnderline = @"UIAccessibilityTokenUnderline";
static NSString * const UIAccessibilityTokenLanguage = @"UIAccessibilityTokenLanguage";
+static NSString * const UIAccessibilityTokenAttachment = @"UIAccessibilityTokenAttachment";
static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityObjectWrapper *wrapper)
{
@@ -2285,10 +2290,14 @@
Class returnClass = attributed ? [NSMutableAttributedString class] : [NSMutableString class];
id returnValue = [[(NSString *)[returnClass alloc] init] autorelease];
+ const unichar attachmentChar = NSAttachmentCharacter;
NSInteger count = [array count];
for (NSInteger k = 0; k < count; ++k) {
id object = [array objectAtIndex:k];
+ if (attributed && [object isKindOfClass:[WebAccessibilityObjectWrapper class]])
+ object = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithCharacters:&attachmentChar length:1] attributes:@{ UIAccessibilityTokenAttachment : object }] autorelease];
+
if (![object isKindOfClass:returnClass])
continue;
@@ -2855,13 +2864,15 @@
return m_object->clickPoint();
}
-#ifndef NDEBUG
- (NSString *)description
{
+#ifndef NDEBUG
CGRect frame = [self accessibilityFrame];
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];
+#else
+ return [NSString stringWithFormat:@"%@: %@", [self class], [self accessibilityLabel]];
+#endif
}
-#endif
@end
Modified: trunk/Tools/ChangeLog (201567 => 201568)
--- trunk/Tools/ChangeLog 2016-06-01 20:55:30 UTC (rev 201567)
+++ trunk/Tools/ChangeLog 2016-06-01 21:27:04 UTC (rev 201568)
@@ -1,3 +1,18 @@
+2016-06-01 Chris Fleizach <[email protected]>
+
+ AX: iOS: VoiceOver can't access attachments in mail messages
+ https://bugs.webkit.org/show_bug.cgi?id=158198
+
+ Reviewed by Joanmarie Diggs.
+
+ * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+ (AccessibilityUIElement::stringForRange):
+ (AccessibilityUIElement::attributedStringForRange):
+ (AccessibilityUIElement::attributedStringRangeIsMisspelled):
+ * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+ (WTR::AccessibilityUIElement::attributedStringForRange):
+ (WTR::AccessibilityUIElement::attributedStringRangeIsMisspelled):
+
2016-06-01 Carlos Garcia Campos <[email protected]>
Unreviewed. Mark GTK+ test /webkit2/WebKitWebInspectorServer/test-open-debugging-session as slow.
Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm (201567 => 201568)
--- trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm 2016-06-01 20:55:30 UTC (rev 201567)
+++ trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm 2016-06-01 21:27:04 UTC (rev 201568)
@@ -73,6 +73,7 @@
- (NSArray *)accessibilityHeaderElements;
- (NSString *)accessibilityPlaceholderValue;
- (NSString *)stringForRange:(NSRange)range;
+- (NSAttributedString *)attributedStringForRange:(NSRange)range;
- (NSArray *)elementsForRange:(NSRange)range;
- (NSString *)selectionRangeString;
- (CGPoint)accessibilityClickPoint;
@@ -365,9 +366,15 @@
return [stringForRange createJSStringRef];
}
-JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
+JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
{
- return JSStringCreateWithCharacters(0, 0);
+ NSRange range = NSMakeRange(location, length);
+ NSAttributedString* string = [m_element attributedStringForRange:range];
+ if (![string isKindOfClass:[NSAttributedString class]])
+ return 0;
+
+ NSString* stringWithAttrs = [string description];
+ return [stringWithAttrs createJSStringRef];
}
bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (201567 => 201568)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2016-06-01 20:55:30 UTC (rev 201567)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2016-06-01 21:27:04 UTC (rev 201568)
@@ -50,6 +50,7 @@
- (NSArray *)accessibilityHeaderElements;
- (NSString *)accessibilityPlaceholderValue;
- (NSString *)stringForRange:(NSRange)range;
+- (NSAttributedString *)attributedStringForRange:(NSRange)range;
- (NSArray *)elementsForRange:(NSRange)range;
- (NSString *)selectionRangeString;
- (CGPoint)accessibilityClickPoint;
@@ -623,7 +624,11 @@
JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
{
- return JSStringCreateWithCharacters(0, 0);
+ NSAttributedString *stringForRange = [m_element attributedStringForRange:NSMakeRange(location, length)];
+ if (!stringForRange)
+ return nullptr;
+
+ return [[stringForRange description] createJSStringRef];
}
bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length)