OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 |
| 6 #include "modules/accessibility/AXRadioInput.h" |
| 7 |
| 8 #include "core/html/HTMLInputElement.h" |
| 9 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 using namespace HTMLNames; |
| 14 |
| 15 AXRadioInput::AXRadioInput(LayoutObject* layoutObject, AXObjectCacheImpl& axObje
ctCache) |
| 16 : AXLayoutObject(layoutObject, axObjectCache) |
| 17 , m_posInSet(1) |
| 18 { |
| 19 element()->setNeedToUpdateAXPosition(true); |
| 20 } |
| 21 |
| 22 AXRadioInput* AXRadioInput::create(LayoutObject* layoutObject, AXObjectCacheImpl
& axObjectCache) |
| 23 { |
| 24 return new AXRadioInput(layoutObject, axObjectCache); |
| 25 } |
| 26 |
| 27 int AXRadioInput::posInSet() const |
| 28 { |
| 29 if (hasAttribute(aria_posinsetAttr)) |
| 30 return getAttribute(aria_posinsetAttr).toInt(); |
| 31 |
| 32 element()->updateAXPositionInRadioGroup(); |
| 33 return m_posInSet; |
| 34 } |
| 35 |
| 36 int AXRadioInput::setSize() const |
| 37 { |
| 38 if (hasAttribute(aria_setsizeAttr)) |
| 39 return getAttribute(aria_setsizeAttr).toInt(); |
| 40 |
| 41 return sizeOfRadioGroup(); |
| 42 } |
| 43 |
| 44 HTMLInputElement* AXRadioInput::element() const |
| 45 { |
| 46 return toHTMLInputElement(m_layoutObject->node()); |
| 47 } |
| 48 |
| 49 int AXRadioInput::sizeOfRadioGroup() const |
| 50 { |
| 51 int size = element()->sizeOfRadioGroup(); |
| 52 // If it has no size in Group, it means that there is only itself. |
| 53 if (!size) |
| 54 return 1; |
| 55 return size; |
| 56 } |
| 57 |
| 58 } // namespace blink |
OLD | NEW |