Commit 9198c247 authored by Nektarios Paisios's avatar Nektarios Paisios Committed by Chromium LUCI CQ

Do not return a selected text marker range if there is no selection

We should not be returning a text marker range with NULL AXPositions whenever there is nothing
selected on the webpage. Instead, like with all other text marker related attributes,
we should return nil.
Returning an AXRange with NULL AXPosition objects, makes VoiceOver hold onto and try to utilize NULL AXPositions
in later API calls. Such API calls inevitably fail due to the fact that
they are correctly considered invalid by our AXTextMarker deserialization logic.

AX-Relnotes: n/a.

R=abigailbklein@google.com, dmazzoni@chromium.org

Change-Id: Iafa561e21f44a44deca4b5fa1e1d83ced02f1cd0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581298
Auto-Submit: Nektarios Paisios <nektar@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835175}
parent 82b0946f
...@@ -2310,9 +2310,13 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) { ...@@ -2310,9 +2310,13 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
- (id)selectedTextMarkerRange { - (id)selectedTextMarkerRange {
if (![self instanceActive]) if (![self instanceActive])
return nil; return nil;
AXPlatformRange ax_range = GetSelectedRange(*_owner);
if (ax_range.IsNull())
return nil;
// Voiceover expects this range to be backwards in order to read the selected // Voiceover expects this range to be backwards in order to read the selected
// words correctly. // words correctly.
return CreateTextMarkerRange(GetSelectedRange(*_owner).AsBackwardRange()); return CreateTextMarkerRange(ax_range.AsBackwardRange());
} }
- (NSValue*)size { - (NSValue*)size {
......
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