Commit 7ccbbbc8 authored by Alexander Surkov's avatar Alexander Surkov Committed by Commit Bot

ax_dump_tree: accessible objects are not populated properly on mac

Bug: 1124366
Change-Id: I14e9badd2bef2e5315e5893cbb4fae0a35b13e78
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2411702
Commit-Queue: Alexander Surkov <asurkov@igalia.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807859}
parent a2467a41
...@@ -347,7 +347,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateObject( ...@@ -347,7 +347,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateObject(
} }
// Accessible object // Accessible object
if ([value isKindOfClass:[BrowserAccessibilityCocoa class]]) { if (IsBrowserAccessibilityCocoa(value) || IsAXUIElement(value)) {
return base::Value(NodeToLineIndex(value, line_indexer)); return base::Value(NodeToLineIndex(value, line_indexer));
} }
...@@ -421,9 +421,9 @@ base::Value AccessibilityTreeFormatterMac::PopulateArray( ...@@ -421,9 +421,9 @@ base::Value AccessibilityTreeFormatterMac::PopulateArray(
} }
std::string AccessibilityTreeFormatterMac::NodeToLineIndex( std::string AccessibilityTreeFormatterMac::NodeToLineIndex(
id cocoa_node, id node,
const LineIndexer* line_indexer) const { const LineIndexer* line_indexer) const {
return kConstValuePrefix + line_indexer->IndexBy(cocoa_node); return kConstValuePrefix + line_indexer->IndexBy(node);
} }
std::string AccessibilityTreeFormatterMac::ProcessTreeForOutput( std::string AccessibilityTreeFormatterMac::ProcessTreeForOutput(
......
...@@ -166,8 +166,18 @@ LineIndexer::~LineIndexer() {} ...@@ -166,8 +166,18 @@ LineIndexer::~LineIndexer() {}
std::string LineIndexer::IndexBy(const gfx::NativeViewAccessible node) const { std::string LineIndexer::IndexBy(const gfx::NativeViewAccessible node) const {
std::string line_index = ":unknown"; std::string line_index = ":unknown";
if (map.find(node) != map.end()) { if (IsBrowserAccessibilityCocoa(node)) {
line_index = map.at(node); auto iter = map.find(node);
if (iter != map.end()) {
line_index = iter->second;
}
} else if (IsAXUIElement(node)) {
for (auto& iter : map) {
if (CFEqual(iter.first, node)) {
line_index = iter.second;
break;
}
}
} }
return line_index; return line_index;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment