Index: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
index 08f58880ed500c446aa4c17ab1a9176d3ad49b8f..503cec0b57e6f92481d0dcb6f656c39e443885b9 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
@@ -1295,11 +1295,51 @@ InvalidState AXNodeObject::invalidState() const |
return InvalidStateUndefined; |
} |
+int AXNodeObject::positionInRadioGroup() const |
+{ |
+ if (!isHTMLInputElement(node())) |
+ return 0; |
+ |
+ HTMLInputElement& input = toHTMLInputElement(*node()); |
+ const AtomicString& type = input.type(); |
+ if (type != InputTypeNames::radio) |
+ return 0; |
+ |
+ int pos = input.posInRadioGroup(); |
+ // If it has no pos in Group, it means that there is only itself. |
+ if (!pos) |
+ return 1; |
+ return pos; |
+ |
+} |
+ |
+int AXNodeObject::sizeOfRadioGroup() const |
+{ |
+ if (!isHTMLInputElement(node())) |
+ return 0; |
+ |
+ HTMLInputElement& input = toHTMLInputElement(*node()); |
+ const AtomicString& type = input.type(); |
+ if (type != InputTypeNames::radio) |
+ return 0; |
+ |
+ int size = input.sizeOfRadioGroup(); |
+ // If it has no size in Group, it means that there is only itself. |
+ if (!size) |
+ return 1; |
+ return size; |
+ |
+} |
+ |
int AXNodeObject::posInSet() const |
{ |
if (supportsSetSizeAndPosInSet()) { |
if (hasAttribute(aria_posinsetAttr)) |
return getAttribute(aria_posinsetAttr).toInt(); |
+ |
+ if (int position = positionInRadioGroup()) |
+ return position; |
+ |
return AXObject::indexInParent() + 1; |
} |
@@ -1312,6 +1352,9 @@ int AXNodeObject::setSize() const |
if (hasAttribute(aria_setsizeAttr)) |
return getAttribute(aria_setsizeAttr).toInt(); |
+ if (int size = sizeOfRadioGroup()) |
+ return size; |
+ |
if (parentObject()) { |
const auto& siblings = parentObject()->children(); |
return siblings.size(); |