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