Commit 60d9410d authored by Nektarios Paisios's avatar Nektarios Paisios Committed by Commit Bot

On Mac returns the previous line when between lines

If the provided text marker  is between lines, such as when on a soft line break
or on an ignored position that separates lines, we return the previous line when
VoiceOver asks for the line text marker range.
This is the same to how the WebKit code in Safari works.
See webcore/editing/VisibleUnits.cc::endOfLine(VisiblePosition&, LineEndpointComputationMode, bool) in the WebKit source code.

Also, this patch temporarily switches to CreateNextLineStartPosition for computing
the end of the line range. This should not have any drastic user
visible behavior change, but it's important to do
until CreatNextLineEndPosition is fixed to handle ignored positions.
Failure to introduce this workaround would delay fixing of line
navigation in Docs with VoiceOver.

R=dmazzoni@chromium.org

Bug: 1015408
Change-Id: Ifeb67d4de688fddace461568e064fc9768024fba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023277
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735945}
parent 5fed7d85
......@@ -3015,10 +3015,18 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
if (position->IsNullPosition())
return nil;
AXPlatformRange range(position->CreatePreviousLineStartPosition(
ui::AXBoundaryBehavior::StopIfAlreadyAtBoundary),
position->CreateNextLineEndPosition(
ui::AXBoundaryBehavior::StopIfAlreadyAtBoundary));
// If the initial position is between lines, e.g. if it is on a soft line
// break or on an ignored position that separates lines, we have to return
// the previous line. This is what Safari does.
//
// Note that hard line breaks are on a line of their own.
BrowserAccessibilityPositionInstance startPosition =
position->CreatePreviousLineStartPosition(
ui::AXBoundaryBehavior::StopIfAlreadyAtBoundary);
BrowserAccessibilityPositionInstance endPosition =
startPosition->CreateNextLineStartPosition(
ui::AXBoundaryBehavior::StopAtLastAnchorBoundary);
AXPlatformRange range(std::move(startPosition), std::move(endPosition));
return CreateTextMarkerRange(std::move(range));
}
......
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