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

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

Issue 2666873005: Implement aria-modal (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
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 "modules/accessibility/InspectorAccessibilityAgent.h" 5 #include "modules/accessibility/InspectorAccessibilityAgent.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/dom/AXObjectCache.h" 8 #include "core/dom/AXObjectCache.h"
9 #include "core/dom/DOMNodeIds.h" 9 #include "core/dom/DOMNodeIds.h"
10 #include "core/dom/Element.h" 10 #include "core/dom/Element.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 default: 108 default:
109 // TODO(aboxhall): expose invalid: <nothing> and source: aria-invalid as 109 // TODO(aboxhall): expose invalid: <nothing> and source: aria-invalid as
110 // invalid value 110 // invalid value
111 properties.addItem(createProperty( 111 properties.addItem(createProperty(
112 AXGlobalStatesEnum::Invalid, 112 AXGlobalStatesEnum::Invalid,
113 createValue(axObject.ariaInvalidValue(), AXValueTypeEnum::String))); 113 createValue(axObject.ariaInvalidValue(), AXValueTypeEnum::String)));
114 break; 114 break;
115 } 115 }
116 } 116 }
117 117
118 bool roleAllowsModal(AccessibilityRole role) {
119 return role == DialogRole || role == AlertDialogRole;
120 }
121
118 bool roleAllowsMultiselectable(AccessibilityRole role) { 122 bool roleAllowsMultiselectable(AccessibilityRole role) {
119 return role == GridRole || role == ListBoxRole || role == TabListRole || 123 return role == GridRole || role == ListBoxRole || role == TabListRole ||
120 role == TreeGridRole || role == TreeRole; 124 role == TreeGridRole || role == TreeRole;
121 } 125 }
122 126
123 bool roleAllowsOrientation(AccessibilityRole role) { 127 bool roleAllowsOrientation(AccessibilityRole role) {
124 return role == ScrollBarRole || role == SplitterRole || role == SliderRole; 128 return role == ScrollBarRole || role == SplitterRole || role == SliderRole;
125 } 129 }
126 130
127 bool roleAllowsReadonly(AccessibilityRole role) { 131 bool roleAllowsReadonly(AccessibilityRole role) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 createProperty(AXWidgetStatesEnum::Pressed, 303 createProperty(AXWidgetStatesEnum::Pressed,
300 createValue("true", AXValueTypeEnum::Tristate))); 304 createValue("true", AXValueTypeEnum::Tristate)));
301 } 305 }
302 } 306 }
303 307
304 if (roleAllowsSelected(role)) { 308 if (roleAllowsSelected(role)) {
305 properties.addItem( 309 properties.addItem(
306 createProperty(AXWidgetStatesEnum::Selected, 310 createProperty(AXWidgetStatesEnum::Selected,
307 createBooleanValue(axObject.isSelected()))); 311 createBooleanValue(axObject.isSelected())));
308 } 312 }
313
314 if (roleAllowsModal(role)) {
315 properties.addItem(createProperty(AXWidgetStatesEnum::Modal,
316 createBooleanValue(axObject.isModal())));
317 }
309 } 318 }
310 319
311 std::unique_ptr<AXProperty> createRelatedNodeListProperty( 320 std::unique_ptr<AXProperty> createRelatedNodeListProperty(
312 const String& key, 321 const String& key,
313 AXRelatedObjectVector& nodes) { 322 AXRelatedObjectVector& nodes) {
314 std::unique_ptr<AXValue> nodeListValue = 323 std::unique_ptr<AXValue> nodeListValue =
315 createRelatedNodeListValue(nodes, AXValueTypeEnum::NodeList); 324 createRelatedNodeListValue(nodes, AXValueTypeEnum::NodeList);
316 return createProperty(key, std::move(nodeListValue)); 325 return createProperty(key, std::move(nodeListValue));
317 } 326 }
318 327
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 742 }
734 } 743 }
735 744
736 DEFINE_TRACE(InspectorAccessibilityAgent) { 745 DEFINE_TRACE(InspectorAccessibilityAgent) {
737 visitor->trace(m_page); 746 visitor->trace(m_page);
738 visitor->trace(m_domAgent); 747 visitor->trace(m_domAgent);
739 InspectorBaseAgent::trace(visitor); 748 InspectorBaseAgent::trace(visitor);
740 } 749 }
741 750
742 } // namespace blink 751 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXObject.h ('k') | third_party/WebKit/Source/web/WebAXObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698