Commit eb7bdfff authored by Hiroki Sato's avatar Hiroki Sato Committed by Commit Bot

Don't update range on LiveRegionUpdated.

This is a follow-up of httep://crrev/c/1964835.

This changes
1. rename DesktopAutomationHandler.onEventFromView to
   onLiveRegionChanged because this method is now not only from Views
   but also from ARC's live region change.

2. When LIVE_REGION_CHANGED event is handled, do not uodate focus range.

Bug: none
Change-Id: I2923e217f0177395bb5e2e4b7b34726a9408ccce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2056168
Commit-Queue: Hiroki Sato <hirokisato@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742503}
parent 987d5c05
......@@ -16,9 +16,7 @@ goog.require('CustomAutomationEvent');
goog.require('editing.TextEditHandler');
goog.scope(function() {
const AutomationEvent = chrome.automation.AutomationEvent;
const AutomationNode = chrome.automation.AutomationNode;
const Dir = constants.Dir;
const EventType = chrome.automation.EventType;
const RoleType = chrome.automation.RoleType;
const StateType = chrome.automation.StateType;
......@@ -66,7 +64,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
// Note that live region changes from views are really announcement
// events. Their target nodes contain no live region semantics and have no
// relation to live regions which are supported in |LiveRegions|.
this.addListener_(EventType.LIVE_REGION_CHANGED, this.onEventFromViews);
this.addListener_(EventType.LIVE_REGION_CHANGED, this.onLiveRegionChanged);
this.addListener_(EventType.LOAD_COMPLETE, this.onLoadComplete);
this.addListener_(EventType.MENU_END, this.onMenuEnd);
......@@ -100,16 +98,6 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
return false;
}
/**
* @param {!ChromeVoxEvent} evt
*/
onEventFromViews(evt) {
if (evt.target.root.role == RoleType.DESKTOP ||
evt.target.root.role == RoleType.APPLICATION) {
this.onEventDefault(evt);
}
}
/**
* Handles the result of a hit test.
* @param {!AutomationNode} node The hit result.
......@@ -293,6 +281,32 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
this.createTextEditHandlerIfNeeded_(node);
}
/**
* @param {!ChromeVoxEvent} evt
*/
onLiveRegionChanged(evt) {
if (evt.target.root.role == RoleType.DESKTOP ||
evt.target.root.role == RoleType.APPLICATION) {
if (evt.target.containerLiveStatus != 'assertive' &&
evt.target.containerLiveStatus != 'polite') {
return;
}
const output = new Output();
if (evt.target.containerLiveStatus == 'assertive') {
output.withQueueMode(QueueMode.CATEGORY_FLUSH);
} else {
output.withQueueMode(QueueMode.QUEUE);
}
output
.withRichSpeechAndBraille(
cursors.Range.fromNode(evt.target), null, evt.type)
.withSpeechCategory(TtsCategory.LIVE)
.go();
}
}
/**
* Provides all feedback once a load complete event fires.
* @param {!ChromeVoxEvent} evt
......
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