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

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

Issue 1435113003: Make use of new AX name calc in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue with ariaTextAlternative Created 5 years, 1 month 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 "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/HTMLNames.h" 9 #include "core/HTMLNames.h"
10 #include "core/dom/AXObjectCache.h" 10 #include "core/dom/AXObjectCache.h"
(...skipping 22 matching lines...) Expand all
33 using TypeBuilder::Accessibility::AXValue; 33 using TypeBuilder::Accessibility::AXValue;
34 using TypeBuilder::Accessibility::AXWidgetAttributes; 34 using TypeBuilder::Accessibility::AXWidgetAttributes;
35 using TypeBuilder::Accessibility::AXWidgetStates; 35 using TypeBuilder::Accessibility::AXWidgetStates;
36 36
37 using namespace HTMLNames; 37 using namespace HTMLNames;
38 38
39 namespace { 39 namespace {
40 40
41 void fillCoreProperties(AXObject* axObject, PassRefPtr<AXNode> nodeObject) 41 void fillCoreProperties(AXObject* axObject, PassRefPtr<AXNode> nodeObject)
42 { 42 {
43 // core properties 43 // Description (secondary to the accessible name).
44 String description = axObject->deprecatedAccessibilityDescription(); 44 AXNameFrom nameFrom;
45 AXObject::AXObjectVector nameObjects;
46 axObject->name(nameFrom, &nameObjects);
47 AXDescriptionFrom descriptionFrom;
48 AXObject::AXObjectVector descriptionObjects;
49 String description = axObject->description(nameFrom, descriptionFrom, &descr iptionObjects);
45 if (!description.isEmpty()) 50 if (!description.isEmpty())
46 nodeObject->setDescription(createValue(description, AXValueType::Compute dString)); 51 nodeObject->setDescription(createValue(description, AXValueType::Compute dString));
47 52
53 // Value.
48 if (axObject->supportsRangeValue()) { 54 if (axObject->supportsRangeValue()) {
49 nodeObject->setValue(createValue(axObject->valueForRange())); 55 nodeObject->setValue(createValue(axObject->valueForRange()));
50 } else { 56 } else {
51 String stringValue = axObject->stringValue(); 57 String stringValue = axObject->stringValue();
52 if (!stringValue.isEmpty()) 58 if (!stringValue.isEmpty())
53 nodeObject->setValue(createValue(stringValue)); 59 nodeObject->setValue(createValue(stringValue));
54 } 60 }
55
56 String help = axObject->deprecatedHelpText();
57 if (!help.isEmpty())
58 nodeObject->setHelp(createValue(help, AXValueType::ComputedString));
59 } 61 }
60 62
61 void fillLiveRegionProperties(AXObject* axObject, PassRefPtr<TypeBuilder::Array< AXProperty>> properties) 63 void fillLiveRegionProperties(AXObject* axObject, PassRefPtr<TypeBuilder::Array< AXProperty>> properties)
62 { 64 {
63 if (!axObject->liveRegionRoot()) 65 if (!axObject->liveRegionRoot())
64 return; 66 return;
65 67
66 properties->addItem(createProperty(AXLiveRegionAttributes::Live, createValue (axObject->containerLiveRegionStatus(), AXValueType::Token))); 68 properties->addItem(createProperty(AXLiveRegionAttributes::Live, createValue (axObject->containerLiveRegionStatus(), AXValueType::Token)));
67 properties->addItem(createProperty(AXLiveRegionAttributes::Atomic, createBoo leanValue(axObject->containerLiveRegionAtomic()))); 69 properties->addItem(createProperty(AXLiveRegionAttributes::Atomic, createBoo leanValue(axObject->containerLiveRegionAtomic())));
68 properties->addItem(createProperty(AXLiveRegionAttributes::Relevant, createV alue(axObject->containerLiveRegionRelevant(), AXValueType::TokenList))); 70 properties->addItem(createProperty(AXLiveRegionAttributes::Relevant, createV alue(axObject->containerLiveRegionRelevant(), AXValueType::TokenList)));
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 axObject->ariaFlowToElements(results); 267 axObject->ariaFlowToElements(results);
266 if (!results.isEmpty()) 268 if (!results.isEmpty())
267 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Flowto, results, aria_flowtoAttr, axObject)); 269 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Flowto, results, aria_flowtoAttr, axObject));
268 results.clear(); 270 results.clear();
269 271
270 axObject->ariaControlsElements(results); 272 axObject->ariaControlsElements(results);
271 if (!results.isEmpty()) 273 if (!results.isEmpty())
272 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Controls, results, aria_controlsAttr, axObject)); 274 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Controls, results, aria_controlsAttr, axObject));
273 results.clear(); 275 results.clear();
274 276
275 axObject->deprecatedAriaDescribedbyElements(results); 277 axObject->ariaDescribedbyElements(results);
276 if (!results.isEmpty()) 278 if (!results.isEmpty())
277 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Describedby, results, aria_describedbyAttr, axObject)); 279 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Describedby, results, aria_describedbyAttr, axObject));
278 results.clear(); 280 results.clear();
279 281
280 axObject->deprecatedAriaLabelledbyElements(results); 282 axObject->ariaLabelledbyElements(results);
281 if (!results.isEmpty()) 283 if (!results.isEmpty())
282 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Labelledby, results, aria_labelledbyAttr, axObject)); 284 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Labelledby, results, aria_labelledbyAttr, axObject));
283 results.clear(); 285 results.clear();
284 286
285 axObject->ariaOwnsElements(results); 287 axObject->ariaOwnsElements(results);
286 if (!results.isEmpty()) 288 if (!results.isEmpty())
287 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Owns, results, aria_ownsAttr, axObject)); 289 properties->addItem(createRelatedNodeListProperty(AXRelationshipAttribut es::Owns, results, aria_ownsAttr, axObject));
288 results.clear(); 290 results.clear();
289 } 291 }
290 292
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, properties ); 393 accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, properties );
392 } 394 }
393 395
394 DEFINE_TRACE(InspectorAccessibilityAgent) 396 DEFINE_TRACE(InspectorAccessibilityAgent)
395 { 397 {
396 visitor->trace(m_page); 398 visitor->trace(m_page);
397 InspectorBaseAgent::trace(visitor); 399 InspectorBaseAgent::trace(visitor);
398 } 400 }
399 401
400 } // namespace blink 402 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698