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

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

Issue 2943193002: Run clang-format on .js files in c/b/r/chromeos/chromevox (Closed)
Patch Set: Created 3 years, 6 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 a27562107a92750646f47f04a20ac3c23fe4e622..e288b9cdfd747e934b78aed0b39878d1d024397e 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/spannable.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/spannable.js
@@ -37,7 +37,7 @@ Spannable = function(opt_string, opt_annotation) {
// Optionally annotate the entire string.
if (goog.isDef(opt_annotation)) {
var len = this.string_.length;
- this.spans_.push({ value: opt_annotation, start: 0, end: len });
+ this.spans_.push({value: opt_annotation, start: 0, end: len});
}
};
@@ -63,7 +63,7 @@ Spannable.prototype = {
if (0 <= start && start <= end && end <= this.string_.length) {
// 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_.push({value: value, start: start, end: end});
this.spans_.sort(function(a, b) {
var ret = a.start - b.start;
if (ret == 0)
@@ -71,8 +71,9 @@ Spannable.prototype = {
return ret;
});
} else {
- throw new RangeError('span out of range (start=' + start +
- ', end=' + end + ', len=' + this.string_.length + ')');
+ throw new RangeError(
+ 'span out of range (start=' + start + ', end=' + end +
+ ', len=' + this.string_.length + ')');
}
},
@@ -99,9 +100,7 @@ Spannable.prototype = {
this.string_ += otherSpannable.string_;
other.spans_.forEach(function(span) {
this.setSpan(
- span.value,
- span.start + originalLength,
- span.end + originalLength);
+ span.value, span.start + originalLength, span.end + originalLength);
}.bind(this));
} else if (typeof other === 'string') {
this.string_ += /** @type {string} */ (other);
@@ -134,8 +133,7 @@ Spannable.prototype = {
* @return {!Array<Object>} Array of object.
*/
getSpansInstanceOf: function(constructor) {
- return (this.spans_.filter(spanInstanceOf(constructor))
- .map(valueOfSpan));
+ return (this.spans_.filter(spanInstanceOf(constructor)).map(valueOfSpan));
},
/**
@@ -144,9 +142,7 @@ Spannable.prototype = {
* @return {!Array} Values annotating that position.
*/
getSpans: function(position) {
- return (this.spans_
- .filter(spanCoversPosition(position))
- .map(valueOfSpan));
+ return (this.spans_.filter(spanCoversPosition(position)).map(valueOfSpan));
},
/**
@@ -225,7 +221,7 @@ Spannable.prototype = {
if (span.start <= end && span.end >= start) {
var newStart = Math.max(0, span.start - start);
var newEnd = Math.min(end - start, span.end - start);
- result.spans_.push({ value: span.value, start: newStart, end: newEnd });
+ result.spans_.push({value: span.value, start: newStart, end: newEnd});
}
});
return result;
@@ -278,8 +274,8 @@ Spannable.prototype = {
// Otherwise, we have at least one non-whitespace character to use as an
// anchor when trimming.
var trimmedStart = trimStart ? this.string_.match(/^\s*/)[0].length : 0;
- var trimmedEnd = trimEnd ?
- this.string_.match(/\s*$/).index : this.string_.length;
+ var trimmedEnd =
+ trimEnd ? this.string_.match(/\s*$/).index : this.string_.length;
return this.substring(trimmedStart, trimmedEnd);
},
@@ -294,12 +290,14 @@ Spannable.prototype = {
result.string = this.string_;
result.spans = [];
this.spans_.forEach(function(span) {
- var serializeInfo = serializableSpansByConstructor.get(
- span.value.constructor);
+ var serializeInfo =
+ serializableSpansByConstructor.get(span.value.constructor);
if (serializeInfo) {
- var spanObj = {type: serializeInfo.name,
- start: span.start,
- end: span.end};
+ var spanObj = {
+ type: serializeInfo.name,
+ start: span.start,
+ end: span.end
+ };
if (serializeInfo.toJson) {
spanObj.value = serializeInfo.toJson.apply(span.value);
}
@@ -318,8 +316,7 @@ Spannable.prototype = {
*/
Spannable.fromJson = function(obj) {
if (typeof obj.string !== 'string') {
- throw new Error(
- 'Invalid spannable json object: string field not a string');
+ throw new Error('Invalid spannable json object: string field not a string');
}
if (!(obj.spans instanceof Array)) {
throw new Error('Invalid spannable json object: no spans array');
@@ -374,7 +371,7 @@ Spannable.registerStatelessSerializableSpan = function(constructor, name) {
* @return {!Object}
*/
obj.fromJson = function(obj) {
- return new constructor();
+ return new constructor();
};
serializableSpansByName.set(name, obj);
serializableSpansByConstructor.set(constructor, obj);

Powered by Google App Engine
This is Rietveld 408576698