Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/live_regions.js

Issue 2332103003: Define a minimum delay time for processing live regions on the same node. (Closed)
Patch Set: Change min same node ms to 20 ms. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/live_regions.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/live_regions.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/live_regions.js
index dced9842b0777b6b05522f6fb9f92166edaa9920..9c581fc646a1051c63f7efbc43f43f615bc54a0f 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/live_regions.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/live_regions.js
@@ -54,6 +54,14 @@ LiveRegions = function(chromeVoxState) {
LiveRegions.LIVE_REGION_QUEUE_TIME_MS = 500;
/**
+ * Live region events received on the same node in fewer than this many
+ * milliseconds will be dropped to avoid a stream of constant chatter.
+ * @type {number}
+ * @const
+ */
+LiveRegions.LIVE_REGION_MIN_SAME_NODE_MS = 20;
+
+/**
* Whether live regions from background tabs should be announced or not.
* @type {boolean}
* @private
@@ -135,14 +143,17 @@ LiveRegions.prototype = {
// the same time, otherwise flush previous live region updates.
var currentTime = new Date();
var queueTime = LiveRegions.LIVE_REGION_QUEUE_TIME_MS;
- if (currentTime - this.lastLiveRegionTime_ > queueTime) {
- this.liveRegionNodeSet_ = new WeakSet();
+ var delta = currentTime - this.lastLiveRegionTime_;
+ if (delta > queueTime) {
output.withQueueMode(cvox.QueueMode.CATEGORY_FLUSH);
this.lastLiveRegionTime_ = currentTime;
} else {
output.withQueueMode(cvox.QueueMode.QUEUE);
}
+ if (delta > LiveRegions.LIVE_REGION_MIN_SAME_NODE_MS)
+ this.liveRegionNodeSet_ = new WeakSet();
+
var parent = node;
while (parent) {
if (this.liveRegionNodeSet_.has(parent))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698