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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXRadioInput.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: added AXRadioInput Created 4 years, 10 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/AXRadioInput.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXRadioInput.cpp b/third_party/WebKit/Source/modules/accessibility/AXRadioInput.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9ccc4bebaaed2f152bb3e7fc21f0c2a0d915d706
--- /dev/null
+++ b/third_party/WebKit/Source/modules/accessibility/AXRadioInput.cpp
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+#include "modules/accessibility/AXRadioInput.h"
+
+#include "core/html/HTMLInputElement.h"
+#include "modules/accessibility/AXObjectCacheImpl.h"
+
+namespace blink {
+
+using namespace HTMLNames;
+
+AXRadioInput::AXRadioInput(LayoutObject* layoutObject, AXObjectCacheImpl& axObjectCache)
+ : AXLayoutObject(layoutObject, axObjectCache)
+ , m_posInSet(1)
+{
+ element()->setNeedToUpdateAXPosition(true);
+}
+
+AXRadioInput* AXRadioInput::create(LayoutObject* layoutObject, AXObjectCacheImpl& axObjectCache)
+{
+ return new AXRadioInput(layoutObject, axObjectCache);
+}
+
+int AXRadioInput::posInSet() const
+{
+ if (hasAttribute(aria_posinsetAttr))
+ return getAttribute(aria_posinsetAttr).toInt();
+
+ element()->updateAXPositionInRadioGroup();
+ return m_posInSet;
+}
+
+int AXRadioInput::setSize() const
+{
+ if (hasAttribute(aria_setsizeAttr))
+ return getAttribute(aria_setsizeAttr).toInt();
+
+ return sizeOfRadioGroup();
+}
+
+HTMLInputElement* AXRadioInput::element() const
+{
+ return toHTMLInputElement(m_layoutObject->node());
+}
+
+int AXRadioInput::sizeOfRadioGroup() const
+{
+ int size = element()->sizeOfRadioGroup();
+ // If it has no size in Group, it means that there is only itself.
+ if (!size)
+ return 1;
+ return size;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698