| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 * @param {!Document} document | 42 * @param {!Document} document |
| 43 * @param {!AnchorBox} anchorBox | 43 * @param {!AnchorBox} anchorBox |
| 44 */ | 44 */ |
| 45 show(document, anchorBox) { | 45 show(document, anchorBox) { |
| 46 if (!this._items.length) | 46 if (!this._items.length) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 this._document = document; | 49 this._document = document; |
| 50 | 50 |
| 51 this._glassPane = new UI.GlassPane(); | 51 this._glassPane = new UI.GlassPane(); |
| 52 this._glassPane.setBlockPointerEvents(!this._parentMenu); | 52 this._glassPane.setPointerEventsBehavior( |
| 53 this._parentMenu ? UI.GlassPane.PointerEventsBehavior.PierceGlassPane : |
| 54 UI.GlassPane.PointerEventsBehavior.BlockedByGlassPane
); |
| 53 this._glassPane.registerRequiredCSS('ui/softContextMenu.css'); | 55 this._glassPane.registerRequiredCSS('ui/softContextMenu.css'); |
| 54 this._glassPane.setContentAnchorBox(anchorBox); | 56 this._glassPane.setContentAnchorBox(anchorBox); |
| 55 this._glassPane.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent); | 57 this._glassPane.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent); |
| 56 this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.NoMargin); | 58 this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.NoMargin); |
| 57 this._glassPane.setAnchorBehavior( | 59 this._glassPane.setAnchorBehavior( |
| 58 this._parentMenu ? UI.GlassPane.AnchorBehavior.PreferRight : UI.GlassPan
e.AnchorBehavior.PreferBottom); | 60 this._parentMenu ? UI.GlassPane.AnchorBehavior.PreferRight : UI.GlassPan
e.AnchorBehavior.PreferBottom); |
| 59 | 61 |
| 60 this._contextMenuElement = this._glassPane.contentElement.createChild('div',
'soft-context-menu'); | 62 this._contextMenuElement = this._glassPane.contentElement.createChild('div',
'soft-context-menu'); |
| 61 this._contextMenuElement.tabIndex = 0; | 63 this._contextMenuElement.tabIndex = 0; |
| 62 this._contextMenuElement.addEventListener('mouseup', e => e.consume(), false
); | 64 this._contextMenuElement.addEventListener('mouseup', e => e.consume(), false
); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 case ' ': // Space | 313 case ' ': // Space |
| 312 if (this._highlightedMenuItemElement) | 314 if (this._highlightedMenuItemElement) |
| 313 this._triggerAction(this._highlightedMenuItemElement, event); | 315 this._triggerAction(this._highlightedMenuItemElement, event); |
| 314 if (this._highlightedMenuItemElement._subItems) | 316 if (this._highlightedMenuItemElement._subItems) |
| 315 this._subMenu._highlightNext(); | 317 this._subMenu._highlightNext(); |
| 316 break; | 318 break; |
| 317 } | 319 } |
| 318 event.consume(true); | 320 event.consume(true); |
| 319 } | 321 } |
| 320 }; | 322 }; |
| OLD | NEW |