Commit 16893544 authored by Adam Ettenberger's avatar Adam Ettenberger Committed by Commit Bot

Low-hanging optimization for ITextRangeProvider::ExpandToEnclosingUnit

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

AXPlatformNodeTextRangeProviderWin::ExpandToEnclosingUnit for
TextUnit_Page only needs the |LowestCommonAnchor| to know the
result of |AXNode::OwnerTree()->HasPaginationSupport|.

Bug: 928948
Change-Id: Ida1926da0c1d54b2a9b57abd1867862daa4b4984
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815350
Commit-Queue: Adam Ettenberger <adettenb@microsoft.com>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#699032}
parent 4a14a571
......@@ -177,8 +177,8 @@ STDMETHODIMP AXPlatformNodeTextRangeProviderWin::ExpandToEnclosingUnit(
case TextUnit_Page: {
// If the document doesn't support pagination, default to document units
// per UIA spec
AXPositionInstance common_ancestor = start_->LowestCommonAncestor(*end_);
if (common_ancestor->GetAnchor()->tree()->HasPaginationSupport()) {
const AXNode* common_anchor = start_->LowestCommonAnchor(*end_);
if (common_anchor->tree()->HasPaginationSupport()) {
start_ = start_->CreatePreviousPageStartPosition(
ui::AXBoundaryBehavior::StopIfAlreadyAtBoundary);
end_ = start_->CreateNextPageEndPosition(
......
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