OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return; | 50 return; |
51 | 51 |
52 this._document = document; | 52 this._document = document; |
53 this._x = x; | 53 this._x = x; |
54 this._y = y; | 54 this._y = y; |
55 this._time = new Date().getTime(); | 55 this._time = new Date().getTime(); |
56 | 56 |
57 // Create context menu. | 57 // Create context menu. |
58 this._contextMenuElement = createElementWithClass("div", "soft-context-m
enu"); | 58 this._contextMenuElement = createElementWithClass("div", "soft-context-m
enu"); |
59 var root = this._contextMenuElement.createShadowRoot(); | 59 var root = this._contextMenuElement.createShadowRoot(); |
60 root.appendChild(WebInspector.View.createStyleElement("ui/softContextMen
u.css")); | 60 root.appendChild(WebInspector.Widget.createStyleElement("ui/softContextM
enu.css")); |
61 var menuElement = root.createChild("div"); | 61 var menuElement = root.createChild("div"); |
62 this._contextMenuElement.tabIndex = 0; | 62 this._contextMenuElement.tabIndex = 0; |
63 this._contextMenuElement.style.top = y + "px"; | 63 this._contextMenuElement.style.top = y + "px"; |
64 this._contextMenuElement.style.left = x + "px"; | 64 this._contextMenuElement.style.left = x + "px"; |
65 | 65 |
66 menuElement.addEventListener("mouseup", consumeEvent, false); | 66 menuElement.addEventListener("mouseup", consumeEvent, false); |
67 menuElement.addEventListener("keydown", this._menuKeyDown.bind(this), fa
lse); | 67 menuElement.addEventListener("keydown", this._menuKeyDown.bind(this), fa
lse); |
68 | 68 |
69 for (var i = 0; i < this._items.length; ++i) | 69 for (var i = 0; i < this._items.length; ++i) |
70 menuElement.appendChild(this._createMenuItem(this._items[i])); | 70 menuElement.appendChild(this._createMenuItem(this._items[i])); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 _discardSubMenus: function() | 347 _discardSubMenus: function() |
348 { | 348 { |
349 if (this._subMenu) | 349 if (this._subMenu) |
350 this._subMenu._discardSubMenus(); | 350 this._subMenu._discardSubMenus(); |
351 this._contextMenuElement.remove(); | 351 this._contextMenuElement.remove(); |
352 if (this._parentMenu) | 352 if (this._parentMenu) |
353 delete this._parentMenu._subMenu; | 353 delete this._parentMenu._subMenu; |
354 } | 354 } |
355 } | 355 } |
OLD | NEW |