ax_win: IAccessibleTextSelectionContainer::setSelections returns E_INVALIDARG
IAccessibleTextSelectionContainer::setSelections always returns
E_INVALIDARG despite given arguments.
AXScript test will be added in crrev.com/c/4057450 after all required
ax script win testing infrastructure is implemented.
Followup: crrev.com/c/3690092
Bug: 1298144
Change-Id: Id0e055b960bcd8f50180e63b8990c49d3af82780
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4057906
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1079751}
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc
index e258c4a..678ff1e 100644
--- a/ui/accessibility/platform/ax_platform_node_win.cc
+++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -4547,8 +4547,10 @@
IA2TextSelection* selections) {
AXPlatformNode::NotifyAddAXModeFlags(kScreenReaderAndHTMLAccessibilityModes);
- COM_OBJECT_VALIDATE_1_ARG(selections);
- if (nSelections != 1)
+ COM_OBJECT_VALIDATE();
+
+ // Chromium does not currently support more than one selection.
+ if (nSelections != 1 || !selections)
return E_INVALIDARG;
if (!selections->startObj || !selections->endObj)
@@ -4575,7 +4577,7 @@
AXPosition end_position =
end_node->HypertextOffsetToEndpoint(selections->endOffset)
->AsDomSelectionPosition();
- if (!start_position->IsNullPosition() || end_position->IsNullPosition())
+ if (start_position->IsNullPosition() || end_position->IsNullPosition())
return E_INVALIDARG;
AXActionData action_data;