Commit 21dc754b authored by David Tseng's avatar David Tseng Committed by Commit Bot

Partial revert: Fixes performance of Google Calendar + ChromeVox/automation

This is a small partial revert of
https://chromium-review.googlesource.com/c/chromium/src/+/1947643

The check in desktop_automation_handler.js -> range_automation_handler.js onEventIfInRange helped prevent processing of repeated attribute changes that come from the subtree of ChromeVox's current range.

For example, Gmail's threadlist where focus is on a row. Any attribute changes within cells or on individual cells caused output.

TBR=dmazzoni@chromium.org

Change-Id: I696cd506a2c8d33bfa343d36df76f7551c79bb56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1951085Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721587}
parent 19d2de0e
...@@ -83,35 +83,39 @@ RangeAutomationHandler.prototype = { ...@@ -83,35 +83,39 @@ RangeAutomationHandler.prototype = {
return; return;
} }
var prevTarget = this.lastAttributeTarget_; // TODO: we need more fine grained filters for attribute changes.
if (prev.contentEquals(cursors.Range.fromNode(evt.target)) ||
// Re-target to active descendant if it exists. evt.target.state.focused) {
var prevOutput = this.lastAttributeOutput_; var prevTarget = this.lastAttributeTarget_;
this.lastAttributeTarget_ = evt.target.activeDescendant || evt.target;
this.lastAttributeOutput_ = new Output().withRichSpeechAndBraille( // Re-target to active descendant if it exists.
cursors.Range.fromNode(this.lastAttributeTarget_), prev, var prevOutput = this.lastAttributeOutput_;
Output.EventType.NAVIGATE); this.lastAttributeTarget_ = evt.target.activeDescendant || evt.target;
if (this.lastAttributeTarget_ == prevTarget && prevOutput && this.lastAttributeOutput_ = new Output().withRichSpeechAndBraille(
prevOutput.equals(this.lastAttributeOutput_)) { cursors.Range.fromNode(this.lastAttributeTarget_), prev,
return; Output.EventType.NAVIGATE);
} if (this.lastAttributeTarget_ == prevTarget && prevOutput &&
prevOutput.equals(this.lastAttributeOutput_)) {
// If the target or an ancestor is controlled by another control, we may
// want to delay the output.
var maybeControlledBy = evt.target;
while (maybeControlledBy) {
if (maybeControlledBy.controlledBy.length &&
maybeControlledBy.controlledBy.find((n) => !!n.autoComplete)) {
clearTimeout(this.delayedAttributeOutputId_);
this.delayedAttributeOutputId_ = setTimeout(() => {
this.lastAttributeOutput_.go();
}, DesktopAutomationHandler.ATTRIBUTE_DELAY_MS);
return; return;
} }
maybeControlledBy = maybeControlledBy.parent;
}
this.lastAttributeOutput_.go(); // If the target or an ancestor is controlled by another control, we may
// want to delay the output.
var maybeControlledBy = evt.target;
while (maybeControlledBy) {
if (maybeControlledBy.controlledBy.length &&
maybeControlledBy.controlledBy.find((n) => !!n.autoComplete)) {
clearTimeout(this.delayedAttributeOutputId_);
this.delayedAttributeOutputId_ = setTimeout(() => {
this.lastAttributeOutput_.go();
}, DesktopAutomationHandler.ATTRIBUTE_DELAY_MS);
return;
}
maybeControlledBy = maybeControlledBy.parent;
}
this.lastAttributeOutput_.go();
}
}, },
/** /**
......
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