- Revision
- 128748
- Author
- [email protected]
- Date
- 2012-09-17 05:52:19 -0700 (Mon, 17 Sep 2012)
Log Message
AX: Regression (r126369) - toggle buttons no longer return accessible titles
https://bugs.webkit.org/show_bug.cgi?id=94858
Patch by Alejandro Piñeiro <[email protected]> on 2012-09-17
Reviewed by Chris Fleizach.
Source/WebCore:
After the addition of the ToggleButtonRole some logic broke because some parts
of the code were assuming/waiting for a ButtonRole
Test: platform/gtk/accessibility/aria-toggle-button-with-title.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isImageButton): using
isButton instead of a ButtonRole comparison
(WebCore::AccessibilityNodeObject::isPressed): using isButton
instead of a ButtonRole comparison
(WebCore::AccessibilityNodeObject::actionElement):
ToggleButtonRole also contemplated in order to call or not toElement
(WebCore::AccessibilityNodeObject::title): ToggleButtonRole also
contemplated in order to call or not textUnderElement
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::actionVerb): buttonAction also
assigned to ToggleButtonRole
(WebCore::AccessibilityObject::isButton): isButton now returns
that an object is a button if it is a ButtonRole, a
PopUpButtonRole or a ToggleButtonRole
* accessibility/AccessibilityObject.h:
(AccessibilityObject): isButton is now implemented on the .c file
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::actionVerb): ToggleButtonRole
also returns a buttonAction
LayoutTests:
Added a test to verify that a toggle button exposes the title.
* accessibility/aria-toggle-button-with-title.html: Added.
* platform/chromium/accessibility/aria-toggle-button-with-title-expected.txt: Added.
* platform/gtk/accessibility/aria-toggle-button-with-title-expected.txt: Added.
* platform/mac/accessibility/aria-toggle-button-with-title-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (128747 => 128748)
--- trunk/LayoutTests/ChangeLog 2012-09-17 12:48:30 UTC (rev 128747)
+++ trunk/LayoutTests/ChangeLog 2012-09-17 12:52:19 UTC (rev 128748)
@@ -1,3 +1,17 @@
+2012-09-17 Alejandro Piñeiro <[email protected]>
+
+ AX: Regression (r126369) - toggle buttons no longer return accessible titles
+ https://bugs.webkit.org/show_bug.cgi?id=94858
+
+ Reviewed by Chris Fleizach.
+
+ Added a test to verify that a toggle button exposes the title.
+
+ * accessibility/aria-toggle-button-with-title.html: Added.
+ * platform/chromium/accessibility/aria-toggle-button-with-title-expected.txt: Added.
+ * platform/gtk/accessibility/aria-toggle-button-with-title-expected.txt: Added.
+ * platform/mac/accessibility/aria-toggle-button-with-title-expected.txt: Added.
+
2012-09-17 Christophe Dumez <[email protected]>
[JSC] http/tests/security/cross-frame-access-put.html failing after r123145
Added: trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html (0 => 128748)
--- trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html (rev 0)
+++ trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html 2012-09-17 12:52:19 UTC (rev 128748)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+
+function runTest()
+{
+ if (window.accessibilityController) {
+
+ document.getElementById("tbutton").focus();
+ tbutton1 = accessibilityController.focusedElement;
+ debug("Role: " + tbutton1.role);
+ shouldBe("tbutton1.title", "'AXTitle: Toggle button'");
+
+ document.getElementById("button").focus();
+ button = accessibilityController.focusedElement;
+ debug("Role: " + button.role);
+ shouldBe("button.title", "'AXTitle: Button title'");
+ }
+}
+</script>
+
+</head>
+<body id="body" _onload_="runTest()">
+
+<a id="tbutton" tabindex="0" class="button" role="button" aria-pressed="true">Toggle button</a>
+
+<div>
+<button type="button" id="button" role="button"/>
+<label>Button title</label>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+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=""
+</body>
+</html>
Added: trunk/LayoutTests/platform/chromium/accessibility/aria-toggle-button-with-title-expected.txt (0 => 128748)
--- trunk/LayoutTests/platform/chromium/accessibility/aria-toggle-button-with-title-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/accessibility/aria-toggle-button-with-title-expected.txt 2012-09-17 12:52:19 UTC (rev 128748)
@@ -0,0 +1,12 @@
+Toggle button
+Button title
+This tests that a toggle button properly exposes the title when there isn't a direct relation and textUnderElement is required to be used.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Role: AXRole: AXToggleButton
+PASS tbutton1.title is 'AXTitle: Toggle button'
+Role: AXRole: AXButton
+PASS button.title is 'AXTitle: Button title'
+
Added: trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-with-title-expected.txt (0 => 128748)
--- trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-with-title-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/aria-toggle-button-with-title-expected.txt 2012-09-17 12:52:19 UTC (rev 128748)
@@ -0,0 +1,12 @@
+Toggle button
+Button title
+This tests that a toggle button properly exposes the title when there isn't a direct relation and textUnderElement is required to be used.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Role: AXRole: toggle button
+PASS tbutton1.title is 'AXTitle: Toggle button'
+Role: AXRole: push button
+PASS button.title is 'AXTitle: Button title'
+
Added: trunk/LayoutTests/platform/mac/accessibility/aria-toggle-button-with-title-expected.txt (0 => 128748)
--- trunk/LayoutTests/platform/mac/accessibility/aria-toggle-button-with-title-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-toggle-button-with-title-expected.txt 2012-09-17 12:52:19 UTC (rev 128748)
@@ -0,0 +1,12 @@
+Toggle button
+Button title
+This tests that a toggle button properly exposes the title when there isn't a direct relation and textUnderElement is required to be used.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Role: AXRole: AXButton
+PASS tbutton1.title is 'AXTitle: Toggle button'
+Role: AXRole: AXButton
+PASS button.title is 'AXTitle: Button title'
+
Modified: trunk/Source/WebCore/ChangeLog (128747 => 128748)
--- trunk/Source/WebCore/ChangeLog 2012-09-17 12:48:30 UTC (rev 128747)
+++ trunk/Source/WebCore/ChangeLog 2012-09-17 12:52:19 UTC (rev 128748)
@@ -1,3 +1,36 @@
+2012-09-17 Alejandro Piñeiro <[email protected]>
+
+ AX: Regression (r126369) - toggle buttons no longer return accessible titles
+ https://bugs.webkit.org/show_bug.cgi?id=94858
+
+ Reviewed by Chris Fleizach.
+
+ After the addition of the ToggleButtonRole some logic broke because some parts
+ of the code were assuming/waiting for a ButtonRole
+
+ Test: platform/gtk/accessibility/aria-toggle-button-with-title.html
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::AccessibilityNodeObject::isImageButton): using
+ isButton instead of a ButtonRole comparison
+ (WebCore::AccessibilityNodeObject::isPressed): using isButton
+ instead of a ButtonRole comparison
+ (WebCore::AccessibilityNodeObject::actionElement):
+ ToggleButtonRole also contemplated in order to call or not toElement
+ (WebCore::AccessibilityNodeObject::title): ToggleButtonRole also
+ contemplated in order to call or not textUnderElement
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::actionVerb): buttonAction also
+ assigned to ToggleButtonRole
+ (WebCore::AccessibilityObject::isButton): isButton now returns
+ that an object is a button if it is a ButtonRole, a
+ PopUpButtonRole or a ToggleButtonRole
+ * accessibility/AccessibilityObject.h:
+ (AccessibilityObject): isButton is now implemented on the .c file
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::actionVerb): ToggleButtonRole
+ also returns a buttonAction
+
2012-09-14 Alexander Pavlov <[email protected]>
Web Inspector: Group selectors to highlight matched selector in the Styles pane of Elements Panel
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (128747 => 128748)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2012-09-17 12:48:30 UTC (rev 128747)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2012-09-17 12:52:19 UTC (rev 128748)
@@ -372,7 +372,7 @@
bool AccessibilityNodeObject::isImageButton() const
{
- return isNativeImage() && roleValue() == ButtonRole;
+ return isNativeImage() && isButton();
}
bool AccessibilityNodeObject::isAnchor() const
@@ -565,7 +565,7 @@
bool AccessibilityNodeObject::isPressed() const
{
- if (roleValue() != ButtonRole)
+ if (!isButton())
return false;
Node* node = this->node();
@@ -875,6 +875,7 @@
switch (roleValue()) {
case ButtonRole:
case PopUpButtonRole:
+ case ToggleButtonRole:
case TabRole:
case MenuItemRole:
case ListItemRole:
@@ -1212,6 +1213,7 @@
switch (roleValue()) {
case PopUpButtonRole:
case ButtonRole:
+ case ToggleButtonRole:
case CheckBoxRole:
case ListBoxOptionRole:
case MenuButtonRole:
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (128747 => 128748)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2012-09-17 12:48:30 UTC (rev 128747)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2012-09-17 12:52:19 UTC (rev 128748)
@@ -1254,6 +1254,7 @@
switch (roleValue()) {
case ButtonRole:
+ case ToggleButtonRole:
return buttonAction;
case TextFieldRole:
case TextAreaRole:
@@ -1789,4 +1790,11 @@
return ButtonRole;
}
+bool AccessibilityObject::isButton() const
+{
+ AccessibilityRole role = roleValue();
+
+ return role == ButtonRole || role == PopUpButtonRole || role == ToggleButtonRole;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (128747 => 128748)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2012-09-17 12:48:30 UTC (rev 128747)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2012-09-17 12:52:19 UTC (rev 128748)
@@ -380,7 +380,7 @@
bool isTree() const { return roleValue() == TreeRole; }
bool isTreeItem() const { return roleValue() == TreeItemRole; }
bool isScrollbar() const { return roleValue() == ScrollBarRole; }
- bool isButton() const { return roleValue() == ButtonRole; }
+ bool isButton() const;
bool isListItem() const { return roleValue() == ListItemRole; }
bool isCheckboxOrRadio() const { return isCheckbox() || isRadioButton(); }
bool isScrollView() const { return roleValue() == ScrollAreaRole; }
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (128747 => 128748)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-09-17 12:48:30 UTC (rev 128747)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-09-17 12:52:19 UTC (rev 128748)
@@ -2907,6 +2907,7 @@
switch (roleValue()) {
case ButtonRole:
+ case ToggleButtonRole:
return buttonAction;
case TextFieldRole:
case TextAreaRole: