Diff
Modified: trunk/LayoutTests/ChangeLog (198473 => 198474)
--- trunk/LayoutTests/ChangeLog 2016-03-20 01:57:33 UTC (rev 198473)
+++ trunk/LayoutTests/ChangeLog 2016-03-20 15:21:33 UTC (rev 198474)
@@ -1,3 +1,15 @@
+2016-03-20 Chris Fleizach <[email protected]>
+
+ AX: Radio button members are not identified together in all cases
+ https://bugs.webkit.org/show_bug.cgi?id=155604
+ <rdar://problem/21186992>
+
+ Reviewed by Darin Adler.
+
+ * accessibility/mac/radio-button-group-members-expected.txt: Added.
+ * accessibility/radio-button-group-members.html:
+ * platform/mac/accessibility/radio-button-group-members-expected.txt: Removed.
+
2016-03-19 Skachkov Oleksandr <[email protected]>
[ES6] Arrow function syntax. Update syntax error text 'super is only valid inside functions' to more suitable
Copied: trunk/LayoutTests/accessibility/mac/radio-button-group-members-expected.txt (from rev 198473, trunk/LayoutTests/platform/mac/accessibility/radio-button-group-members-expected.txt) (0 => 198474)
--- trunk/LayoutTests/accessibility/mac/radio-button-group-members-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/radio-button-group-members-expected.txt 2016-03-20 15:21:33 UTC (rev 198474)
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+This tests that linked UI elements withing a radio group work
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Radio buttons within the same named group should be able to access their siblings
+PASS test1.linkedUIElementAtIndex(0).isEqual(test1) is true
+PASS test1.linkedUIElementAtIndex(1).isEqual(accessibilityController.accessibleElementById('test1_No')) is true
+PASS test1.linkedUIElementAtIndex(2).isEqual(accessibilityController.accessibleElementById('test1_Maybe')) is true
+
+
+Radio buttons that are not in a form, but in the same named group should be able to access their siblings
+PASS test2.linkedUIElementAtIndex(0).isEqual(test2) is true
+PASS test2.linkedUIElementAtIndex(1).isEqual(accessibilityController.accessibleElementById('test2_No')) is true
+
+
+Radio buttons labeled by should be able to access their siblings
+PASS test3.linkedUIElementAtIndex(0).isEqual(test3) is true
+PASS test3.linkedUIElementAtIndex(1).isEqual(accessibilityController.accessibleElementById('test3_No')) is true
+
+
+Radio buttons not in a groups should not have siblings (the first linked element is itself)
+PASS test4.linkedUIElementAtIndex(0).isEqual(test4) is true
+PASS !test4.linkedUIElementAtIndex(1) || !test4.linkedUIElementAtIndex(1).isValid is true
+
+
+Radio buttons that just have aria roles should work.
+PASS ariaRadio1.linkedUIElementAtIndex(0).isEqual(ariaRadio1) is true
+PASS ariaRadio1.linkedUIElementAtIndex(1).isEqual(ariaRadio2) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Modified: trunk/LayoutTests/accessibility/radio-button-group-members.html (198473 => 198474)
--- trunk/LayoutTests/accessibility/radio-button-group-members.html 2016-03-20 01:57:33 UTC (rev 198473)
+++ trunk/LayoutTests/accessibility/radio-button-group-members.html 2016-03-20 15:21:33 UTC (rev 198474)
@@ -35,8 +35,17 @@
</form>
<br><br>
+ <!-- Test radiogroup parentage -->
+ <div class="radiogroup" role="radiogroup" id="radiogroup">
+ <div>
+ <div role="radio" id="ariaradio1" aria-checked="true">Radio 1</div>
+ <div role="radio" id="ariaradio2" aria-checked="false">Radio 2</div>
+ <div role="radio" aria-checked="false">Radio 3</div>
</div>
+ </div>
+ </div>
+
<p id="description"></p>
<div id="console"></div>
@@ -69,6 +78,13 @@
var test4 = accessibilityController.accessibleElementById("test4_Yes");
shouldBeTrue("test4.linkedUIElementAtIndex(0).isEqual(test4)");
shouldBeTrue("!test4.linkedUIElementAtIndex(1) || !test4.linkedUIElementAtIndex(1).isValid");
+ debug("\n");
+
+ debug("Radio buttons that just have aria roles should work.");
+ var ariaRadio1 = accessibilityController.accessibleElementById("ariaradio1");
+ var ariaRadio2 = accessibilityController.accessibleElementById("ariaradio2");
+ shouldBeTrue("ariaRadio1.linkedUIElementAtIndex(0).isEqual(ariaRadio1)");
+ shouldBeTrue("ariaRadio1.linkedUIElementAtIndex(1).isEqual(ariaRadio2)");
document.getElementById("content").style.visibility = "hidden";
}
Deleted: trunk/LayoutTests/platform/mac/accessibility/radio-button-group-members-expected.txt (198473 => 198474)
--- trunk/LayoutTests/platform/mac/accessibility/radio-button-group-members-expected.txt 2016-03-20 01:57:33 UTC (rev 198473)
+++ trunk/LayoutTests/platform/mac/accessibility/radio-button-group-members-expected.txt 2016-03-20 15:21:33 UTC (rev 198474)
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-This tests that linked UI elements withing a radio group work
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Radio buttons within the same named group should be able to access their siblings
-PASS test1.linkedUIElementAtIndex(0).isEqual(test1) is true
-PASS test1.linkedUIElementAtIndex(1).isEqual(accessibilityController.accessibleElementById('test1_No')) is true
-PASS test1.linkedUIElementAtIndex(2).isEqual(accessibilityController.accessibleElementById('test1_Maybe')) is true
-
-
-Radio buttons that are not in a form, but in the same named group should be able to access their siblings
-PASS test2.linkedUIElementAtIndex(0).isEqual(test2) is true
-PASS test2.linkedUIElementAtIndex(1).isEqual(accessibilityController.accessibleElementById('test2_No')) is true
-
-
-Radio buttons labeled by should be able to access their siblings
-PASS test3.linkedUIElementAtIndex(0).isEqual(test3) is true
-PASS test3.linkedUIElementAtIndex(1).isEqual(accessibilityController.accessibleElementById('test3_No')) is true
-
-
-Radio buttons not in a groups should not have siblings (the first linked element is itself)
-PASS test4.linkedUIElementAtIndex(0).isEqual(test4) is true
-PASS !test4.linkedUIElementAtIndex(1) || !test4.linkedUIElementAtIndex(1).isValid is true
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Modified: trunk/Source/WebCore/ChangeLog (198473 => 198474)
--- trunk/Source/WebCore/ChangeLog 2016-03-20 01:57:33 UTC (rev 198473)
+++ trunk/Source/WebCore/ChangeLog 2016-03-20 15:21:33 UTC (rev 198474)
@@ -1,3 +1,21 @@
+2016-03-20 Chris Fleizach <[email protected]>
+
+ AX: Radio button members are not identified together in all cases
+ https://bugs.webkit.org/show_bug.cgi?id=155604
+ <rdar://problem/21186992>
+
+ Reviewed by Darin Adler.
+
+ Allow aria radio buttons to be grouped together as linked ui elements even if they're not input types of radio button.
+
+ Modified test: accessibility/radio-button-group-members.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::speakProperty):
+ (WebCore::AccessibilityRenderObject::addRadioButtonGroupChildren):
+ (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
+ * accessibility/AccessibilityRenderObject.h:
+
2016-03-19 Joonghun Park <[email protected]>
Purge PassRefPtr from WebCore/html/shadow
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (198473 => 198474)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2016-03-20 01:57:33 UTC (rev 198473)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2016-03-20 15:21:33 UTC (rev 198474)
@@ -949,29 +949,44 @@
return m_renderer->style().speak();
}
+void AccessibilityRenderObject::addRadioButtonGroupChildren(AccessibilityObject* parent, AccessibilityChildrenVector& linkedUIElements) const
+{
+ for (const auto& child : parent->children()) {
+ if (child->roleValue() == RadioButtonRole)
+ linkedUIElements.append(child);
+ else
+ addRadioButtonGroupChildren(child.get(), linkedUIElements);
+ }
+}
+
void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const
{
- if (!m_renderer || roleValue() != RadioButtonRole)
+ if (roleValue() != RadioButtonRole)
return;
- Node* node = m_renderer->node();
- if (!is<HTMLInputElement>(node))
- return;
-
- HTMLInputElement& input = downcast<HTMLInputElement>(*node);
- // if there's a form, then this is easy
- if (input.form()) {
- for (auto& associateElement : input.form()->namedElements(input.name())) {
- if (AccessibilityObject* object = axObjectCache()->getOrCreate(&associateElement.get()))
- linkedUIElements.append(object);
- }
- } else {
- for (auto& associateElement : descendantsOfType<HTMLInputElement>(node->document())) {
- if (associateElement.isRadioButton() && associateElement.name() == input.name()) {
- if (AccessibilityObject* object = axObjectCache()->getOrCreate(&associateElement))
+ Node* node = this->node();
+ if (is<HTMLInputElement>(node)) {
+ HTMLInputElement& input = downcast<HTMLInputElement>(*node);
+ // if there's a form, then this is easy
+ if (input.form()) {
+ for (auto& associateElement : input.form()->namedElements(input.name())) {
+ if (AccessibilityObject* object = axObjectCache()->getOrCreate(&associateElement.get()))
linkedUIElements.append(object);
}
+ } else {
+ for (auto& associateElement : descendantsOfType<HTMLInputElement>(node->document())) {
+ if (associateElement.isRadioButton() && associateElement.name() == input.name()) {
+ if (AccessibilityObject* object = axObjectCache()->getOrCreate(&associateElement))
+ linkedUIElements.append(object);
+ }
+ }
}
+ } else {
+ // If we didn't find any radio button siblings with the traditional naming, lets search for a radio group role and find its children.
+ for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
+ if (parent->roleValue() == RadioGroupRole)
+ addRadioButtonGroupChildren(parent, linkedUIElements);
+ }
}
}
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (198473 => 198474)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2016-03-20 01:57:33 UTC (rev 198473)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2016-03-20 15:21:33 UTC (rev 198474)
@@ -235,6 +235,7 @@
bool isTabItemSelected() const;
LayoutRect checkboxOrRadioRect() const;
void addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const;
+ void addRadioButtonGroupChildren(AccessibilityObject*, AccessibilityChildrenVector&) const;
AccessibilityObject* internalLinkElement() const;
AccessibilityObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) const;
AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement*) const;