Commit 6807dd3f authored by Katie D's avatar Katie D Committed by Commit Bot

Fix accessibility_common closure, add to closure_compile rule.

Bug: 1108171
Change-Id: I037f79720373b1d5d948109bbc283aeea2b8807e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2313379
Commit-Queue: Achuith Bhandarkar <achuith@chromium.org>
Auto-Submit: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarAchuith Bhandarkar <achuith@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792158}
parent 98b8ad97
......@@ -36,6 +36,7 @@ grit("multidevice_setup_resources") {
group("closure_compile") {
deps = [
"accessibility/accessibility_common:closure_compile",
"accessibility/braille_ime:closure_compile",
"accessibility/select_to_speak:closure_compile",
"accessibility/switch_access:closure_compile",
......
......@@ -73,15 +73,25 @@ js2gtest("accessibility_common_extjs_tests") {
]
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
}
#js_type_check("closure_compile") {
# deps = [ ":autoclick" ]
#}
#
# Doesn't build. See https://crbug.com/1108171.
#js_library("autoclick") {
# sources = [ "autoclick/autoclick.js" ]
# externs_list = [
# "$externs_path/accessibility_private.js",
# "$externs_path/automation.js",
# ]
#}
js_type_check("closure_compile") {
deps = [ ":accessibility_common" ]
}
js_library("accessibility_common") {
sources = [ "accessibility_common_loader.js" ]
deps = [ ":autoclick" ]
externs_list = [
"$externs_path/chrome_extensions.js",
"$externs_path/accessibility_private.js",
"$externs_path/automation.js",
]
}
js_library("autoclick") {
sources = [ "autoclick/autoclick.js" ]
externs_list = [
"$externs_path/accessibility_private.js",
"$externs_path/automation.js",
]
}
......@@ -17,7 +17,7 @@ class AccessibilityCommon {
}
/**
* @public {Autoclick}
* @return {Autoclick}
*/
getAutoclickForTest() {
return this.autoclick_;
......
......@@ -34,12 +34,12 @@ class Autoclick {
this.desktop_;
/**
* @private {function(number, number)}
* @private {?function(number, number)}
*/
this.scrollableBoundsListener_ = null;
/**
* @private {function(AutomationEvent)}
* @private {?function(!chrome.automation.AutomationEvent)}
*/
this.hitTestListener_ = null;
......@@ -52,16 +52,18 @@ class Autoclick {
/**
* Destructor to remove any listeners.
* @public
*/
onAutoclickDisabled() {
chrome.accessibilityPrivate.findScrollableBoundsForPoint.removeListener(
this.scrollableBoundsListener_);
this.scrollableBoundsListener_ = null;
if (this.scrollableBoundsListener_) {
chrome.accessibilityPrivate.findScrollableBoundsForPoint.removeListener(
this.scrollableBoundsListener_);
this.scrollableBoundsListener_ = null;
}
if (this.desktop_) {
if (this.desktop_ && this.hitTestListener_) {
this.desktop_.removeEventListener(
chrome.automation.EventType.MOUSE_PRESSED, this.hitTestListener_);
chrome.automation.EventType.MOUSE_PRESSED, this.hitTestListener_,
true);
this.hitTestListener_ = null;
}
}
......@@ -71,12 +73,12 @@ class Autoclick {
* @private
*/
init_() {
this.hitTestListener_ = this.onAutomationHitTestResult_.bind(this);
this.scrollableBoundsListener_ =
this.findScrollingContainerForPoint_.bind(this);
chrome.automation.getDesktop((desktop) => {
this.desktop_ = desktop;
this.hitTestListener_ = this.onAutomationHitTestResult_.bind(this);
// We use a hit test at a point to determine what automation node is
// at that point, in order to find the scrollable area.
......@@ -126,6 +128,7 @@ class Autoclick {
* Processes an automation hit test result.
* @param {!chrome.automation.AutomationEvent} event The hit test result
* event.
* @private
*/
onAutomationHitTestResult_(event) {
// Walk up to the nearest scrollale area containing the point.
......@@ -170,6 +173,7 @@ class Autoclick {
* Initiates finidng the nearest scrolling container for the given point.
* @param {number} x
* @param {number} y
* @private
*/
findScrollingContainerForPoint_(x, y) {
// The hit test will come back through onAutmoationHitTestResult_,
......
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