Commit fd3cd0f9 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Fix performance issues in Google Sheets

- when firing an active descendant change event on a content editable, we were
  serializing line breaks which took approximately ~600MS. The line break
  calculation was not only slow, but wrong (got stuck and put repeated new lines
  at the same offset). Unfortunately, <textarea> still needs line break
  information, so keeping for the !richlyEditable but editable case.

- Sheets sends empty strings through the ChromeVox Classic speak api. This
  should never be allowed. It causes ChromeVox output to be flushed and stopped.

- value changes get fired on root web area. Root web areas usually have '' as
  their values. This also caused output to be prematurely cut off.

Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ide73784a23db7bc92aef51de917801dab439dbba
Reviewed-on: https://chromium-review.googlesource.com/964781Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543589}
parent 8d3cdfe3
......@@ -283,6 +283,12 @@ cvox.ChromeVoxBackground.prototype.injectChromeVoxIntoTabs = function(tabs) {
*/
cvox.ChromeVoxBackground.prototype.onTtsMessage = function(msg) {
if (msg['action'] == 'speak') {
// The only caller sending this message is a ChromeVox Classic api client.
// Disallow empty strings.
if (msg['text'] == '') {
return;
}
this.tts.speak(
msg['text'],
/** cvox.QueueMode */ msg['queueMode'], msg['properties']);
......
......@@ -192,11 +192,6 @@ DesktopAutomationHandler.prototype = {
* @param {!AutomationEvent} evt
*/
onAriaAttributeChanged: function(evt) {
if (evt.target.activeDescendant) {
this.onActiveDescendantChanged(evt);
return;
}
if (evt.target.state.editable)
return;
this.onEventIfInRange(evt);
......@@ -306,8 +301,6 @@ DesktopAutomationHandler.prototype = {
.withBraille(curRange, curRange, Output.EventType.NAVIGATE)
.go();
}
this.onActiveDescendantChanged(evt);
},
/**
......@@ -434,6 +427,10 @@ DesktopAutomationHandler.prototype = {
* @param {!AutomationEvent} evt
*/
onValueChanged: function(evt) {
// Skip root web areas.
if (evt.target.role == RoleType.ROOT_WEB_AREA)
return;
// Skip all unfocused text fields.
if (!evt.target.state[StateType.FOCUSED] &&
evt.target.state[StateType.EDITABLE])
......
......@@ -914,15 +914,17 @@ void BlinkAXTreeSource::SerializeNode(WebAXObject src,
#if defined(OS_CHROMEOS)
// This attribute will soon be deprecated; see crbug.com/669134.
WebVector<int> src_line_breaks;
src.LineBreaks(src_line_breaks);
if (src_line_breaks.size()) {
std::vector<int32_t> line_breaks;
line_breaks.reserve(src_line_breaks.size());
for (size_t i = 0; i < src_line_breaks.size(); ++i)
line_breaks.push_back(src_line_breaks[i]);
dst->AddIntListAttribute(ax::mojom::IntListAttribute::kLineBreaks,
line_breaks);
if (src.IsEditable() && !src.IsRichlyEditable()) {
WebVector<int> src_line_breaks;
src.LineBreaks(src_line_breaks);
if (src_line_breaks.size()) {
std::vector<int32_t> line_breaks;
line_breaks.reserve(src_line_breaks.size());
for (size_t i = 0; i < src_line_breaks.size(); ++i)
line_breaks.push_back(src_line_breaks[i]);
dst->AddIntListAttribute(ax::mojom::IntListAttribute::kLineBreaks,
line_breaks);
}
}
#endif // defined OS_CHROMEOS
}
......
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