Commit 1b33428c authored by Josiah K's avatar Josiah K Committed by Commit Bot

Rename findScrollableBoundsForPoint to onScrollableBoundsForPointRequested

(Fixing accessibilityPrivate.on* names to only be used for events 2/3)

No functional changes - should be mechanical only.

AX-Relnotes: N/A
Change-Id: Ie31e44e0cdcce932865f2039c4cac5f9b6f9cb38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422651
Auto-Submit: Josiah Krutz <josiahk@google.com>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809574}
parent 6798b48d
......@@ -673,15 +673,15 @@ void AccessibilityManager::RequestAutoclickScrollableBoundsForPoint(
gfx::Point& point_in_screen) {
extensions::EventRouter* event_router =
extensions::EventRouter::Get(profile_);
std::unique_ptr<base::ListValue> event_args =
extensions::api::accessibility_private::FindScrollableBoundsForPoint::
Create(point_in_screen.x(), point_in_screen.y());
std::unique_ptr<base::ListValue> event_args = extensions::api::
accessibility_private::OnScrollableBoundsForPointRequested::Create(
point_in_screen.x(), point_in_screen.y());
std::unique_ptr<extensions::Event> event =
std::make_unique<extensions::Event>(
extensions::events::
ACCESSIBILITY_PRIVATE_FIND_SCROLLABLE_BOUNDS_FOR_POINT,
extensions::api::accessibility_private::FindScrollableBoundsForPoint::
kEventName,
extensions::api::accessibility_private::
OnScrollableBoundsForPointRequested::kEventName,
std::move(event_args));
event_router->DispatchEventWithLazyListener(
extension_misc::kAccessibilityCommonExtensionId, std::move(event));
......
......@@ -55,8 +55,8 @@ class Autoclick {
*/
onAutoclickDisabled() {
if (this.scrollableBoundsListener_) {
chrome.accessibilityPrivate.findScrollableBoundsForPoint.removeListener(
this.scrollableBoundsListener_);
chrome.accessibilityPrivate.onScrollableBoundsForPointRequested
.removeListener(this.scrollableBoundsListener_);
this.scrollableBoundsListener_ = null;
}
......@@ -87,7 +87,7 @@ class Autoclick {
true);
});
chrome.accessibilityPrivate.findScrollableBoundsForPoint.addListener(
chrome.accessibilityPrivate.onScrollableBoundsForPointRequested.addListener(
this.scrollableBoundsListener_);
}
......
......@@ -66,7 +66,7 @@ TEST_F('AutoclickE2ETest', 'HighlightsRootWebAreaIfNotScrollable', function() {
'data:text/html;charset=utf-8,<p>Cats rock!</p>', function(desktop) {
const node = desktop.find(
{role: 'staticText', attributes: {name: 'Cats rock!'}});
this.mockAccessibilityPrivate.callFindScrollableBoundsForPoint(
this.mockAccessibilityPrivate.callOnScrollableBoundsForPointRequested(
// Offset slightly into the node to ensure the hittest
// happens within the node.
node.location.left + 1, node.location.top + 1,
......@@ -92,7 +92,7 @@ TEST_F('AutoclickE2ETest', 'HighlightsScrollableDiv', function() {
role: 'staticText',
attributes: {name: 'cats rock! this text wraps and overflows!'}
});
this.mockAccessibilityPrivate.callFindScrollableBoundsForPoint(
this.mockAccessibilityPrivate.callOnScrollableBoundsForPointRequested(
// Offset slightly into the node to ensure the hittest happens
// within the node.
node.location.left + 1, node.location.top + 1,
......@@ -118,19 +118,20 @@ TEST_F('AutoclickE2ETest', 'RemovesAndAddsAutoclick', function() {
chrome.accessibilityFeatures.autoclick.set({value: true}, () => {
const node = desktop.find(
{role: 'staticText', attributes: {name: 'Cats rock!'}});
this.mockAccessibilityPrivate.callFindScrollableBoundsForPoint(
// Offset slightly into the node to ensure the hittest
// happens within the node.
node.location.left + 1, node.location.top + 1,
this.newCallback(() => {
const expected = node.root.location;
this.assertSameRect(
this.mockAccessibilityPrivate.getScrollableBounds(),
expected);
this.assertSameRect(
this.mockAccessibilityPrivate.getFocusRings()[0],
expected);
}));
this.mockAccessibilityPrivate
.callOnScrollableBoundsForPointRequested(
// Offset slightly into the node to ensure the hittest
// happens within the node.
node.location.left + 1, node.location.top + 1,
this.newCallback(() => {
const expected = node.root.location;
this.assertSameRect(
this.mockAccessibilityPrivate.getScrollableBounds(),
expected);
this.assertSameRect(
this.mockAccessibilityPrivate.getFocusRings()[0],
expected);
}));
});
});
});
......
......@@ -22,9 +22,9 @@ var MockAccessibilityPrivate = {
// Methods from AccessibilityPrivate API. //
findScrollableBoundsForPoint: {
onScrollableBoundsForPointRequested: {
/**
* Adds a listener to findScrollableBoundsForPoint.
* Adds a listener to onScrollableBoundsForPointRequested.
* @param {function<number, number>} listener
*/
addListener: (listener) => {
......@@ -73,7 +73,7 @@ var MockAccessibilityPrivate = {
* @param {number} y
* @param {!function<>} onScrollableBoundsForPointFoundCallback
*/
callFindScrollableBoundsForPoint:
callOnScrollableBoundsForPointRequested:
(x, y, onScrollableBoundsForPointFoundCallback) => {
onScrollableBoundsForPointFoundCallback_ =
onScrollableBoundsForPointFoundCallback;
......
......@@ -398,7 +398,7 @@
{
"name": "onScrollableBoundsForPointFound",
"type": "function",
"description": "Called by the Accessibility Common extension when findScrollableBoundsForPoint has found a scrolling container. |rect| will be the bounds of the nearest scrollable ancestor of the node at the point requested using findScrollableBoundsForPoint.",
"description": "Called by the Accessibility Common extension when onScrollableBoundsForPointRequested has found a scrolling container. |rect| will be the bounds of the nearest scrollable ancestor of the node at the point requested using onScrollableBoundsForPointRequested.",
"parameters": [
{
"name": "rect",
......@@ -522,7 +522,7 @@
"platforms": ["chromeos"]
},
{
"name": "findScrollableBoundsForPoint",
"name": "onScrollableBoundsForPointRequested",
"type": "function",
"description": "Fired when an internal component within accessibility wants to find the nearest scrolling container at a given screen coordinate. Used in Automatic Clicks.",
"parameters": [
......
......@@ -307,9 +307,9 @@ chrome.accessibilityPrivate.onSelectToSpeakStateChanged = function(state) {};
/**
* Called by the Accessibility Common extension when
* findScrollableBoundsForPoint has found a scrolling container. |rect| will be
* onScrollableBoundsForPointRequested has found a scrolling container. |rect| will be
* the bounds of the nearest scrollable ancestor of the node at the point
* requested using findScrollableBoundsForPoint.
* requested using onScrollableBoundsForPointRequested.
* @param {!chrome.accessibilityPrivate.ScreenRect} rect
*/
chrome.accessibilityPrivate.onScrollableBoundsForPointFound = function(rect) {};
......@@ -394,7 +394,7 @@ chrome.accessibilityPrivate.onAnnounceForAccessibility;
* Clicks.
* @type {!ChromeEvent}
*/
chrome.accessibilityPrivate.findScrollableBoundsForPoint;
chrome.accessibilityPrivate.onScrollableBoundsForPointRequested;
/**
* Fired when a custom spoken feedback on the active window gets enabled or
......
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