Reland: Port automation api js focus computations to C++

Fixes initializer for AXEventGenerator::event_from_.

TBR=nektar, katie
Original change

This change migrates focus/blur eventing from javascript to C++. This
moves the source focus state, and logic entirely to
AutomationInternalCustomBindings.

There are also some misc fixes:
  audited and corrected
AutomationAXTreeWrapper::OnAccessibilityEvents.  All early returns
need to clear generated events, but weren't.

ax::mojom::Event::kFocusContext is inapplicable on Chrome OS.  -
AutomationAXTreeWrapper::IsInFocusChain did not account correctly for
a detached tree (one that does not eventually have a desktop tree as
ancestor). In these cases, we need to always consider it focused,
given all other conditions apply. This can happen if we only have one
tree in automation tabs only mode.

fix some automation api
tests. This suite runs all tests without restarting the browser, so
all state is kept including focus states. We no longer re-fire focus
events, if the node is already focused, so tests need to set focus to
different nodes to get an event.

Test: comprehensive coverage exists in browser_tests
--gtest_filter=Automation*.* and --gtest_filter=ChromeVox*.*.

Change-Id: Ie79f9b77a82ca16c515e8c2f989c0e6e8e7684ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1621489
Reviewed-by: David Tseng <dtseng@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661614}
11 files changed