AX: Support color well on iOS
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 15:10:36 +0000 (15:10 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 15:10:36 +0000 (15:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194010

Reviewed by Joanmarie Diggs.

Source/WebCore:

Test: accessibility/ios-simulator/color-well.html

Add support for color well on iOS.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
(-[WebAccessibilityObjectWrapper accessibilityRoleDescription]):
(-[WebAccessibilityObjectWrapper accessibilityColorStringValue]):
* en.lproj/Localizable.strings:
* platform/LocalizedStrings.cpp:
(WebCore::AXColorWellText):
* platform/LocalizedStrings.h:

Tools:

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::stringAttributeValue):

LayoutTests:

* accessibility/ios-simulator/color-well-expected.txt: Added.
* accessibility/ios-simulator/color-well.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240710 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/color-well-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/ios-simulator/color-well.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/en.lproj/Localizable.strings
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

index fe9d4ab..fe34740 100644 (file)
@@ -1,5 +1,15 @@
 2019-01-30  Chris Fleizach  <cfleizach@apple.com>
 
+        AX: Support color well on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=194010
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/ios-simulator/color-well-expected.txt: Added.
+        * accessibility/ios-simulator/color-well.html: Added.
+
+2019-01-30  Chris Fleizach  <cfleizach@apple.com>
+
         AX: Role=switch not returning correct accessibilityValue
         https://bugs.webkit.org/show_bug.cgi?id=194006
 
diff --git a/LayoutTests/accessibility/ios-simulator/color-well-expected.txt b/LayoutTests/accessibility/ios-simulator/color-well-expected.txt
new file mode 100644 (file)
index 0000000..602fa4b
--- /dev/null
@@ -0,0 +1,13 @@
+
+This test thats color input types are accessible on iOS.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.isIgnored is false
+PASS element.stringAttributeValue('AXRoleDescription') is 'color well'
+PASS element.stringAttributeValue('AXColorStringDescription') is 'rgb 0.90196 0.39216 0.39608 1'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/ios-simulator/color-well.html b/LayoutTests/accessibility/ios-simulator/color-well.html
new file mode 100644 (file)
index 0000000..35315f6
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+var successfullyParsed = false;
+if (window.testRunner)
+   testRunner.dumpAsText();
+</script>
+</head>
+<body>
+
+<input type="color" value="#e66465" id="color">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This test thats color input types are accessible on iOS.");
+
+    if (window.accessibilityController) {
+
+        var element = accessibilityController.accessibleElementById("color");
+        shouldBeFalse("element.isIgnored");
+        shouldBe("element.stringAttributeValue('AXRoleDescription')", "'color well'");
+        shouldBe("element.stringAttributeValue('AXColorStringDescription')", "'rgb 0.90196 0.39216 0.39608 1'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
+
index a59039b..46b35f9 100644 (file)
@@ -1,5 +1,26 @@
 2019-01-30  Chris Fleizach  <cfleizach@apple.com>
 
+        AX: Support color well on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=194010
+
+        Reviewed by Joanmarie Diggs.
+
+        Test: accessibility/ios-simulator/color-well.html
+
+        Add support for color well on iOS.
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
+        (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
+        (-[WebAccessibilityObjectWrapper accessibilityRoleDescription]):
+        (-[WebAccessibilityObjectWrapper accessibilityColorStringValue]):
+        * en.lproj/Localizable.strings:
+        * platform/LocalizedStrings.cpp:
+        (WebCore::AXColorWellText):
+        * platform/LocalizedStrings.h:
+
+2019-01-30  Chris Fleizach  <cfleizach@apple.com>
+
         AX: Role=switch not returning correct accessibilityValue
         https://bugs.webkit.org/show_bug.cgi?id=194006
 
index 79f344a..69ed007 100644 (file)
@@ -346,6 +346,7 @@ static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityO
     switch (role) {
     case AccessibilityRole::Button:
     case AccessibilityRole::CheckBox:
+    case AccessibilityRole::ColorWell:
     case AccessibilityRole::ComboBox:
     case AccessibilityRole::DisclosureTriangle:
     case AccessibilityRole::Heading:
@@ -856,6 +857,7 @@ static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityO
     case AccessibilityRole::ToggleButton:
     case AccessibilityRole::PopUpButton:
     case AccessibilityRole::CheckBox:
+    case AccessibilityRole::ColorWell:
     case AccessibilityRole::RadioButton:
     case AccessibilityRole::Slider:
     case AccessibilityRole::MenuButton:
@@ -930,7 +932,6 @@ static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityO
     case AccessibilityRole::Canvas:
     case AccessibilityRole::Caption:
     case AccessibilityRole::Cell:
-    case AccessibilityRole::ColorWell:
     case AccessibilityRole::Column:
     case AccessibilityRole::ColumnHeader:
     case AccessibilityRole::Definition:
@@ -1115,6 +1116,12 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
 
 - (NSString *)accessibilityRoleDescription
 {
+    if (![self _prepareAccessibilityCall])
+        return nil;
+
+    if (m_object->isColorWell())
+        return AXColorWellText();
+
     return m_object->roleDescription();
 }
 
@@ -1393,6 +1400,20 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
     return m_object->placeholderValue();
 }
 
+- (NSString *)accessibilityColorStringValue
+{
+    if (![self _prepareAccessibilityCall])
+        return nil;
+
+    if (m_object->isColorWell()) {
+        int r, g, b;
+        m_object->colorValue(r, g, b);
+        return [NSString stringWithFormat:@"rgb %7.5f %7.5f %7.5f 1", r / 255., g / 255., b / 255.];
+    }
+
+    return nil;
+}
+
 - (NSString *)accessibilityValue
 {
     if (![self _prepareAccessibilityCall])
index de7788b..b5cc28b 100644 (file)
 /* HTTP result code string */
 "client error" = "client error";
 
+/* accessibility role description for a color well */
+"color well" = "color well";
+
 /* An ARIA accessibility group that acts as a region of complementary information. */
 "complementary" = "complementary";
 
index 301aa39..1bf4cd7 100644 (file)
@@ -466,6 +466,11 @@ String AXHeadingText()
     return WEB_UI_STRING("heading", "accessibility role description for headings");
 }
 
+String AXColorWellText()
+{
+    return WEB_UI_STRING("color well", "accessibility role description for a color well");
+}
+
 String AXDefinitionText()
 {
     return WEB_UI_STRING("definition", "role description of ARIA definition role");
index a8a0cba..d0a8ce7 100644 (file)
@@ -164,6 +164,7 @@ namespace WebCore {
     String AXListMarkerText();
     String AXImageMapText();
     String AXHeadingText();
+    String AXColorWellText();
     String AXDefinitionText();
     String AXDescriptionListText();
     String AXDescriptionListTermText();
index 0c44ba6..4254270 100644 (file)
@@ -1,3 +1,13 @@
+2019-01-30  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Support color well on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=194010
+
+        Reviewed by Joanmarie Diggs.
+
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::stringAttributeValue):
+
 2019-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [WPE] Bump font related dependencies to match the GTK+ port
index 5913b5d..d839112 100644 (file)
@@ -82,6 +82,8 @@ typedef void (*AXPostedNotificationCallback)(id element, NSString* notification,
 - (BOOL)_accessibilityIsStrongPasswordField;
 - (CGRect)accessibilityVisibleContentRect;
 - (NSString *)accessibilityTextualContext;
+- (NSString *)accessibilityRoleDescription;
+- (NSString *)accessibilityColorStringValue;
 
 // TextMarker related
 - (NSArray *)textMarkerRange;
@@ -357,7 +359,13 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRe
 {
     if (JSStringIsEqualToUTF8CString(attribute, "AXPlaceholderValue"))
         return [[m_element accessibilityPlaceholderValue] createJSStringRef];
-    
+
+    if (JSStringIsEqualToUTF8CString(attribute, "AXRoleDescription"))
+        return [[m_element accessibilityRoleDescription] createJSStringRef];
+
+    if (JSStringIsEqualToUTF8CString(attribute, "AXColorStringDescription"))
+        return [[m_element accessibilityColorStringValue] createJSStringRef];
+
     if (JSStringIsEqualToUTF8CString(attribute, "AXARIACurrent"))
         return [[m_element accessibilityARIACurrentStatus] createJSStringRef];