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 "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" |
11 #include "core/inspector/InspectorDOMAgent.h" | 11 #include "core/inspector/InspectorDOMAgent.h" |
12 #include "core/inspector/InspectorStyleSheet.h" | 12 #include "core/inspector/InspectorStyleSheet.h" |
13 #include "core/page/Page.h" | 13 #include "core/page/Page.h" |
14 #include "modules/accessibility/AXObject.h" | 14 #include "modules/accessibility/AXObject.h" |
15 #include "modules/accessibility/AXObjectCacheImpl.h" | 15 #include "modules/accessibility/AXObjectCacheImpl.h" |
16 #include "modules/accessibility/InspectorTypeBuilderHelper.h" | 16 #include "modules/accessibility/InspectorTypeBuilderHelper.h" |
17 #include "platform/inspector_protocol/Values.h" | 17 #include "platform/inspector_protocol/Values.h" |
| 18 #include <memory> |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
20 | 21 |
21 using protocol::Accessibility::AXGlobalStates; | 22 using protocol::Accessibility::AXGlobalStates; |
22 using protocol::Accessibility::AXLiveRegionAttributes; | 23 using protocol::Accessibility::AXLiveRegionAttributes; |
23 using protocol::Accessibility::AXNode; | 24 using protocol::Accessibility::AXNode; |
24 using protocol::Accessibility::AXNodeId; | 25 using protocol::Accessibility::AXNodeId; |
25 using protocol::Accessibility::AXProperty; | 26 using protocol::Accessibility::AXProperty; |
26 using protocol::Accessibility::AXValueSource; | 27 using protocol::Accessibility::AXValueSource; |
27 using protocol::Accessibility::AXValueType; | 28 using protocol::Accessibility::AXValueType; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 375 |
375 if (!m_domAgent->enabled()) { | 376 if (!m_domAgent->enabled()) { |
376 *errorString = "DOM agent must be enabled"; | 377 *errorString = "DOM agent must be enabled"; |
377 return; | 378 return; |
378 } | 379 } |
379 Node* node = m_domAgent->assertNode(errorString, nodeId); | 380 Node* node = m_domAgent->assertNode(errorString, nodeId); |
380 if (!node) | 381 if (!node) |
381 return; | 382 return; |
382 | 383 |
383 Document& document = node->document(); | 384 Document& document = node->document(); |
384 OwnPtr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document); | 385 std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(doc
ument); |
385 AXObjectCacheImpl* cacheImpl = toAXObjectCacheImpl(cache->get()); | 386 AXObjectCacheImpl* cacheImpl = toAXObjectCacheImpl(cache->get()); |
386 AXObject* axObject = cacheImpl->getOrCreate(node); | 387 AXObject* axObject = cacheImpl->getOrCreate(node); |
387 if (!axObject || axObject->accessibilityIsIgnored()) { | 388 if (!axObject || axObject->accessibilityIsIgnored()) { |
388 *accessibilityNode = buildObjectForIgnoredNode(node, axObject, cacheImpl
); | 389 *accessibilityNode = buildObjectForIgnoredNode(node, axObject, cacheImpl
); |
389 return; | 390 return; |
390 } | 391 } |
391 | 392 |
392 std::unique_ptr<protocol::Array<AXProperty>> properties = protocol::Array<AX
Property>::create(); | 393 std::unique_ptr<protocol::Array<AXProperty>> properties = protocol::Array<AX
Property>::create(); |
393 fillLiveRegionProperties(axObject, properties.get()); | 394 fillLiveRegionProperties(axObject, properties.get()); |
394 fillGlobalStates(axObject, properties.get()); | 395 fillGlobalStates(axObject, properties.get()); |
395 fillWidgetProperties(axObject, properties.get()); | 396 fillWidgetProperties(axObject, properties.get()); |
396 fillWidgetStates(axObject, properties.get()); | 397 fillWidgetStates(axObject, properties.get()); |
397 fillRelationships(axObject, properties.get()); | 398 fillRelationships(axObject, properties.get()); |
398 | 399 |
399 *accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, std::move
(properties)); | 400 *accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, std::move
(properties)); |
400 } | 401 } |
401 | 402 |
402 DEFINE_TRACE(InspectorAccessibilityAgent) | 403 DEFINE_TRACE(InspectorAccessibilityAgent) |
403 { | 404 { |
404 visitor->trace(m_page); | 405 visitor->trace(m_page); |
405 visitor->trace(m_domAgent); | 406 visitor->trace(m_domAgent); |
406 InspectorBaseAgent::trace(visitor); | 407 InspectorBaseAgent::trace(visitor); |
407 } | 408 } |
408 | 409 |
409 } // namespace blink | 410 } // namespace blink |
OLD | NEW |