Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(933)

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp

Issue 1628283002: posinset and setsize for input type, radio, exposed in AX tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698