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

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

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (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/cvox2/background/editing.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
index 80c18156e1ba9469f9c8ca13c26b38a6ce7f373d..36f22ef968487858fd2bb7bc21d79b228f736b95 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -74,12 +74,11 @@ function TextFieldTextEditHandler(node) {
editing.TextEditHandler.call(this, node);
chrome.automation.getDesktop(function(desktop) {
- var useRichText = editing.useRichText &&
- node.state.richlyEditable;
+ var useRichText = editing.useRichText && node.state.richlyEditable;
/** @private {!AutomationEditableText} */
- this.editableText_ = useRichText ?
- new AutomationRichEditableText(node) : new AutomationEditableText(node);
+ this.editableText_ = useRichText ? new AutomationRichEditableText(node) :
+ new AutomationEditableText(node);
}.bind(this));
}
@@ -90,11 +89,9 @@ TextFieldTextEditHandler.prototype = {
onEvent: function(evt) {
if (evt.type !== EventType.TEXT_CHANGED &&
evt.type !== EventType.TEXT_SELECTION_CHANGED &&
- evt.type !== EventType.VALUE_CHANGED &&
- evt.type !== EventType.FOCUS)
+ evt.type !== EventType.VALUE_CHANGED && evt.type !== EventType.FOCUS)
return;
- if (!evt.target.state.focused ||
- !evt.target.state.editable ||
+ if (!evt.target.state.focused || !evt.target.state.editable ||
evt.target != this.node_)
return;
@@ -115,12 +112,8 @@ function AutomationEditableText(node) {
var start = node.textSelStart;
var end = node.textSelEnd;
cvox.ChromeVoxEditableTextBase.call(
- this,
- node.value || '',
- Math.min(start, end),
- Math.max(start, end),
- node.state[StateType.PROTECTED] /**password*/,
- cvox.ChromeVox.tts);
+ this, node.value || '', Math.min(start, end), Math.max(start, end),
+ node.state[StateType.PROTECTED] /**password*/, cvox.ChromeVox.tts);
/** @override */
this.multiline = node.state[StateType.MULTILINE] || false;
/** @type {!AutomationNode} @private */
@@ -142,9 +135,7 @@ AutomationEditableText.prototype = {
this.lineBreaks_ = [];
var textChangeEvent = new cvox.TextChangeEvent(
- newValue,
- this.node_.textSelStart || 0,
- this.node_.textSelEnd || 0,
+ newValue, this.node_.textSelStart || 0, this.node_.textSelEnd || 0,
true /* triggered by user */);
this.changed(textChangeEvent);
this.outputBraille_();
@@ -241,26 +232,22 @@ AutomationRichEditableText.prototype = {
return;
var cur = new editing.EditableLine(
- root.anchorObject, root.anchorOffset || 0,
- root.focusObject, root.focusOffset || 0);
+ root.anchorObject, root.anchorOffset || 0, root.focusObject,
+ root.focusOffset || 0);
var prev = this.line_;
this.line_ = cur;
if (prev.equals(cur)) {
// Collapsed cursor.
this.changed(new cvox.TextChangeEvent(
- cur.text || '',
- cur.startOffset || 0,
- cur.endOffset || 0,
- true));
+ cur.text || '', cur.startOffset || 0, cur.endOffset || 0, true));
var value = cur.value_;
value.setSpan(new cvox.ValueSpan(0), 0, cur.value_.length);
value.setSpan(
new cvox.ValueSelectionSpan(), cur.startOffset, cur.endOffset);
- cvox.ChromeVox.braille.write(new cvox.NavBraille({text: value,
- startIndex: cur.startOffset,
- endIndex: cur.endOffset}));
+ cvox.ChromeVox.braille.write(new cvox.NavBraille(
+ {text: value, startIndex: cur.startOffset, endIndex: cur.endOffset}));
// Finally, queue up any text markers/styles at bounds.
var container = cur.lineContainer_;
@@ -311,10 +298,12 @@ AutomationRichEditableText.prototype = {
Cursor.fromNode(prev.lineStart_), Cursor.fromNode(prev.lineEnd_));
}
- new Output().withRichSpeechAndBraille(new Range(
- Cursor.fromNode(cur.lineStart_), Cursor.fromNode(cur.lineEnd_)),
- prevRange,
- Output.EventType.NAVIGATE).go();
+ new Output()
+ .withRichSpeechAndBraille(
+ new Range(
+ Cursor.fromNode(cur.lineStart_), Cursor.fromNode(cur.lineEnd_)),
+ prevRange, Output.EventType.NAVIGATE)
+ .go();
},
/**
@@ -334,9 +323,9 @@ AutomationRichEditableText.prototype = {
if (msgs.length) {
msgs.forEach(function(msg) {
- cvox.ChromeVox.tts.speak(Msgs.getMsg(msg),
- cvox.QueueMode.QUEUE,
- cvox.AbstractTts.PERSONALITY_ANNOTATION);
+ cvox.ChromeVox.tts.speak(
+ Msgs.getMsg(msg), cvox.QueueMode.QUEUE,
+ cvox.AbstractTts.PERSONALITY_ANNOTATION);
});
}
},
@@ -359,9 +348,9 @@ AutomationRichEditableText.prototype = {
if (msgs.length) {
msgs.forEach(function(msg) {
- cvox.ChromeVox.tts.speak(Msgs.getMsg(msg),
- cvox.QueueMode.QUEUE,
- cvox.AbstractTts.PERSONALITY_ANNOTATION);
+ cvox.ChromeVox.tts.speak(
+ Msgs.getMsg(msg), cvox.QueueMode.QUEUE,
+ cvox.AbstractTts.PERSONALITY_ANNOTATION);
});
}
},
@@ -453,7 +442,7 @@ editing.observer_ = new editing.EditingChromeVoxStateObserver();
* An EditableLine encapsulates all data concerning a line in the automation
* tree necessary to provide output.
* @constructor
- */
+ */
editing.EditableLine = function(startNode, startIndex, endNode, endIndex) {
/** @private {!Cursor} */
this.start_ = new Cursor(startNode, startIndex);
@@ -590,7 +579,7 @@ editing.EditableLine.prototype = {
return (otherLine.lineStart_ == this.lineStart_ &&
otherLine.lineEnd_ == this.lineEnd_) ||
(otherLine.lineContainer_ == this.lineContainer_ &&
- otherLine.containerLineStartOffset == this.containerLineStartOffset);
+ otherLine.containerLineStartOffset == this.containerLineStartOffset);
}
};

Powered by Google App Engine
This is Rietveld 408576698