Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 /** @type {!Array<!Object>} */ | 291 /** @type {!Array<!Object>} */ |
| 292 this._pendingTargets = []; | 292 this._pendingTargets = []; |
| 293 this._event = event; | 293 this._event = event; |
| 294 this._useSoftMenu = !!useSoftMenu; | 294 this._useSoftMenu = !!useSoftMenu; |
| 295 this._x = x === undefined ? event.x : x; | 295 this._x = x === undefined ? event.x : x; |
| 296 this._y = y === undefined ? event.y : y; | 296 this._y = y === undefined ? event.y : y; |
| 297 this._handlers = {}; | 297 this._handlers = {}; |
| 298 this._id = 0; | 298 this._id = 0; |
| 299 /** @type {!Map<string, !UI.ContextSubMenuItem>} */ | 299 /** @type {!Map<string, !UI.ContextSubMenuItem>} */ |
| 300 this._namedSubMenus = new Map(); | 300 this._namedSubMenus = new Map(); |
| 301 | |
| 302 var target = event.deepElementFromPoint(); | |
| 303 if (target) | |
| 304 this.appendApplicableItems(/** @type {!Object} */ (target)); | |
|
lushnikov
2016/11/22 01:11:49
won't this result in double-applicable-items? You
dgozman
2016/11/22 01:33:19
I did actually remove them from installHandler cal
| |
| 301 } | 305 } |
| 302 | 306 |
| 303 static initialize() { | 307 static initialize() { |
| 304 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.SetUseSoftMenu, setUseSoftMenu); | 308 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.SetUseSoftMenu, setUseSoftMenu); |
| 305 /** | 309 /** |
| 306 * @param {!Common.Event} event | 310 * @param {!Common.Event} event |
| 307 */ | 311 */ |
| 308 function setUseSoftMenu(event) { | 312 function setUseSoftMenu(event) { |
| 309 UI.ContextMenu._useSoftMenu = /** @type {boolean} */ (event.data); | 313 UI.ContextMenu._useSoftMenu = /** @type {boolean} */ (event.data); |
| 310 } | 314 } |
| 311 } | 315 } |
| 312 | 316 |
| 313 /** | 317 /** |
| 314 * @param {!Document} doc | 318 * @param {!Document} doc |
| 315 */ | 319 */ |
| 316 static installHandler(doc) { | 320 static installHandler(doc) { |
| 317 doc.body.addEventListener('contextmenu', handler, false); | 321 doc.body.addEventListener('contextmenu', handler, false); |
| 318 | 322 |
| 319 /** | 323 /** |
| 320 * @param {!Event} event | 324 * @param {!Event} event |
| 321 */ | 325 */ |
| 322 function handler(event) { | 326 function handler(event) { |
| 323 var contextMenu = new UI.ContextMenu(event); | 327 var contextMenu = new UI.ContextMenu(event); |
| 324 contextMenu.appendApplicableItems(/** @type {!Object} */ (event.deepElemen tFromPoint())); | |
| 325 contextMenu.show(); | 328 contextMenu.show(); |
| 326 } | 329 } |
| 327 } | 330 } |
| 328 | 331 |
| 329 /** | 332 /** |
| 330 * @return {number} | 333 * @return {number} |
| 331 */ | 334 */ |
| 332 _nextId() { | 335 _nextId() { |
| 333 return this._id++; | 336 return this._id++; |
| 334 } | 337 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 UI.ContextMenu.Provider = function() {}; | 477 UI.ContextMenu.Provider = function() {}; |
| 475 | 478 |
| 476 UI.ContextMenu.Provider.prototype = { | 479 UI.ContextMenu.Provider.prototype = { |
| 477 /** | 480 /** |
| 478 * @param {!Event} event | 481 * @param {!Event} event |
| 479 * @param {!UI.ContextMenu} contextMenu | 482 * @param {!UI.ContextMenu} contextMenu |
| 480 * @param {!Object} target | 483 * @param {!Object} target |
| 481 */ | 484 */ |
| 482 appendApplicableItems(event, contextMenu, target) {} | 485 appendApplicableItems(event, contextMenu, target) {} |
| 483 }; | 486 }; |
| OLD | NEW |