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

Unified Diff: ui/webui/resources/js/cr/ui/context_menu_handler.js

Issue 2597013002: Run clang-format on ui/webui/resources (Closed)
Patch Set: remove cr_shared_menu.js Created 4 years 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: ui/webui/resources/js/cr/ui/context_menu_handler.js
diff --git a/ui/webui/resources/js/cr/ui/context_menu_handler.js b/ui/webui/resources/js/cr/ui/context_menu_handler.js
index 7a48736e36a60635f7d64ea8e5bb516aa19321b1..2266801fe5d872ef0661996047e93c7d6e90771e 100644
--- a/ui/webui/resources/js/cr/ui/context_menu_handler.js
+++ b/ui/webui/resources/js/cr/ui/context_menu_handler.js
@@ -14,9 +14,7 @@ cr.define('cr.ui', function() {
* @extends {cr.EventTarget}
* @implements {EventListener}
*/
- function ContextMenuHandler() {
- this.showingEvents_ = new EventTracker();
- }
+ function ContextMenuHandler() { this.showingEvents_ = new EventTracker(); }
ContextMenuHandler.prototype = {
__proto__: EventTarget.prototype,
@@ -25,10 +23,7 @@ cr.define('cr.ui', function() {
* The menu that we are currently showing.
* @type {cr.ui.Menu}
*/
- menu_: null,
- get menu() {
- return this.menu_;
- },
+ menu_: null, get menu() { return this.menu_; },
/**
* Shows a menu as a context menu.
@@ -113,8 +108,8 @@ cr.define('cr.ui', function() {
// to detect this.
if (this.keyIsDown_) {
var rect = element.getRectForContextMenu ?
- element.getRectForContextMenu() :
- element.getBoundingClientRect();
+ element.getRectForContextMenu() :
+ element.getBoundingClientRect();
var offset = Math.min(rect.width, rect.height) / 2;
x = rect.left + offset;
y = rect.top + offset;
@@ -153,12 +148,11 @@ cr.define('cr.ui', function() {
case 'mousedown':
if (!this.menu.contains(e.target)) {
this.hideMenu();
- if(e.button == 0 /* Left click */) {
+ if (e.button == 0 /* Left click */) {
e.preventDefault();
e.stopPropagation();
}
- }
- else
+ } else
e.preventDefault();
break;
@@ -173,7 +167,7 @@ cr.define('cr.ui', function() {
e.stopPropagation();
e.preventDefault();
- // If the menu is visible we let it handle all the keyboard events.
+ // If the menu is visible we let it handle all the keyboard events.
} else if (this.menu) {
this.menu.handleKeyDown(e);
e.preventDefault();
@@ -182,10 +176,10 @@ cr.define('cr.ui', function() {
break;
case 'activate':
- var hideDelayed = e.target instanceof cr.ui.MenuItem &&
- e.target.checkable;
- this.hideMenu(hideDelayed ? cr.ui.HideType.DELAYED :
- cr.ui.HideType.INSTANT);
+ var hideDelayed =
+ e.target instanceof cr.ui.MenuItem && e.target.checkable;
+ this.hideMenu(
+ hideDelayed ? cr.ui.HideType.DELAYED : cr.ui.HideType.INSTANT);
break;
case 'focus':
@@ -220,11 +214,11 @@ cr.define('cr.ui', function() {
*/
addContextMenuProperty: function(elementOrClass) {
var target = typeof elementOrClass == 'function' ?
- elementOrClass.prototype : elementOrClass;
+ elementOrClass.prototype :
+ elementOrClass;
- target.__defineGetter__('contextMenu', function() {
- return this.contextMenu_;
- });
+ target.__defineGetter__(
+ 'contextMenu', function() { return this.contextMenu_; });
target.__defineSetter__('contextMenu', function(menu) {
var oldContextMenu = this.contextMenu;

Powered by Google App Engine
This is Rietveld 408576698