Diff
Modified: trunk/LayoutTests/ChangeLog (198332 => 198333)
--- trunk/LayoutTests/ChangeLog 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/LayoutTests/ChangeLog 2016-03-17 16:38:56 UTC (rev 198333)
@@ -1,3 +1,13 @@
+2016-03-16 Chris Fleizach <[email protected]>
+
+ AX: Implement AutoFill Available attribute for a text field
+ https://bugs.webkit.org/show_bug.cgi?id=155567
+
+ Reviewed by Darin Adler.
+
+ * accessibility/auto-fill-types-expected.txt: Added.
+ * accessibility/auto-fill-types.html: Added.
+
2016-03-17 Mark Lam <[email protected]>
Method names should not appear in the lexical scope of the method's body.
Added: trunk/LayoutTests/accessibility/auto-fill-types-expected.txt (0 => 198333)
--- trunk/LayoutTests/accessibility/auto-fill-types-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/auto-fill-types-expected.txt 2016-03-17 16:38:56 UTC (rev 198333)
@@ -0,0 +1,16 @@
+
+This tests that the auto-filled buttons show up.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Initial auto-fill available: false
+Contact button role: AXRole: AXButton
+Contact button label: AXDescription: contact info auto fill
+Credentials button role: AXRole: AXButton
+Credentials button label: AXDescription: password auto fill
+Post auto-fill available: true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/auto-fill-types.html (0 => 198333)
--- trunk/LayoutTests/accessibility/auto-fill-types.html (rev 0)
+++ trunk/LayoutTests/accessibility/auto-fill-types.html 2016-03-17 16:38:56 UTC (rev 198333)
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body id="body">
+
+<input type="text" value="hello" id="textfield">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that the auto-filled buttons show up.");
+
+ if (window.accessibilityController) {
+ var textField = document.getElementById("textfield");
+ var axTextField = accessibilityController.accessibleElementById("textfield");
+ debug("Initial auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
+
+ window.internals.setShowAutoFillButton(document.getElementById("textfield"), "AutoFillButtonTypeContacts");
+ var contactsButton = axTextField.childAtIndex(1);
+ debug("Contact button role: " + contactsButton.role);
+ debug("Contact button label: " + contactsButton.description);
+
+ window.internals.setShowAutoFillButton(document.getElementById("textfield"), "AutoFillButtonTypeCredentials");
+ var credentialsButton = axTextField.childAtIndex(1);
+ debug("Credentials button role: " + credentialsButton.role);
+ debug("Credentials button label: " + credentialsButton.description);
+
+ debug("Post auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (198332 => 198333)
--- trunk/Source/WebCore/ChangeLog 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/ChangeLog 2016-03-17 16:38:56 UTC (rev 198333)
@@ -1,3 +1,39 @@
+2016-03-16 Chris Fleizach <[email protected]>
+
+ AX: Implement AutoFill Available attribute for a text field
+ https://bugs.webkit.org/show_bug.cgi?id=155567
+
+ Reviewed by Darin Adler.
+
+ Expose the auto fill buttons to the AX hierarchy.
+ Add an attribute for the textfield to inform when the auto fill button is available.
+
+ Test: accessibility/auto-fill-types.html
+
+ * English.lproj/Localizable.strings:
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::element):
+ (WebCore::AccessibilityObject::isValueAutofillAvailable):
+ (WebCore::AccessibilityObject::isValueAutofilled):
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilityObject::passwordFieldValue):
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::addTextFieldChildren):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+ * html/TextFieldInputType.cpp:
+ (WebCore::limitLength):
+ (WebCore::autoFillButtonTypeToAccessibilityLabel):
+ (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
+ (WebCore::TextFieldInputType::createAutoFillButton):
+ (WebCore::TextFieldInputType::updateAutoFillButton):
+ * platform/LocalizedStrings.cpp:
+ (WebCore::AXListItemActionVerb):
+ (WebCore::AXAutoFillCredentialsLabel):
+ (WebCore::AXAutoFillContactsLabel):
+ (WebCore::AXARIAContentGroupText):
+ * platform/LocalizedStrings.h:
+
2016-03-17 Csaba Osztrogonác <[email protected]>
[Mac][cmake] Unreviewed speculative buildfix after r198179. Just for fun.
Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (198332 => 198333)
--- trunk/Source/WebCore/English.lproj/Localizable.strings 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings 2016-03-17 16:38:56 UTC (rev 198333)
@@ -760,6 +760,9 @@
/* HTTP result code string */
"conflict" = "conflict";
+/* Label for the auto fill contacts button inside a text field. */
+"contact info auto fill" = "contact info auto fill";
+
/* An ARIA accessibility group that contains content. */
"content information" = "content information";
@@ -934,6 +937,9 @@
/* HTTP result code string */
"partial content" = "partial content";
+/* Label for the auto fill credentials button inside a text field. */
+"password auto fill" = "password auto fill";
+
/* Validation message for input form controls requiring a constrained value according to pattern */
"pattern mismatch" = "pattern mismatch";
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (198332 => 198333)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2016-03-17 16:38:56 UTC (rev 198333)
@@ -2197,13 +2197,25 @@
return nullptr;
}
+bool AccessibilityObject::isValueAutofillAvailable() const
+{
+ if (!isNativeTextControl())
+ return false;
+
+ Node* node = this->node();
+ if (!is<HTMLInputElement>(node))
+ return false;
+
+ return downcast<HTMLInputElement>(*node).autoFillButtonType() != AutoFillButtonType::None;
+}
+
bool AccessibilityObject::isValueAutofilled() const
{
if (!isNativeTextControl())
return false;
Node* node = this->node();
- if (!node || !is<HTMLInputElement>(*node))
+ if (!is<HTMLInputElement>(node))
return false;
return downcast<HTMLInputElement>(*node).isAutoFilled();
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (198332 => 198333)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2016-03-17 16:38:56 UTC (rev 198333)
@@ -891,6 +891,7 @@
virtual String passwordFieldValue() const { return String(); }
bool isValueAutofilled() const;
+ bool isValueAutofillAvailable() const;
// Used by an ARIA tree to get all its rows.
void ariaTreeRows(AccessibilityChildrenVector&);
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (198332 => 198333)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2016-03-17 16:38:56 UTC (rev 198333)
@@ -156,6 +156,10 @@
#define NSAccessibilityValueAutofilledAttribute @"AXValueAutofilled"
#endif
+#ifndef NSAccessibilityValueAutofillAvailableAttribute
+#define NSAccessibilityValueAutofillAvailableAttribute @"AXValueAutofillAvailable"
+#endif
+
#ifndef NSAccessibilityLanguageAttribute
#define NSAccessibilityLanguageAttribute @"AXLanguage"
#endif
@@ -3196,6 +3200,9 @@
if ([attributeName isEqualToString:NSAccessibilityPlaceholderValueAttribute])
return m_object->placeholderValue();
+ if ([attributeName isEqualToString:NSAccessibilityValueAutofillAvailableAttribute])
+ return @(m_object->isValueAutofillAvailable());
+
if ([attributeName isEqualToString:NSAccessibilityValueAutofilledAttribute])
return @(m_object->isValueAutofilled());
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (198332 => 198333)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2016-03-17 16:38:56 UTC (rev 198333)
@@ -42,6 +42,7 @@
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "KeyboardEvent.h"
+#include "LocalizedStrings.h"
#include "NodeRenderStyle.h"
#include "Page.h"
#include "PlatformKeyboardEvent.h"
@@ -399,6 +400,20 @@
return string.left(newLength);
}
+static String autoFillButtonTypeToAccessibilityLabel(AutoFillButtonType autoFillButtonType)
+{
+ switch (autoFillButtonType) {
+ case AutoFillButtonType::Contacts:
+ return AXAutoFillContactsLabel();
+ case AutoFillButtonType::Credentials:
+ return AXAutoFillCredentialsLabel();
+ default:
+ case AutoFillButtonType::None:
+ ASSERT_NOT_REACHED();
+ return AtomicString();
+ }
+}
+
static AtomicString autoFillButtonTypeToAutoFillButtonPseudoClassName(AutoFillButtonType autoFillButtonType)
{
AtomicString pseudoClassName;
@@ -648,6 +663,8 @@
m_autoFillButton = AutoFillButtonElement::create(element().document(), *this);
m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType));
+ m_autoFillButton->setAttribute(roleAttr, "button");
+ m_autoFillButton->setAttribute(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(autoFillButtonType));
m_container->appendChild(*m_autoFillButton, IGNORE_EXCEPTION);
}
@@ -662,9 +679,10 @@
const AtomicString& attribute = m_autoFillButton->fastGetAttribute(pseudoAttr);
bool shouldUpdateAutoFillButtonType = isAutoFillButtonTypeChanged(attribute, element().autoFillButtonType());
- if (shouldUpdateAutoFillButtonType)
+ if (shouldUpdateAutoFillButtonType) {
m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType()));
-
+ m_autoFillButton->setAttribute(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(element().autoFillButtonType()));
+ }
m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock, true);
return;
}
Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (198332 => 198333)
--- trunk/Source/WebCore/platform/LocalizedStrings.cpp 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp 2016-03-17 16:38:56 UTC (rev 198333)
@@ -654,6 +654,16 @@
}
#endif // !PLATFORM(IOS)
+String AXAutoFillCredentialsLabel()
+{
+ return WEB_UI_STRING("password auto fill", "Label for the auto fill credentials button inside a text field.");
+}
+
+String AXAutoFillContactsLabel()
+{
+ return WEB_UI_STRING("contact info auto fill", "Label for the auto fill contacts button inside a text field.");
+}
+
#if PLATFORM(COCOA)
String AXARIAContentGroupText(const String& ariaType)
{
Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (198332 => 198333)
--- trunk/Source/WebCore/platform/LocalizedStrings.h 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h 2016-03-17 16:38:56 UTC (rev 198333)
@@ -183,6 +183,9 @@
String AXARIAContentGroupText(const String& ariaType);
String AXHorizontalRuleDescriptionText();
#endif
+
+ String AXAutoFillCredentialsLabel();
+ String AXAutoFillContactsLabel();
String missingPluginText();
String crashedPluginText();
Modified: trunk/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp (198332 => 198333)
--- trunk/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp 2016-03-17 16:38:56 UTC (rev 198333)
@@ -407,7 +407,17 @@
{
return String::fromUTF8("cancel");
}
+
+String AXAutoFillCredentialsLabel()
+{
+ return String::fromUTF8("password auto fill");
+}
+String AXAutoFillContactsLabel()
+{
+ return String::fromUTF8("contact info auto fill");
+}
+
String AXButtonActionVerb()
{
return String::fromUTF8("press");
Modified: trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp (198332 => 198333)
--- trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2016-03-17 14:58:57 UTC (rev 198332)
+++ trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2016-03-17 16:38:56 UTC (rev 198333)
@@ -456,6 +456,16 @@
return String::fromUTF8(_("cancel"));
}
+String AXAutoFillCredentialsLabel()
+{
+ return String::fromUTF8(_("password auto fill"));
+}
+
+String AXAutoFillContactsLabel()
+{
+ return String::fromUTF8(_("contact info auto fill"));
+}
+
String AXButtonActionVerb()
{
return String::fromUTF8(_("press"));