Commit 48620707 authored by Sara Kato's avatar Sara Kato Committed by Commit Bot

Wire Tooltip Action

Android side change ag/6513593

Tooltip actions added in API28, in AccessibilityNodeInfo.
- ACTION_SHOW_TOOLTIP
- ACTION_HIDE_TOOLTIP
Wire these to Chrome side, by adding a new type of action to the automation API.

Test: manual (manually check that tooltip action is sent correctly)
Bug: b:77885472
Change-Id: I2f708a6646259fb38f5b10a4c9f1299ca91ea1ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1488401Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Sara Kato <sarakato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644675}
parent efd0f622
...@@ -547,6 +547,16 @@ void ArcAccessibilityHelperBridge::OnAction( ...@@ -547,6 +547,16 @@ void ArcAccessibilityHelperBridge::OnAction(
base::Unretained(this), data)); base::Unretained(this), data));
return; return;
} }
case ax::mojom::Action::kShowTooltip: {
action_data->action_type =
arc::mojom::AccessibilityActionType::SHOW_TOOLTIP;
break;
}
case ax::mojom::Action::kHideTooltip: {
action_data->action_type =
arc::mojom::AccessibilityActionType::HIDE_TOOLTIP;
break;
}
default: default:
return; return;
} }
......
...@@ -478,6 +478,12 @@ AutomationInternalPerformActionFunction::ConvertToAXActionData( ...@@ -478,6 +478,12 @@ AutomationInternalPerformActionFunction::ConvertToAXActionData(
action->end_index = get_text_location_params.end_index; action->end_index = get_text_location_params.end_index;
break; break;
} }
case api::automation::ACTION_TYPE_SHOWTOOLTIP:
action->action = ax::mojom::Action::kShowTooltip;
break;
case api::automation::ACTION_TYPE_HIDETOOLTIP:
action->action = ax::mojom::Action::kHideTooltip;
break;
case api::automation::ACTION_TYPE_ANNOTATEPAGEIMAGES: case api::automation::ACTION_TYPE_ANNOTATEPAGEIMAGES:
case api::automation::ACTION_TYPE_SIGNALENDOFTEST: case api::automation::ACTION_TYPE_SIGNALENDOFTEST:
case api::automation::ACTION_TYPE_NONE: case api::automation::ACTION_TYPE_NONE:
......
...@@ -295,6 +295,7 @@ ...@@ -295,6 +295,7 @@
focus, focus,
getImageData, getImageData,
getTextLocation, getTextLocation,
hideTooltip,
hitTest, hitTest,
increment, increment,
loadInlineTextBoxes, loadInlineTextBoxes,
...@@ -313,7 +314,8 @@ ...@@ -313,7 +314,8 @@
setSequentialFocusNavigationStartingPoint, setSequentialFocusNavigationStartingPoint,
setValue, setValue,
showContextMenu, showContextMenu,
signalEndOfTest signalEndOfTest,
showTooltip
}; };
// Possible changes to the automation tree. For any given atomic change // Possible changes to the automation tree. For any given atomic change
......
...@@ -82,6 +82,8 @@ enum AccessibilityActionType { ...@@ -82,6 +82,8 @@ enum AccessibilityActionType {
SHOW_ON_SCREEN, SHOW_ON_SCREEN,
CUSTOM_ACTION, // Not a standard action. CUSTOM_ACTION, // Not a standard action.
GET_TEXT_LOCATION, // Not a standard action. GET_TEXT_LOCATION, // Not a standard action.
SHOW_TOOLTIP,
HIDE_TOOLTIP,
}; };
// Possible boolean properties set on an AccessibilityNodeInfo. // Possible boolean properties set on an AccessibilityNodeInfo.
......
...@@ -741,6 +741,9 @@ void RenderAccessibilityImpl::OnPerformAction( ...@@ -741,6 +741,9 @@ void RenderAccessibilityImpl::OnPerformAction(
MarkAllAXObjectsDirty(ax::mojom::Role::kImage); MarkAllAXObjectsDirty(ax::mojom::Role::kImage);
} }
break; break;
case ax::mojom::Action::kShowTooltip:
case ax::mojom::Action::kHideTooltip:
break;
case ax::mojom::Action::kSignalEndOfTest: case ax::mojom::Action::kSignalEndOfTest:
// Wait for 100ms to allow pending events to come in // Wait for 100ms to allow pending events to come in
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
......
...@@ -302,6 +302,7 @@ chrome.automation.ActionType = { ...@@ -302,6 +302,7 @@ chrome.automation.ActionType = {
FOCUS: 'focus', FOCUS: 'focus',
GET_IMAGE_DATA: 'getImageData', GET_IMAGE_DATA: 'getImageData',
GET_TEXT_LOCATION: 'getTextLocation', GET_TEXT_LOCATION: 'getTextLocation',
HIDE_TOOLTIP: 'hideTooltip',
HIT_TEST: 'hitTest', HIT_TEST: 'hitTest',
INCREMENT: 'increment', INCREMENT: 'increment',
LOAD_INLINE_TEXT_BOXES: 'loadInlineTextBoxes', LOAD_INLINE_TEXT_BOXES: 'loadInlineTextBoxes',
...@@ -321,6 +322,7 @@ chrome.automation.ActionType = { ...@@ -321,6 +322,7 @@ chrome.automation.ActionType = {
SET_VALUE: 'setValue', SET_VALUE: 'setValue',
SHOW_CONTEXT_MENU: 'showContextMenu', SHOW_CONTEXT_MENU: 'showContextMenu',
SIGNAL_END_OF_TEST: 'signalEndOfTest', SIGNAL_END_OF_TEST: 'signalEndOfTest',
SHOW_TOOLTIP: 'showTooltip',
}; };
/** /**
......
...@@ -1107,6 +1107,10 @@ const char* ToString(ax::mojom::Action action) { ...@@ -1107,6 +1107,10 @@ const char* ToString(ax::mojom::Action action) {
return "annotatePageImages"; return "annotatePageImages";
case ax::mojom::Action::kSignalEndOfTest: case ax::mojom::Action::kSignalEndOfTest:
return "signalEndOfTest"; return "signalEndOfTest";
case ax::mojom::Action::kShowTooltip:
return "showTooltip";
case ax::mojom::Action::kHideTooltip:
return "hideTooltip";
} }
return ""; return "";
...@@ -1171,6 +1175,10 @@ ax::mojom::Action ParseAction(const char* action) { ...@@ -1171,6 +1175,10 @@ ax::mojom::Action ParseAction(const char* action) {
return ax::mojom::Action::kShowContextMenu; return ax::mojom::Action::kShowContextMenu;
if (0 == strcmp(action, "signalEndOfTest")) if (0 == strcmp(action, "signalEndOfTest"))
return ax::mojom::Action::kSignalEndOfTest; return ax::mojom::Action::kSignalEndOfTest;
if (0 == strcmp(action, "showTooltip"))
return ax::mojom::Action::kShowTooltip;
if (0 == strcmp(action, "hideTooltip"))
return ax::mojom::Action::kHideTooltip;
return ax::mojom::Action::kNone; return ax::mojom::Action::kNone;
} }
......
...@@ -348,6 +348,8 @@ enum Action { ...@@ -348,6 +348,8 @@ enum Action {
// Gets the bounding rect for a range of text. // Gets the bounding rect for a range of text.
kGetTextLocation, kGetTextLocation,
kHideTooltip,
// Given a point, find the object it corresponds to and fire a // Given a point, find the object it corresponds to and fire a
// |AXActionData.hit_test_event_to_fire| event on it in response. // |AXActionData.hit_test_event_to_fire| event on it in response.
kHitTest, kHitTest,
...@@ -402,6 +404,7 @@ enum Action { ...@@ -402,6 +404,7 @@ enum Action {
// Send an event signaling the end of a test. // Send an event signaling the end of a test.
kSignalEndOfTest, kSignalEndOfTest,
kShowTooltip,
}; };
enum ActionFlags { enum ActionFlags {
......
...@@ -652,6 +652,8 @@ ax::mojom::Action AXNodeData::AddAction(ax::mojom::Action action_enum) { ...@@ -652,6 +652,8 @@ ax::mojom::Action AXNodeData::AddAction(ax::mojom::Action action_enum) {
case ax::mojom::Action::kGetTextLocation: case ax::mojom::Action::kGetTextLocation:
case ax::mojom::Action::kAnnotatePageImages: case ax::mojom::Action::kAnnotatePageImages:
case ax::mojom::Action::kSignalEndOfTest: case ax::mojom::Action::kSignalEndOfTest:
case ax::mojom::Action::kHideTooltip:
case ax::mojom::Action::kShowTooltip:
break; break;
} }
......
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