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

Unified Diff: chrome/browser/resources/chromeos/chromevox/common/spannable.js

Issue 1039703002: Make contracted braille input work in more contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@docs2
Patch Set: Rebase Created 5 years, 7 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
Index: chrome/browser/resources/chromeos/chromevox/common/spannable.js
diff --git a/chrome/browser/resources/chromeos/chromevox/common/spannable.js b/chrome/browser/resources/chromeos/chromevox/common/spannable.js
index b4773e274a48f3a55a4f835ef1d8a88068d72180..293567ba4588078b595760281865cc421f5c85c7 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/spannable.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/spannable.js
@@ -69,6 +69,12 @@ cvox.Spannable.prototype.setSpan = function(value, start, end) {
// Zero-length spans are explicitly allowed, because it is possible to
// query for position by annotation as well as the reverse.
this.spans_.push({ value: value, start: start, end: end });
+ this.spans_.sort(function(a, b) {
+ var ret = a.start - b.start;
+ if (ret == 0)
+ ret = a.end - b.end;
+ return ret;
+ });
} else {
throw new RangeError('span out of range (start=' + start +
', end=' + end + ', len=' + this.string_.length + ')');
@@ -141,6 +147,8 @@ cvox.Spannable.prototype.getSpanInstanceOf = function(constructor) {
/**
* Returns all span values which are an instance of a given constructor.
+ * Spans are returned in the order of their starting index and ending index
+ * for spans with equals tarting indices.
* @param {!Function} constructor Constructor.
* @return {!Array<Object>} Array of object.
*/

Powered by Google App Engine
This is Rietveld 408576698