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

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.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/desktop_automation_handler.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
index 4873e593f7b8681489fbdcd33e1eebff479fb536..6452ae5c7664fca47822b55adae295b0b6422071 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
@@ -43,61 +43,46 @@ DesktopAutomationHandler = function(node) {
*/
this.lastValueChanged_ = new Date(0);
- this.addListener_(EventType.ACTIVEDESCENDANTCHANGED,
- this.onActiveDescendantChanged);
- this.addListener_(EventType.ALERT,
- this.onAlert);
- this.addListener_(EventType.ARIA_ATTRIBUTE_CHANGED,
- this.onAriaAttributeChanged);
- this.addListener_(EventType.AUTOCORRECTION_OCCURED,
- this.onEventIfInRange);
- this.addListener_(EventType.BLUR,
- this.onBlur);
- this.addListener_(EventType.CHECKED_STATE_CHANGED,
- this.onCheckedStateChanged);
- this.addListener_(EventType.CHILDREN_CHANGED,
- this.onChildrenChanged);
- this.addListener_(EventType.EXPANDED_CHANGED,
- this.onEventIfInRange);
- this.addListener_(EventType.FOCUS,
- this.onFocus);
- this.addListener_(EventType.HOVER,
- this.onHover);
- this.addListener_(EventType.INVALID_STATUS_CHANGED,
- this.onEventIfInRange);
- this.addListener_(EventType.LOAD_COMPLETE,
- this.onLoadComplete);
- this.addListener_(EventType.MENU_END,
- this.onMenuEnd);
- this.addListener_(EventType.MENU_LIST_ITEM_SELECTED,
- this.onEventIfSelected);
- this.addListener_(EventType.MENU_START,
- this.onMenuStart);
- this.addListener_(EventType.ROW_COLLAPSED,
- this.onEventIfInRange);
- this.addListener_(EventType.ROW_EXPANDED,
- this.onEventIfInRange);
- this.addListener_(EventType.SCROLL_POSITION_CHANGED,
- this.onScrollPositionChanged);
- this.addListener_(EventType.SELECTION,
- this.onSelection);
- this.addListener_(EventType.TEXT_CHANGED,
- this.onTextChanged);
- this.addListener_(EventType.TEXT_SELECTION_CHANGED,
- this.onTextSelectionChanged);
- this.addListener_(EventType.VALUE_CHANGED,
- this.onValueChanged);
+ this.addListener_(
+ EventType.ACTIVEDESCENDANTCHANGED, this.onActiveDescendantChanged);
+ this.addListener_(EventType.ALERT, this.onAlert);
+ this.addListener_(
+ EventType.ARIA_ATTRIBUTE_CHANGED, this.onAriaAttributeChanged);
+ this.addListener_(EventType.AUTOCORRECTION_OCCURED, this.onEventIfInRange);
+ this.addListener_(EventType.BLUR, this.onBlur);
+ this.addListener_(
+ EventType.CHECKED_STATE_CHANGED, this.onCheckedStateChanged);
+ this.addListener_(EventType.CHILDREN_CHANGED, this.onChildrenChanged);
+ this.addListener_(EventType.EXPANDED_CHANGED, this.onEventIfInRange);
+ this.addListener_(EventType.FOCUS, this.onFocus);
+ this.addListener_(EventType.HOVER, this.onHover);
+ this.addListener_(EventType.INVALID_STATUS_CHANGED, this.onEventIfInRange);
+ this.addListener_(EventType.LOAD_COMPLETE, this.onLoadComplete);
+ this.addListener_(EventType.MENU_END, this.onMenuEnd);
+ this.addListener_(EventType.MENU_LIST_ITEM_SELECTED, this.onEventIfSelected);
+ this.addListener_(EventType.MENU_START, this.onMenuStart);
+ this.addListener_(EventType.ROW_COLLAPSED, this.onEventIfInRange);
+ this.addListener_(EventType.ROW_EXPANDED, this.onEventIfInRange);
+ this.addListener_(
+ EventType.SCROLL_POSITION_CHANGED, this.onScrollPositionChanged);
+ this.addListener_(EventType.SELECTION, this.onSelection);
+ this.addListener_(EventType.TEXT_CHANGED, this.onTextChanged);
+ this.addListener_(
+ EventType.TEXT_SELECTION_CHANGED, this.onTextSelectionChanged);
+ this.addListener_(EventType.VALUE_CHANGED, this.onValueChanged);
AutomationObjectConstructorInstaller.init(node, function() {
- chrome.automation.getFocus((function(focus) {
- if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT)
- return;
-
- if (focus) {
- var event = new CustomAutomationEvent(EventType.FOCUS, focus, 'page');
- this.onFocus(event);
- }
- }).bind(this));
+ chrome.automation.getFocus(
+ (function(focus) {
+ if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT)
+ return;
+
+ if (focus) {
+ var event =
+ new CustomAutomationEvent(EventType.FOCUS, focus, 'page');
+ this.onFocus(event);
+ }
+ }).bind(this));
}.bind(this));
};
@@ -142,8 +127,7 @@ DesktopAutomationHandler.prototype = {
return;
// Don't output if focused node hasn't changed.
- if (prevRange &&
- evt.type == 'focus' &&
+ if (prevRange && evt.type == 'focus' &&
ChromeVoxState.instance.currentRange.equals(prevRange))
return;
@@ -176,9 +160,9 @@ DesktopAutomationHandler.prototype = {
// Intentionally skip setting range.
new Output()
- .withRichSpeechAndBraille(cursors.Range.fromNode(evt.target),
- prev,
- Output.EventType.NAVIGATE)
+ .withRichSpeechAndBraille(
+ cursors.Range.fromNode(evt.target), prev,
+ Output.EventType.NAVIGATE)
.go();
}
},
@@ -278,7 +262,8 @@ DesktopAutomationHandler.prototype = {
// Always refresh the braille contents.
if (curRange && curRange.equals(cursors.Range.fromNode(evt.target))) {
- new Output().withBraille(curRange, curRange, Output.EventType.NAVIGATE)
+ new Output()
+ .withBraille(curRange, curRange, Output.EventType.NAVIGATE)
.go();
}
@@ -313,9 +298,9 @@ DesktopAutomationHandler.prototype = {
var prevRange = ChromeVoxState.instance.currentRange;
var prevNode = prevRange ? prevRange.start.node : null;
if (prevNode) {
- var prevRoot = AutomationUtil.getTopLevelRoot(prevNode);
+ var prevRoot = AutomationUtil.getTopLevelRoot(prevNode);
if (prevRoot && prevRoot !== root)
- ChromeVoxState.instance.focusRecoveryMap.set(prevRoot, prevRange);
+ ChromeVoxState.instance.focusRecoveryMap.set(prevRoot, prevRange);
}
// If a previous node was saved for this focus, restore it.
var savedRange = ChromeVoxState.instance.focusRecoveryMap.get(root);
@@ -342,10 +327,12 @@ DesktopAutomationHandler.prototype = {
// ChromeVox.
this.createTextEditHandlerIfNeeded_(focus);
- // If auto read is set, skip focus recovery and start reading from the top.
+ // If auto read is set, skip focus recovery and start reading from the
+ // top.
if (localStorage['autoRead'] == 'true' &&
AutomationUtil.getTopLevelRoot(evt.target) == evt.target) {
- ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(evt.target));
+ ChromeVoxState.instance.setCurrentRange(
+ cursors.Range.fromNode(evt.target));
cvox.ChromeVox.tts.stop();
CommandHandler.onCommand('readFromHere');
return;
@@ -376,7 +363,8 @@ DesktopAutomationHandler.prototype = {
Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH);
o.withRichSpeechAndBraille(
- ChromeVoxState.instance.currentRange, null, evt.type).go();
+ ChromeVoxState.instance.currentRange, null, evt.type)
+ .go();
}.bind(this));
},
@@ -406,9 +394,7 @@ DesktopAutomationHandler.prototype = {
onEditableChanged_: function(evt) {
var topRoot = AutomationUtil.getTopLevelRoot(evt.target);
if (!evt.target.state.focused ||
- (topRoot &&
- topRoot.parent &&
- !topRoot.parent.state.focused))
+ (topRoot && topRoot.parent && !topRoot.parent.state.focused))
return;
if (!ChromeVoxState.instance.currentRange) {
@@ -454,8 +440,7 @@ DesktopAutomationHandler.prototype = {
return;
var t = evt.target;
- if (t.state.focused ||
- t.root.role == RoleType.DESKTOP ||
+ if (t.state.focused || t.root.role == RoleType.DESKTOP ||
AutomationUtil.isDescendantOf(
ChromeVoxState.instance.currentRange.start.node, t)) {
if (new Date() - this.lastValueChanged_ <=
@@ -505,7 +490,7 @@ DesktopAutomationHandler.prototype = {
// that focus is an ancestor of a selection target.
var override = evt.target.role == RoleType.MENU_ITEM ||
(evt.target.root == focus.root &&
- focus.root.role == RoleType.DESKTOP);
+ focus.root.role == RoleType.DESKTOP);
Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH);
if (override || AutomationUtil.isDescendantOf(evt.target, focus))
this.onEventDefault(evt);
@@ -543,8 +528,7 @@ DesktopAutomationHandler.prototype = {
* @param {!AutomationNode} node
*/
createTextEditHandlerIfNeeded_: function(node) {
- if (!this.textEditHandler_ ||
- this.textEditHandler_.node !== node) {
+ if (!this.textEditHandler_ || this.textEditHandler_.node !== node) {
this.textEditHandler_ = editing.TextEditHandler.createForNode(node);
}
},
@@ -558,8 +542,7 @@ DesktopAutomationHandler.prototype = {
var mode = ChromeVoxState.instance.mode;
// Only output desktop rooted nodes or web nodes for next engine modes.
return evt.target.root.role == RoleType.DESKTOP ||
- (mode == ChromeVoxMode.NEXT ||
- mode == ChromeVoxMode.FORCE_NEXT ||
+ (mode == ChromeVoxMode.NEXT || mode == ChromeVoxMode.FORCE_NEXT ||
mode == ChromeVoxMode.CLASSIC_COMPAT);
}
};

Powered by Google App Engine
This is Rietveld 408576698