- Revision
- 182012
- Author
- [email protected]
- Date
- 2015-03-26 09:35:58 -0700 (Thu, 26 Mar 2015)
Log Message
AX: [role="button"][aria-pressed] should be exposed as AXCheckbox:AXToggleButton, with role description of "toggle button"
https://bugs.webkit.org/show_bug.cgi?id=115298
Reviewed by Mario Sanchez Prada.
Source/WebCore:
A role=button + aria-pressed object should be exposed as AXCheckbox on Mac now. It should also convert the
aria-pressed state into a 0, 1, 2 number value for the Mac.
Test: platform/mac/accessibility/aria-pressed-button-attributes.html
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::checkboxOrRadioValue):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isToggleButton):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
(createAccessibilityRoleMap):
(-[WebAccessibilityObjectWrapper subrole]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
LayoutTests:
* accessibility/aria-toggle-button-with-title.html:
Bad path for post test resources file, so that is fixed.
* platform/mac/accessibility/aria-pressed-button-attributes-expected.txt: Added.
* platform/mac/accessibility/aria-pressed-button-attributes.html: Added.
* platform/mac/accessibility/aria-toggle-button-with-title-expected.txt:
Updated to reflect the new role of this object.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (182011 => 182012)
--- trunk/LayoutTests/ChangeLog 2015-03-26 16:24:06 UTC (rev 182011)
+++ trunk/LayoutTests/ChangeLog 2015-03-26 16:35:58 UTC (rev 182012)
@@ -1,3 +1,17 @@
+2015-03-26 Chris Fleizach <[email protected]>
+
+ AX: [role="button"][aria-pressed] should be exposed as AXCheckbox:AXToggleButton, with role description of "toggle button"
+ https://bugs.webkit.org/show_bug.cgi?id=115298
+
+ Reviewed by Mario Sanchez Prada.
+
+ * accessibility/aria-toggle-button-with-title.html:
+ Bad path for post test resources file, so that is fixed.
+ * platform/mac/accessibility/aria-pressed-button-attributes-expected.txt: Added.
+ * platform/mac/accessibility/aria-pressed-button-attributes.html: Added.
+ * platform/mac/accessibility/aria-toggle-button-with-title-expected.txt:
+ Updated to reflect the new role of this object.
+
2015-03-26 Csaba Osztrogonác <[email protected]>
Unreviewed gardening, skip failing tests on AArch64 Linux.
Modified: trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html (182011 => 182012)
--- trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html 2015-03-26 16:24:06 UTC (rev 182011)
+++ trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html 2015-03-26 16:35:58 UTC (rev 182012)
@@ -38,6 +38,6 @@
description("This tests that a toggle button properly exposes the title when there isn't a direct relation and textUnderElement is required to be used.");
</script>
-<script src=""
+<script src=""
</body>
</html>
Added: trunk/LayoutTests/platform/mac/accessibility/aria-pressed-button-attributes-expected.txt (0 => 182012)
--- trunk/LayoutTests/platform/mac/accessibility/aria-pressed-button-attributes-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-pressed-button-attributes-expected.txt 2015-03-26 16:35:58 UTC (rev 182012)
@@ -0,0 +1,17 @@
+Foo
+Bar
+This tests role=button with aria-pressed will create an AXCheckbox:AXToggle on Mac with the right AXValue
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Button1: AXRole: AXCheckBox
+Button1: AXSubrole: AXToggle
+Button1: AXValue: 1
+Button2: AXRole: AXCheckBox
+Button2: AXSubrole: AXToggle
+Button2: AXValue: 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/aria-pressed-button-attributes.html (0 => 182012)
--- trunk/LayoutTests/platform/mac/accessibility/aria-pressed-button-attributes.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-pressed-button-attributes.html 2015-03-26 16:35:58 UTC (rev 182012)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body id="body">
+
+<div id="button1" role="button" aria-pressed="true">Foo</div>
+
+<div id="button2" role="button" aria-pressed="false">Bar</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests role=button with aria-pressed will create an AXCheckbox:AXToggle on Mac with the right AXValue");
+
+ if (window.accessibilityController) {
+
+ var button1 = accessibilityController.accessibleElementById("button1");
+ debug("Button1: " + button1.role);
+ debug("Button1: " + button1.subrole);
+ debug("Button1: " + button1.stringValue);
+
+ var button2 = accessibilityController.accessibleElementById("button2");
+ debug("Button2: " + button2.role);
+ debug("Button2: " + button2.subrole);
+ debug("Button2: " + button2.stringValue);
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac/accessibility/aria-toggle-button-with-title-expected.txt (182011 => 182012)
--- trunk/LayoutTests/platform/mac/accessibility/aria-toggle-button-with-title-expected.txt 2015-03-26 16:24:06 UTC (rev 182011)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-toggle-button-with-title-expected.txt 2015-03-26 16:35:58 UTC (rev 182012)
@@ -5,7 +5,10 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-Role: AXRole: AXButton
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Role: AXRole: AXCheckBox
PASS tbutton1.title is 'AXTitle: Toggle button'
Role: AXRole: AXButton
PASS button.title is 'AXTitle: Button title'
Modified: trunk/Source/WebCore/ChangeLog (182011 => 182012)
--- trunk/Source/WebCore/ChangeLog 2015-03-26 16:24:06 UTC (rev 182011)
+++ trunk/Source/WebCore/ChangeLog 2015-03-26 16:35:58 UTC (rev 182012)
@@ -1,3 +1,25 @@
+2015-03-26 Chris Fleizach <[email protected]>
+
+ AX: [role="button"][aria-pressed] should be exposed as AXCheckbox:AXToggleButton, with role description of "toggle button"
+ https://bugs.webkit.org/show_bug.cgi?id=115298
+
+ Reviewed by Mario Sanchez Prada.
+
+ A role=button + aria-pressed object should be exposed as AXCheckbox on Mac now. It should also convert the
+ aria-pressed state into a 0, 1, 2 number value for the Mac.
+
+ Test: platform/mac/accessibility/aria-pressed-button-attributes.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::checkboxOrRadioValue):
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilityObject::isToggleButton):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+ (createAccessibilityRoleMap):
+ (-[WebAccessibilityObjectWrapper subrole]):
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
2015-03-25 Dean Jackson <[email protected]>
CSS blend modes do not parse when in the shadow tree
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (182011 => 182012)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2015-03-26 16:24:06 UTC (rev 182011)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2015-03-26 16:35:58 UTC (rev 182012)
@@ -2226,7 +2226,17 @@
{
// If this is a real checkbox or radio button, AccessibilityRenderObject will handle.
// If it's an ARIA checkbox, radio, or switch the aria-checked attribute should be used.
+ // If it's a toggle button, the aria-pressed attribute is consulted.
+ if (isToggleButton()) {
+ const AtomicString& ariaPressed = getAttribute(aria_pressedAttr);
+ if (equalIgnoringCase(ariaPressed, "true"))
+ return ButtonStateOn;
+ if (equalIgnoringCase(ariaPressed, "mixed"))
+ return ButtonStateMixed;
+ return ButtonStateOff;
+ }
+
const AtomicString& result = getAttribute(aria_checkedAttr);
if (equalIgnoringCase(result, "true"))
return ButtonStateOn;
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (182011 => 182012)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2015-03-26 16:24:06 UTC (rev 182011)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2015-03-26 16:35:58 UTC (rev 182012)
@@ -502,6 +502,7 @@
virtual bool isMockObject() const { return false; }
virtual bool isMediaControlLabel() const { return false; }
bool isSwitch() const { return roleValue() == SwitchRole; }
+ bool isToggleButton() const { return roleValue() == ToggleButtonRole; }
bool isTextControl() const;
bool isARIATextControl() const;
bool isTabList() const { return roleValue() == TabListRole; }
@@ -599,7 +600,7 @@
virtual bool supportsARIAControls() const { return false; }
virtual void ariaControlsElements(AccessibilityChildrenVector&) const { }
virtual bool ariaHasPopup() const { return false; }
- virtual bool ariaPressedIsPresent() const;
+ bool ariaPressedIsPresent() const;
bool ariaIsMultiline() const;
String invalidStatus() const;
bool supportsARIAExpanded() const;
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (182011 => 182012)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2015-03-26 16:24:06 UTC (rev 182011)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2015-03-26 16:35:58 UTC (rev 182012)
@@ -1191,6 +1191,9 @@
if (m_object->supportsARIAOwns())
[additional addObject:NSAccessibilityOwnsAttribute];
+ if (m_object->isToggleButton())
+ [additional addObject:NSAccessibilityValueAttribute];
+
if (m_object->supportsARIAExpanded())
[additional addObject:NSAccessibilityExpandedAttribute];
@@ -1944,7 +1947,7 @@
{ FormRole, NSAccessibilityGroupRole },
{ SpinButtonRole, NSAccessibilityIncrementorRole },
{ FooterRole, NSAccessibilityGroupRole },
- { ToggleButtonRole, NSAccessibilityButtonRole },
+ { ToggleButtonRole, NSAccessibilityCheckBoxRole },
{ CanvasRole, NSAccessibilityImageRole },
{ SVGRootRole, NSAccessibilityGroupRole },
{ LegendRole, NSAccessibilityGroupRole },
@@ -1998,13 +2001,15 @@
if (m_object->isAttachment()) {
NSView* attachView = [self attachmentView];
- if ([[attachView accessibilityAttributeNames] containsObject:NSAccessibilitySubroleAttribute]) {
+ if ([[attachView accessibilityAttributeNames] containsObject:NSAccessibilitySubroleAttribute])
return [attachView accessibilityAttributeValue:NSAccessibilitySubroleAttribute];
- }
}
- if (m_object->roleValue() == HorizontalRuleRole)
+ AccessibilityRole role = m_object->roleValue();
+ if (role == HorizontalRuleRole)
return NSAccessibilityContentSeparatorSubrole;
+ if (role == ToggleButtonRole)
+ return NSAccessibilityToggleSubrole;
if (is<AccessibilitySpinButtonPart>(*m_object)) {
if (downcast<AccessibilitySpinButtonPart>(*m_object).isIncrementor())
@@ -2029,7 +2034,7 @@
}
// ARIA content subroles.
- switch (m_object->roleValue()) {
+ switch (role) {
case LandmarkApplicationRole:
return @"AXLandmarkApplication";
case LandmarkBannerRole:
@@ -2085,7 +2090,7 @@
break;
}
- if (m_object->roleValue() == MathElementRole) {
+ if (role == MathElementRole) {
if (m_object->isMathFraction())
return @"AXMathFraction";
if (m_object->isMathFenced())
@@ -2122,9 +2127,9 @@
return @"AXMathMultiscript";
}
- if (m_object->roleValue() == VideoRole)
+ if (role == VideoRole)
return @"AXVideo";
- if (m_object->roleValue() == AudioRole)
+ if (role == AudioRole)
return @"AXAudio";
if (m_object->isMediaTimeline())
@@ -2449,7 +2454,7 @@
if (m_object->isHeading())
return [NSNumber numberWithInt:m_object->headingLevel()];
- if (m_object->isCheckboxOrRadio() || m_object->isMenuItem() || m_object->isSwitch()) {
+ if (m_object->isCheckboxOrRadio() || m_object->isMenuItem() || m_object->isSwitch() || m_object->isToggleButton()) {
switch (m_object->checkboxOrRadioValue()) {
case ButtonStateOff:
return [NSNumber numberWithInt:0];