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 |