Commit db2ec9ce authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Revert "Fire focus if needed in automation api"

This reverts commit 9af30c03.

Reason for revert: breaks Linux ChromiumOS Tests.

Bug: 776308

Original change's description:
> Fire focus if needed in automation api
> 
> Bug: 773866
> 
> Change-Id: I4e7295137141fa4f1605247cafb3bc4d40a09a59
> Reviewed-on: https://chromium-review.googlesource.com/723606
> Commit-Queue: David Tseng <dtseng@chromium.org>
> Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#509911}

TBR=dmazzoni@chromium.org,dtseng@chromium.org

Change-Id: Ifb8e4267a85f573aae5891bc9916c8a2c6e33a7c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 773866
Reviewed-on: https://chromium-review.googlesource.com/727982Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510044}
parent 407734c2
...@@ -285,7 +285,11 @@ automationInternal.onNodesRemoved.addListener(function(treeID, nodeIDs) { ...@@ -285,7 +285,11 @@ automationInternal.onNodesRemoved.addListener(function(treeID, nodeIDs) {
automationInternal.onAccessibilityEvent.addListener(function(eventParams) { automationInternal.onAccessibilityEvent.addListener(function(eventParams) {
var id = eventParams.treeID; var id = eventParams.treeID;
var targetTree = AutomationRootNode.getOrCreate(id); var targetTree = AutomationRootNode.getOrCreate(id);
if (eventParams.eventType == 'blur') {
var isFocusEvent = false;
if (eventParams.eventType == 'focus') {
isFocusEvent = true;
} else if (eventParams.eventType == 'blur') {
// Work around an issue where Chrome sends us 'blur' events on the // Work around an issue where Chrome sends us 'blur' events on the
// root node when nothing has focus, we need to treat those as focus // root node when nothing has focus, we need to treat those as focus
// events but otherwise not handle blur events specially. // events but otherwise not handle blur events specially.
...@@ -296,31 +300,27 @@ automationInternal.onAccessibilityEvent.addListener(function(eventParams) { ...@@ -296,31 +300,27 @@ automationInternal.onAccessibilityEvent.addListener(function(eventParams) {
eventParams.eventType == 'mediaStoppedPlaying') { eventParams.eventType == 'mediaStoppedPlaying') {
// These events are global to the tree. // These events are global to the tree.
eventParams.targetID = privates(targetTree).impl.id; eventParams.targetID = privates(targetTree).impl.id;
} else { }
// When we get a focus event, ignore the actual event target, and instead
// check what node has focus globally. If that represents a focus change,
// fire a focus event on the correct target.
if (isFocusEvent) {
var previousFocusedNode = automationUtil.focusedNode; var previousFocusedNode = automationUtil.focusedNode;
automationUtil.updateFocusedNode(); automationUtil.updateFocusedNode();
// Fire focus events if necessary.
if (automationUtil.focusedNode && if (automationUtil.focusedNode &&
automationUtil.focusedNode != previousFocusedNode) { automationUtil.focusedNode == previousFocusedNode) {
var eventParamsCopy = {}; return;
for (var key in eventParams) }
eventParamsCopy[key] = eventParams[key];
eventParamsCopy['eventType'] = 'focus'; if (automationUtil.focusedNode) {
eventParamsCopy['treeID'] = targetTree = automationUtil.focusedNode.root;
privates(automationUtil.focusedNode.root).impl.treeID; eventParams.treeID = privates(targetTree).impl.treeID;
eventParamsCopy['targetID'] = eventParams.targetID = privates(automationUtil.focusedNode).impl.id;
privates(automationUtil.focusedNode).impl.id;
privates(automationUtil.focusedNode.root)
.impl.onAccessibilityEvent(eventParamsCopy);
} }
} }
// Note that focus type events have already been handled above if there was a if (!privates(targetTree).impl.onAccessibilityEvent(eventParams))
// focused node. All other events, even non-focus events that triggered a
// focus dispatch, still need to have their original event fired.
if ((!automationUtil.focusedNode || eventParams.eventType != 'focus') &&
!privates(targetTree).impl.onAccessibilityEvent(eventParams))
return; return;
// If we're not waiting on a callback to getTree(), we can early out here. // If we're not waiting on a callback to getTree(), we can early out here.
......
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