OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "modules/accessibility/InspectorAccessibilityAgent.h" | 7 #include "modules/accessibility/InspectorAccessibilityAgent.h" |
8 | 8 |
9 #include "core/dom/AXObjectCache.h" | 9 #include "core/dom/AXObjectCache.h" |
10 #include "core/dom/DOMNodeIds.h" | 10 #include "core/dom/DOMNodeIds.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool roleAllowsRequired(AccessibilityRole role) | 119 bool roleAllowsRequired(AccessibilityRole role) |
120 { | 120 { |
121 return role == ComboBoxRole || role == CellRole || role == ListBoxRole || ro
le == RadioGroupRole || role == SpinButtonRole || role == TextFieldRole || role
== TreeRole || role == ColumnHeaderRole || role == RowHeaderRole || role == Tree
GridRole; | 121 return role == ComboBoxRole || role == CellRole || role == ListBoxRole || ro
le == RadioGroupRole || role == SpinButtonRole || role == TextFieldRole || role
== TreeRole || role == ColumnHeaderRole || role == RowHeaderRole || role == Tree
GridRole; |
122 } | 122 } |
123 | 123 |
124 bool roleAllowsSort(AccessibilityRole role) | 124 bool roleAllowsSort(AccessibilityRole role) |
125 { | 125 { |
126 return role == ColumnHeaderRole || role == RowHeaderRole; | 126 return role == ColumnHeaderRole || role == RowHeaderRole; |
127 } | 127 } |
128 | 128 |
129 bool roleAllowsRangeValues(AccessibilityRole role) | |
130 { | |
131 return role == ProgressIndicatorRole || role == ScrollBarRole || role == Sli
derRole || role == SpinButtonRole; | |
132 } | |
133 | |
134 bool roleAllowsChecked(AccessibilityRole role) | 129 bool roleAllowsChecked(AccessibilityRole role) |
135 { | 130 { |
136 return role == MenuItemCheckBoxRole || role == MenuItemRadioRole || role ==
RadioButtonRole || role == CheckBoxRole || role == TreeItemRole || role == ListB
oxOptionRole || role == SwitchRole; | 131 return role == MenuItemCheckBoxRole || role == MenuItemRadioRole || role ==
RadioButtonRole || role == CheckBoxRole || role == TreeItemRole || role == ListB
oxOptionRole || role == SwitchRole; |
137 } | 132 } |
138 | 133 |
139 bool roleAllowsSelected(AccessibilityRole role) | 134 bool roleAllowsSelected(AccessibilityRole role) |
140 { | 135 { |
141 return role == CellRole || role == ListBoxOptionRole || role == RowRole || r
ole == TabRole || role == ColumnHeaderRole || role == MenuItemRadioRole || role
== RadioButtonRole || role == RowHeaderRole || role == TreeItemRole; | 136 return role == CellRole || role == ListBoxOptionRole || role == RowRole || r
ole == TabRole || role == ColumnHeaderRole || role == MenuItemRadioRole || role
== RadioButtonRole || role == RowHeaderRole || role == TreeItemRole; |
142 } | 137 } |
143 | 138 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 182 } |
188 | 183 |
189 if (roleAllowsRequired(role)) { | 184 if (roleAllowsRequired(role)) { |
190 properties->addItem(createProperty(AXWidgetAttributes::Required, createB
ooleanValue(axObject->isRequired()))); | 185 properties->addItem(createProperty(AXWidgetAttributes::Required, createB
ooleanValue(axObject->isRequired()))); |
191 } | 186 } |
192 | 187 |
193 if (roleAllowsSort(role)) { | 188 if (roleAllowsSort(role)) { |
194 // TODO(aboxhall): sort | 189 // TODO(aboxhall): sort |
195 } | 190 } |
196 | 191 |
197 if (roleAllowsRangeValues(role)) { | 192 if (axObject->isRange()) { |
198 properties->addItem(createProperty(AXWidgetAttributes::Valuemin, createV
alue(axObject->minValueForRange()))); | 193 properties->addItem(createProperty(AXWidgetAttributes::Valuemin, createV
alue(axObject->minValueForRange()))); |
199 properties->addItem(createProperty(AXWidgetAttributes::Valuemax, createV
alue(axObject->maxValueForRange()))); | 194 properties->addItem(createProperty(AXWidgetAttributes::Valuemax, createV
alue(axObject->maxValueForRange()))); |
200 properties->addItem(createProperty(AXWidgetAttributes::Valuetext, create
Value(axObject->valueDescription()))); | 195 properties->addItem(createProperty(AXWidgetAttributes::Valuetext, create
Value(axObject->valueDescription()))); |
201 } | 196 } |
202 } | 197 } |
203 | 198 |
204 void fillWidgetStates(AXObject* axObject, PassRefPtr<TypeBuilder::Array<AXProper
ty>> properties) | 199 void fillWidgetStates(AXObject* axObject, PassRefPtr<TypeBuilder::Array<AXProper
ty>> properties) |
205 { | 200 { |
206 AccessibilityRole role = axObject->roleValue(); | 201 AccessibilityRole role = axObject->roleValue(); |
207 if (roleAllowsChecked(role)) { | 202 if (roleAllowsChecked(role)) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, properties
); | 369 accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, properties
); |
375 } | 370 } |
376 | 371 |
377 DEFINE_TRACE(InspectorAccessibilityAgent) | 372 DEFINE_TRACE(InspectorAccessibilityAgent) |
378 { | 373 { |
379 visitor->trace(m_page); | 374 visitor->trace(m_page); |
380 InspectorBaseAgent::trace(visitor); | 375 InspectorBaseAgent::trace(visitor); |
381 } | 376 } |
382 | 377 |
383 } // namespace blink | 378 } // namespace blink |
OLD | NEW |