fix: Reland "[accessibility] Platform node lifetime cleanups" (#47590)

Reland "[accessibility] Platform node lifetime cleanups"

https://chromium-review.googlesource.com/c/chromium/src/+/6462552
This commit is contained in:
Charles Kerr
2025-06-29 14:57:48 -05:00
committed by GitHub
parent 61c245761c
commit 5e862f398e

View File

@@ -306,7 +306,8 @@ std::string RecursiveDumpAXPlatformNodeAsString(
return "";
}
std::string str(2 * indent, '+');
std::string line = node->GetDelegate()->GetData().ToString();
ui::AXPlatformNodeDelegate* const node_delegate = node->GetDelegate();
std::string line = node_delegate->GetData().ToString();
std::vector<std::string> attributes = base::SplitString(
line, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (const std::string& attribute : attributes) {
@@ -316,8 +317,9 @@ std::string RecursiveDumpAXPlatformNodeAsString(
}
}
str += "\n";
for (size_t i = 0; i < node->GetDelegate()->GetChildCount(); i++) {
gfx::NativeViewAccessible child = node->GetDelegate()->ChildAtIndex(i);
for (size_t i = 0, child_count = node_delegate->GetChildCount();
i < child_count; i++) {
gfx::NativeViewAccessible child = node_delegate->ChildAtIndex(i);
ui::AXPlatformNode* child_node =
ui::AXPlatformNode::FromNativeViewAccessible(child);
str += RecursiveDumpAXPlatformNodeAsString(child_node, indent + 1,