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) { ...@@ -283,6 +283,12 @@ cvox.ChromeVoxBackground.prototype.injectChromeVoxIntoTabs = function(tabs) {
*/ */
cvox.ChromeVoxBackground.prototype.onTtsMessage = function(msg) { cvox.ChromeVoxBackground.prototype.onTtsMessage = function(msg) {
if (msg['action'] == 'speak') { 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( this.tts.speak(
msg['text'], msg['text'],
/** cvox.QueueMode */ msg['queueMode'], msg['properties']); /** cvox.QueueMode */ msg['queueMode'], msg['properties']);
......
...@@ -192,11 +192,6 @@ DesktopAutomationHandler.prototype = { ...@@ -192,11 +192,6 @@ DesktopAutomationHandler.prototype = {
* @param {!AutomationEvent} evt * @param {!AutomationEvent} evt
*/ */
onAriaAttributeChanged: function(evt) { onAriaAttributeChanged: function(evt) {
if (evt.target.activeDescendant) {
this.onActiveDescendantChanged(evt);
return;
}
if (evt.target.state.editable) if (evt.target.state.editable)
return; return;
this.onEventIfInRange(evt); this.onEventIfInRange(evt);
...@@ -306,8 +301,6 @@ DesktopAutomationHandler.prototype = { ...@@ -306,8 +301,6 @@ DesktopAutomationHandler.prototype = {
.withBraille(curRange, curRange, Output.EventType.NAVIGATE) .withBraille(curRange, curRange, Output.EventType.NAVIGATE)
.go(); .go();
} }
this.onActiveDescendantChanged(evt);
}, },
/** /**
...@@ -434,6 +427,10 @@ DesktopAutomationHandler.prototype = { ...@@ -434,6 +427,10 @@ DesktopAutomationHandler.prototype = {
* @param {!AutomationEvent} evt * @param {!AutomationEvent} evt
*/ */
onValueChanged: function(evt) { onValueChanged: function(evt) {
// Skip root web areas.
if (evt.target.role == RoleType.ROOT_WEB_AREA)
return;
// Skip all unfocused text fields. // Skip all unfocused text fields.
if (!evt.target.state[StateType.FOCUSED] && if (!evt.target.state[StateType.FOCUSED] &&
evt.target.state[StateType.EDITABLE]) evt.target.state[StateType.EDITABLE])
......
...@@ -914,15 +914,17 @@ void BlinkAXTreeSource::SerializeNode(WebAXObject src, ...@@ -914,15 +914,17 @@ void BlinkAXTreeSource::SerializeNode(WebAXObject src,
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// This attribute will soon be deprecated; see crbug.com/669134. // This attribute will soon be deprecated; see crbug.com/669134.
WebVector<int> src_line_breaks; if (src.IsEditable() && !src.IsRichlyEditable()) {
src.LineBreaks(src_line_breaks); WebVector<int> src_line_breaks;
if (src_line_breaks.size()) { src.LineBreaks(src_line_breaks);
std::vector<int32_t> line_breaks; if (src_line_breaks.size()) {
line_breaks.reserve(src_line_breaks.size()); std::vector<int32_t> line_breaks;
for (size_t i = 0; i < src_line_breaks.size(); ++i) line_breaks.reserve(src_line_breaks.size());
line_breaks.push_back(src_line_breaks[i]); for (size_t i = 0; i < src_line_breaks.size(); ++i)
dst->AddIntListAttribute(ax::mojom::IntListAttribute::kLineBreaks, line_breaks.push_back(src_line_breaks[i]);
line_breaks); dst->AddIntListAttribute(ax::mojom::IntListAttribute::kLineBreaks,
line_breaks);
}
} }
#endif // defined OS_CHROMEOS #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