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

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

Issue 2653063002: Add 4 ARIA 1.1 attributes using new sparse attribute interface. (Closed)
Patch Set: Rebase 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 SparseAttributeAXPropertyAdapter(AXObject& axObject, 334 SparseAttributeAXPropertyAdapter(AXObject& axObject,
335 protocol::Array<AXProperty>& properties) 335 protocol::Array<AXProperty>& properties)
336 : m_axObject(&axObject), m_properties(properties) {} 336 : m_axObject(&axObject), m_properties(properties) {}
337 337
338 DEFINE_INLINE_TRACE() { visitor->trace(m_axObject); } 338 DEFINE_INLINE_TRACE() { visitor->trace(m_axObject); }
339 339
340 private: 340 private:
341 Member<AXObject> m_axObject; 341 Member<AXObject> m_axObject;
342 protocol::Array<AXProperty>& m_properties; 342 protocol::Array<AXProperty>& m_properties;
343 343
344 void addBoolAttribute(AXBoolAttribute attribute, bool value) {} 344 void addBoolAttribute(AXBoolAttribute attribute, bool value) {
345 // Implement this when we add the first sparse bool attribute.
346 }
345 347
346 void addStringAttribute(AXStringAttribute attribute, const String& value) {} 348 void addStringAttribute(AXStringAttribute attribute, const String& value) {
349 switch (attribute) {
350 case AXStringAttribute::AriaKeyShortcuts:
351 m_properties.addItem(
352 createProperty(AXGlobalStatesEnum::Keyshortcuts,
353 createValue(value, AXValueTypeEnum::String)));
354 break;
355 case AXStringAttribute::AriaRoleDescription:
356 m_properties.addItem(
357 createProperty(AXGlobalStatesEnum::Roledescription,
358 createValue(value, AXValueTypeEnum::String)));
359 break;
360 }
361 }
347 362
348 void addObjectAttribute(AXObjectAttribute attribute, AXObject& object) { 363 void addObjectAttribute(AXObjectAttribute attribute, AXObject& object) {
349 switch (attribute) { 364 switch (attribute) {
350 case AXObjectAttribute::AriaActiveDescendant: 365 case AXObjectAttribute::AriaActiveDescendant:
351 m_properties.addItem( 366 m_properties.addItem(
352 createProperty(AXRelationshipAttributesEnum::Activedescendant, 367 createProperty(AXRelationshipAttributesEnum::Activedescendant,
353 createRelatedNodeListValue(object))); 368 createRelatedNodeListValue(object)));
354 break; 369 break;
370 case AXObjectAttribute::AriaErrorMessage:
371 m_properties.addItem(
372 createProperty(AXRelationshipAttributesEnum::Errormessage,
373 createRelatedNodeListValue(object)));
374 break;
355 } 375 }
356 } 376 }
357 377
358 void addObjectVectorAttribute(AXObjectVectorAttribute attribute, 378 void addObjectVectorAttribute(AXObjectVectorAttribute attribute,
359 HeapVector<Member<AXObject>>& objects) { 379 HeapVector<Member<AXObject>>& objects) {
360 switch (attribute) { 380 switch (attribute) {
361 case AXObjectVectorAttribute::AriaControls: 381 case AXObjectVectorAttribute::AriaControls:
362 m_properties.addItem(createRelatedNodeListProperty( 382 m_properties.addItem(createRelatedNodeListProperty(
363 AXRelationshipAttributesEnum::Controls, objects, aria_controlsAttr, 383 AXRelationshipAttributesEnum::Controls, objects, aria_controlsAttr,
364 *m_axObject)); 384 *m_axObject));
365 break; 385 break;
386 case AXObjectVectorAttribute::AriaDetails:
387 m_properties.addItem(createRelatedNodeListProperty(
388 AXRelationshipAttributesEnum::Details, objects, aria_controlsAttr,
389 *m_axObject));
390 break;
366 case AXObjectVectorAttribute::AriaFlowTo: 391 case AXObjectVectorAttribute::AriaFlowTo:
367 m_properties.addItem(createRelatedNodeListProperty( 392 m_properties.addItem(createRelatedNodeListProperty(
368 AXRelationshipAttributesEnum::Flowto, objects, aria_flowtoAttr, 393 AXRelationshipAttributesEnum::Flowto, objects, aria_flowtoAttr,
369 *m_axObject)); 394 *m_axObject));
370 break; 395 break;
371 } 396 }
372 } 397 }
373 }; 398 };
374 399
375 void fillRelationships(AXObject& axObject, 400 void fillRelationships(AXObject& axObject,
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 } 733 }
709 } 734 }
710 735
711 DEFINE_TRACE(InspectorAccessibilityAgent) { 736 DEFINE_TRACE(InspectorAccessibilityAgent) {
712 visitor->trace(m_page); 737 visitor->trace(m_page);
713 visitor->trace(m_domAgent); 738 visitor->trace(m_domAgent);
714 InspectorBaseAgent::trace(visitor); 739 InspectorBaseAgent::trace(visitor);
715 } 740 }
716 741
717 } // namespace blink 742 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXObject.h ('k') | third_party/WebKit/Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698