Commit 4ec23149 authored by Adam Ettenberger's avatar Adam Ettenberger Committed by Commit Bot

Low-hanging optimization for ITextRangeProvider::GetChildren

|LowestCommonAnchor| is always cheaper than |LowestCommonAncestor|
when the ancestor position data is not needed.

AXPlatformNodeTextRangeProviderWin::GetChildren does not use the
position information, all information is available on the AXNode
from calling |LowestCommonAnchor|.

Bug: 928948
Change-Id: I48075202dca0172bfd6deea9188d3d636f996ac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815224
Commit-Queue: Adam Ettenberger <adettenb@microsoft.com>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#699033}
parent 16893544
...@@ -765,13 +765,10 @@ STDMETHODIMP AXPlatformNodeTextRangeProviderWin::GetChildren( ...@@ -765,13 +765,10 @@ STDMETHODIMP AXPlatformNodeTextRangeProviderWin::GetChildren(
std::vector<gfx::NativeViewAccessible> descendants; std::vector<gfx::NativeViewAccessible> descendants;
AXPositionInstance common_ancestor = const AXNode* common_anchor = start_->LowestCommonAnchor(*end_);
start_->LowestCommonAncestor(*end_.get()); const AXTreeID tree_id = common_anchor->tree()->GetAXTreeID();
const AXNode::AXID node_id = common_anchor->id();
AXPlatformNodeDelegate* delegate = AXPlatformNodeDelegate* delegate = GetDelegate(tree_id, node_id);
GetDelegate(common_ancestor.get())
->GetFromNodeID(common_ancestor->anchor_id())
->GetDelegate();
DCHECK(delegate); DCHECK(delegate);
while (ui::IsIgnored(delegate->GetData())) { while (ui::IsIgnored(delegate->GetData())) {
auto* node = static_cast<AXPlatformNodeWin*>( auto* node = static_cast<AXPlatformNodeWin*>(
......
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