| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (!item.checked) | 127 if (!item.checked) |
| 128 checkMarkElement.style.opacity = "0"; | 128 checkMarkElement.style.opacity = "0"; |
| 129 | 129 |
| 130 if (item.element) { | 130 if (item.element) { |
| 131 var wrapper = menuItemElement.createChild("div", "soft-context-menu-
custom-item"); | 131 var wrapper = menuItemElement.createChild("div", "soft-context-menu-
custom-item"); |
| 132 wrapper.appendChild(item.element); | 132 wrapper.appendChild(item.element); |
| 133 menuItemElement._isCustom = true; | 133 menuItemElement._isCustom = true; |
| 134 return menuItemElement; | 134 return menuItemElement; |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (!item.enabled) |
| 138 menuItemElement.classList.add("soft-context-menu-disabled"); |
| 137 menuItemElement.createTextChild(item.label); | 139 menuItemElement.createTextChild(item.label); |
| 138 menuItemElement.createChild("span", "soft-context-menu-shortcut").textCo
ntent = item.shortcut; | 140 menuItemElement.createChild("span", "soft-context-menu-shortcut").textCo
ntent = item.shortcut; |
| 139 | 141 |
| 140 menuItemElement.addEventListener("mousedown", this._menuItemMouseDown.bi
nd(this), false); | 142 menuItemElement.addEventListener("mousedown", this._menuItemMouseDown.bi
nd(this), false); |
| 141 menuItemElement.addEventListener("mouseup", this._menuItemMouseUp.bind(t
his), false); | 143 menuItemElement.addEventListener("mouseup", this._menuItemMouseUp.bind(t
his), false); |
| 142 | 144 |
| 143 // Manually manage hover highlight since :hover does not work in case of
click-and-hold menu invocation. | 145 // Manually manage hover highlight since :hover does not work in case of
click-and-hold menu invocation. |
| 144 menuItemElement.addEventListener("mouseover", this._menuItemMouseOver.bi
nd(this), false); | 146 menuItemElement.addEventListener("mouseover", this._menuItemMouseOver.bi
nd(this), false); |
| 145 menuItemElement.addEventListener("mouseleave", this._menuItemMouseLeave.
bind(this), false); | 147 menuItemElement.addEventListener("mouseleave", this._menuItemMouseLeave.
bind(this), false); |
| 146 | 148 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 389 |
| 388 _discardSubMenus: function() | 390 _discardSubMenus: function() |
| 389 { | 391 { |
| 390 if (this._subMenu) | 392 if (this._subMenu) |
| 391 this._subMenu._discardSubMenus(); | 393 this._subMenu._discardSubMenus(); |
| 392 this.element.remove(); | 394 this.element.remove(); |
| 393 if (this._parentMenu) | 395 if (this._parentMenu) |
| 394 delete this._parentMenu._subMenu; | 396 delete this._parentMenu._subMenu; |
| 395 } | 397 } |
| 396 } | 398 } |
| OLD | NEW |