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

Unified Diff: third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp

Issue 2351443003: Revert of Show ancestor hierarchy in accessibility panel (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
index 0fd6451ccd12e5bc8d57ce992e545a28275817f7..c1762d60d37ab82fa0aad7b88924a6452b53e707 100644
--- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
@@ -8,7 +8,6 @@
#include "core/dom/AXObjectCache.h"
#include "core/dom/DOMNodeIds.h"
#include "core/dom/Element.h"
-#include "core/inspector/IdentifiersFactory.h"
#include "core/inspector/InspectorDOMAgent.h"
#include "core/inspector/InspectorStyleSheet.h"
#include "core/page/Page.h"
@@ -301,7 +300,7 @@
return roleNameValue;
}
-std::unique_ptr<AXNode> buildObjectForIgnoredNode(Node* node, const AXObject* axObject)
+std::unique_ptr<AXNode> buildObjectForIgnoredNode(Node* node, AXObject* axObject, AXObjectCacheImpl* cacheImpl)
{
AXObject::IgnoredReasons ignoredReasons;
@@ -312,7 +311,7 @@
axID = axObject->axObjectID();
AccessibilityRole role = axObject->roleValue();
ignoredNodeObject->setRole(createRoleNameValue(role));
- } else if (node && !node->layoutObject()) {
+ } else if (!node->layoutObject()) {
ignoredReasons.append(IgnoredReason(AXNotRendered));
}
@@ -324,18 +323,11 @@
return ignoredNodeObject;
}
-std::unique_ptr<AXNode> buildProtocolAXObject(AXObject* axObject)
+std::unique_ptr<AXNode> buildObjectForNode(Node* node, AXObject* axObject, AXObjectCacheImpl* cacheImpl, std::unique_ptr<protocol::Array<AXProperty>> properties)
{
AccessibilityRole role = axObject->roleValue();
std::unique_ptr<AXNode> nodeObject = AXNode::create().setNodeId(String::number(axObject->axObjectID())).setIgnored(false).build();
nodeObject->setRole(createRoleNameValue(role));
-
- std::unique_ptr<protocol::Array<AXProperty>> properties = protocol::Array<AXProperty>::create();
- fillLiveRegionProperties(axObject, properties.get());
- fillGlobalStates(axObject, properties.get());
- fillWidgetProperties(axObject, properties.get());
- fillWidgetStates(axObject, properties.get());
- fillRelationships(axObject, properties.get());
AXObject::NameSources nameSources;
String computedName = axObject->name(&nameSources);
@@ -372,41 +364,41 @@
{
}
-void InspectorAccessibilityAgent::getAXNodeChain(ErrorString* errorString, int domNodeId, bool fetchAncestors, std::unique_ptr<protocol::Array<protocol::Accessibility::AXNode>>* nodes)
-{
+void InspectorAccessibilityAgent::getAXNode(ErrorString* errorString, int nodeId, Maybe<AXNode>* accessibilityNode)
+{
+ Frame* mainFrame = m_page->mainFrame();
+ if (!mainFrame->isLocalFrame()) {
+ *errorString = "Can't inspect out of process frames yet";
+ return;
+ }
+
if (!m_domAgent->enabled()) {
*errorString = "DOM agent must be enabled";
return;
}
- Node* node = m_domAgent->assertNode(errorString, domNodeId);
+ Node* node = m_domAgent->assertNode(errorString, nodeId);
if (!node)
return;
Document& document = node->document();
document.updateStyleAndLayoutIgnorePendingStylesheets();
DocumentLifecycle::DisallowTransitionScope disallowTransition(document.lifecycle());
- LocalFrame* localFrame = document.frame();
- if (!localFrame) {
- *errorString = "Frame is detached.";
+ std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document);
+ AXObjectCacheImpl* cacheImpl = toAXObjectCacheImpl(cache->get());
+ AXObject* axObject = cacheImpl->getOrCreate(node);
+ if (!axObject || axObject->accessibilityIsIgnored()) {
+ *accessibilityNode = buildObjectForIgnoredNode(node, axObject, cacheImpl);
return;
}
- std::unique_ptr<ScopedAXObjectCache> scopedCache = ScopedAXObjectCache::create(document);
- AXObjectCacheImpl* cache = toAXObjectCacheImpl(scopedCache->get());
- AXObject* axObject = cache->getOrCreate(node);
- *nodes = protocol::Array<protocol::Accessibility::AXNode>::create();
- if (!axObject || axObject->accessibilityIsIgnored()) {
- (*nodes)->addItem(buildObjectForIgnoredNode(node, axObject));
- } else {
- (*nodes)->addItem(buildProtocolAXObject(axObject));
- }
-
- if (fetchAncestors && axObject) {
- AXObject* parent = axObject->parentObjectUnignored();
- while (parent) {
- (*nodes)->addItem(buildProtocolAXObject(parent));
- parent = parent->parentObjectUnignored();
- }
- }
+
+ std::unique_ptr<protocol::Array<AXProperty>> properties = protocol::Array<AXProperty>::create();
+ fillLiveRegionProperties(axObject, properties.get());
+ fillGlobalStates(axObject, properties.get());
+ fillWidgetProperties(axObject, properties.get());
+ fillWidgetStates(axObject, properties.get());
+ fillRelationships(axObject, properties.get());
+
+ *accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, std::move(properties));
}
DEFINE_TRACE(InspectorAccessibilityAgent)
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698