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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXRadioInput.cpp

Issue 2894103002: Int and Float properties for Accessibility Object Model phase 1 (Closed)
Patch Set: Update webexposed/ Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/accessibility/AXRadioInput.h" 5 #include "modules/accessibility/AXRadioInput.h"
6 6
7 #include "core/InputTypeNames.h" 7 #include "core/InputTypeNames.h"
8 #include "core/dom/AccessibleNode.h"
8 #include "core/html/HTMLInputElement.h" 9 #include "core/html/HTMLInputElement.h"
9 #include "core/html/forms/RadioInputType.h" 10 #include "core/html/forms/RadioInputType.h"
10 #include "core/layout/LayoutObject.h" 11 #include "core/layout/LayoutObject.h"
11 #include "modules/accessibility/AXObjectCacheImpl.h" 12 #include "modules/accessibility/AXObjectCacheImpl.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 using namespace HTMLNames; 16 using namespace HTMLNames;
16 17
17 AXRadioInput::AXRadioInput(LayoutObject* layout_object, 18 AXRadioInput::AXRadioInput(LayoutObject* layout_object,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 59
59 HTMLInputElement* AXRadioInput::FindFirstRadioButtonInGroup( 60 HTMLInputElement* AXRadioInput::FindFirstRadioButtonInGroup(
60 HTMLInputElement* current) const { 61 HTMLInputElement* current) const {
61 while (HTMLInputElement* prev_element = 62 while (HTMLInputElement* prev_element =
62 RadioInputType::NextRadioButtonInGroup(current, false)) 63 RadioInputType::NextRadioButtonInGroup(current, false))
63 current = prev_element; 64 current = prev_element;
64 return current; 65 return current;
65 } 66 }
66 67
67 int AXRadioInput::PosInSet() const { 68 int AXRadioInput::PosInSet() const {
68 if (HasAttribute(aria_posinsetAttr)) 69 uint32_t pos_in_set;
69 return GetAttribute(aria_posinsetAttr).ToInt(); 70 if (HasAOMPropertyOrARIAAttribute(AOMUIntProperty::kPosInSet, pos_in_set))
71 return pos_in_set;
70 return pos_in_set_; 72 return pos_in_set_;
71 } 73 }
72 74
73 int AXRadioInput::SetSize() const { 75 int AXRadioInput::SetSize() const {
74 if (HasAttribute(aria_setsizeAttr)) 76 int32_t set_size;
75 return GetAttribute(aria_setsizeAttr).ToInt(); 77 if (HasAOMPropertyOrARIAAttribute(AOMIntProperty::kSetSize, set_size))
78 return set_size;
76 return set_size_; 79 return set_size_;
77 } 80 }
78 81
79 bool AXRadioInput::CalculatePosInSet() { 82 bool AXRadioInput::CalculatePosInSet() {
80 // Calculate 'posInSet' attribute when AXRadioInputs need to be updated 83 // Calculate 'posInSet' attribute when AXRadioInputs need to be updated
81 // as a new AXRadioInput Object is added or one of objects from RadioGroup is 84 // as a new AXRadioInput Object is added or one of objects from RadioGroup is
82 // removed. 85 // removed.
83 bool need_to_update_prev = false; 86 bool need_to_update_prev = false;
84 int position = 1; 87 int position = 1;
85 HTMLInputElement* prev_element = 88 HTMLInputElement* prev_element =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 129
127 int AXRadioInput::SizeOfRadioGroup() const { 130 int AXRadioInput::SizeOfRadioGroup() const {
128 int size = GetInputElement()->SizeOfRadioGroup(); 131 int size = GetInputElement()->SizeOfRadioGroup();
129 // If it has no size in Group, it means that there is only itself. 132 // If it has no size in Group, it means that there is only itself.
130 if (!size) 133 if (!size)
131 return 1; 134 return 1;
132 return size; 135 return size;
133 } 136 }
134 137
135 } // namespace blink 138 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698