Changeset 247803 in webkit
- Timestamp:
- Jul 24, 2019, 5:42:23 PM (6 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r247790 r247803 1 2019-07-24 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: REGRESSION: no context menu items work when context menu clicking on "Add Breakpoint" 4 https://bugs.webkit.org/show_bug.cgi?id=199953 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Views/ContextMenuUtilities.js: 9 (WI.addMouseDownContextMenuHandlers): Added. 10 Create a helper function for managing elements that show a context menu on "mousedown". 11 12 * UserInterface/Base/SearchUtilities.js: 13 (WI.SearchUtilities.createSettingsButton): 14 * UserInterface/Views/CanvasContentView.js: 15 (WI.CanvasContentView.prototype.initialLayout): 16 (WI.CanvasContentView.prototype._populateCanvasElementButtonContextMenu): Added. 17 (WI.CanvasContentView.prototype._populateViewShaderButtonContextMenu): Added. 18 (WI.CanvasContentView.prototype._populateViewRecordingButtonContextMenu): Added. 19 (WI.CanvasContentView.prototype._handleCanvasElementButtonMouseDown): Deleted. 20 (WI.CanvasContentView.prototype._handleViewShaderButtonMouseDown): Deleted. 21 (WI.CanvasContentView.prototype._handleViewRecordingButtonMouseDown): Deleted. 22 * UserInterface/Views/DebuggerSidebarPanel.js: 23 (WI.DebuggerSidebarPanel): 24 (WI.DebuggerSidebarPanel.prototype._populateCreateBreakpointContextMenu): Added. 25 (WI.DebuggerSidebarPanel.prototype._handleCreateBreakpointMouseDown): Deleted. 26 * UserInterface/Views/SourcesNavigationSidebarPanel.js: 27 (WI.SourcesNavigationSidebarPanel): 28 (WI.SourcesNavigationSidebarPanel.prototype._populateResourceGroupingModeContextMenu): Added. 29 (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): Added. 30 (WI.SourcesNavigationSidebarPanel.prototype._handleResourceGroupingModeMouseDown): Deleted. 31 (WI.SourcesNavigationSidebarPanel.prototype._handleCreateBreakpointMouseDown): Deleted. 32 33 * UserInterface/Views/TabBar.js: 34 (WI.TabBar): 35 (WI.TabBar.prototype._handleTabPickerTabContextMenu): Deleted. 36 * UserInterface/Views/LegacyTabBar.js: 37 (WI.LegacyTabBar): 38 (WI.LegacyTabBar.prototype._handleTabPickerTabContextMenu): Deleted. 39 Remove the "contextmenu" handler on the tab picker, as that's already used by the entire 40 tab bar to show/hide tabs. 41 1 42 2019-07-24 Devin Rousso <drousso@apple.com> 2 43 -
trunk/Source/WebInspectorUI/UserInterface/Base/SearchUtilities.js
r242937 r247803 73 73 console.assert(!isEmptyObject(settings)); 74 74 75 let ignoreMouseDown = false;76 77 75 let button = document.createElement("button"); 78 button.addEventListener("mousedown", (event) => { 79 event.stop(); 80 81 if (ignoreMouseDown) 82 return; 83 84 ignoreMouseDown = true; 85 86 let contextMenu = WI.ContextMenu.createFromEvent(event); 87 contextMenu.addBeforeShowCallback(() => { 88 ignoreMouseDown = false; 89 }); 90 76 button.classList.add("search-settings"); 77 button.tabIndex = -1; 78 WI.addMouseDownContextMenuHandlers(button, (contextMenu) => { 91 79 if (settings.caseSensitive) { 92 80 contextMenu.appendCheckboxItem(WI.UIString("Case Sensitive", "Case Sensitive @ Context Menu", "Context menu label for whether searches should be case sensitive."), () => { … … 100 88 }, settings.regularExpression.value); 101 89 } 102 103 contextMenu.show();104 90 }); 105 button.classList.add("search-settings");106 button.tabIndex = -1;107 91 108 92 button.appendChild(WI.ImageUtilities.useSVGSymbol("Images/Gear.svg", "glyph")); -
trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
r244908 r247803 114 114 let canvasElementButtonNavigationItem = new WI.ButtonNavigationItem("canvas-element", WI.UIString("Canvas Element"), "Images/Markup.svg", 16, 16); 115 115 canvasElementButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low; 116 canvasElementButtonNavigationItem.element.addEventListener("mousedown", this._handleCanvasElementButtonMouseDown.bind(this));116 WI.addMouseDownContextMenuHandlers(canvasElementButtonNavigationItem.element, this._populateCanvasElementButtonContextMenu.bind(this)); 117 117 navigationBar.addNavigationItem(canvasElementButtonNavigationItem); 118 118 … … 135 135 this._viewShaderButton.classList.add("view-shader"); 136 136 this._viewShaderButton.title = WI.UIString("View Shader"); 137 this._viewShaderButton.addEventListener("mousedown", this._handleViewShaderButtonMouseDown.bind(this));137 WI.addMouseDownContextMenuHandlers(this._viewShaderButton, this._populateViewShaderButtonContextMenu.bind(this)); 138 138 139 139 this._viewRecordingButton = document.createElement("img"); 140 140 this._viewRecordingButton.classList.add("view-recording"); 141 141 this._viewRecordingButton.title = WI.UIString("View Recording"); 142 this._viewRecordingButton.addEventListener("mousedown", this._handleViewRecordingButtonMouseDown.bind(this));142 WI.addMouseDownContextMenuHandlers(this._viewRecordingButton, this._populateViewRecordingButtonContextMenu.bind(this)); 143 143 144 144 this._updateViewRelatedItems(); … … 291 291 } 292 292 293 _handleCanvasElementButtonMouseDown(event) 294 { 295 if (this._ignoreCanvasElementButtonMouseDown) 296 return; 297 298 this._ignoreCanvasElementButtonMouseDown = true; 299 300 let contextMenu = WI.ContextMenu.createFromEvent(event); 301 contextMenu.addBeforeShowCallback(() => { 302 this._ignoreCanvasElementButtonMouseDown = false; 303 }); 304 293 _populateCanvasElementButtonContextMenu(contextMenu) 294 { 305 295 if (this._canvasNode) 306 296 WI.appendContextMenuItemsForDOMNode(contextMenu, this._canvasNode); … … 318 308 }); 319 309 }); 320 321 contextMenu.show();322 310 } 323 311 … … 406 394 } 407 395 408 _handleViewShaderButtonMouseDown(event) 409 { 410 if (this._ignoreViewShaderButtonMouseDown) 411 return; 412 396 _populateViewShaderButtonContextMenu(contextMenu, event) 397 { 413 398 let shaderPrograms = this.representedObject.shaderProgramCollection; 414 399 console.assert(shaderPrograms.size); … … 416 401 return; 417 402 418 if ( shaderPrograms.size === 1) {403 if (event.button === 0 && shaderPrograms.size === 1) { 419 404 WI.showRepresentedObject(Array.from(shaderPrograms)[0]); 420 405 return; 421 406 } 422 423 this._ignoreViewShaderButtonMouseDown = true;424 425 let contextMenu = WI.ContextMenu.createFromEvent(event);426 contextMenu.addBeforeShowCallback(() => {427 this._ignoreViewShaderButtonMouseDown = false;428 });429 407 430 408 for (let shaderProgram of shaderPrograms) { … … 433 411 }); 434 412 } 435 436 contextMenu.show(); 437 } 438 439 _handleViewRecordingButtonMouseDown(event) 440 { 441 if (this._ignoreViewRecordingButtonMouseDown) 442 return; 443 413 } 414 415 _populateViewRecordingButtonContextMenu(contextMenu, event) 416 { 444 417 let recordings = this.representedObject.recordingCollection; 445 418 console.assert(recordings.size); … … 447 420 return; 448 421 449 if ( recordings.size === 1) {422 if (event.button === 0 && recordings.size === 1) { 450 423 WI.showRepresentedObject(Array.from(recordings)[0]); 451 424 return; 452 425 } 453 454 this._ignoreViewRecordingButtonMouseDown = true;455 456 let contextMenu = WI.ContextMenu.createFromEvent(event);457 contextMenu.addBeforeShowCallback(() => {458 this._ignoreViewRecordingButtonMouseDown = false;459 });460 426 461 427 for (let recording of recordings) { … … 464 430 }); 465 431 } 466 467 contextMenu.show();468 432 } 469 433 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js
r247053 r247803 24 24 */ 25 25 26 WI.addMouseDownContextMenuHandlers = function(element, populateContextMenuCallback) 27 { 28 let ignoreMouseDown = false; 29 element.addEventListener("mousedown", (event) => { 30 if (event.button !== 0) 31 return; 32 33 event.stop(); 34 35 if (ignoreMouseDown) 36 return; 37 38 ignoreMouseDown = true; 39 40 let contextMenu = WI.ContextMenu.createFromEvent(event); 41 contextMenu.addBeforeShowCallback(() => { 42 ignoreMouseDown = false; 43 }); 44 45 populateContextMenuCallback(contextMenu, event); 46 47 contextMenu.show(); 48 }); 49 50 element.addEventListener("contextmenu", (event) => { 51 let contextMenu = WI.ContextMenu.createFromEvent(event); 52 populateContextMenuCallback(contextMenu, event); 53 }); 54 }; 55 26 56 WI.appendContextMenuItemsForSourceCode = function(contextMenu, sourceCodeOrLocation) 27 57 { -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
r247253 r247803 158 158 159 159 this._createBreakpointButton = new WI.ButtonNavigationItem("create-breakpoint", WI.UIString("Create Breakpoint"), "Images/Plus13.svg", 13, 13); 160 this._createBreakpointButton.element.addEventListener("mousedown", this._handleCreateBreakpointMouseDown.bind(this));160 WI.addMouseDownContextMenuHandlers(this._createBreakpointButton.element, this._populateCreateBreakpointContextMenu.bind(this)); 161 161 breakpointNavigationBar.addNavigationItem(this._createBreakpointButton); 162 162 … … 1465 1465 } 1466 1466 1467 _handleCreateBreakpointMouseDown(event) 1468 { 1469 if (this._ignoreCreateBreakpointMouseDown) 1470 return; 1471 1472 this._ignoreCreateBreakpointMouseDown = true; 1473 1474 let contextMenu = WI.ContextMenu.createFromEvent(event); 1475 contextMenu.addBeforeShowCallback(() => { 1476 this._ignoreCreateBreakpointMouseDown = false; 1477 }); 1478 1467 _populateCreateBreakpointContextMenu(contextMenu) 1468 { 1479 1469 // COMPATIBILITY (iOS 10): DebuggerAgent.setPauseOnAssertions did not exist yet. 1480 1470 if (InspectorBackend.domains.Debugger.setPauseOnAssertions) { … … 1517 1507 }); 1518 1508 } 1519 1520 contextMenu.show();1521 1509 } 1522 1510 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/LegacyTabBar.js
r242937 r247803 56 56 this._tabPickerTabBarItem = new WI.PinnedTabBarItem("Images/TabPicker.svg", WI.UIString("Show hidden tabs")); 57 57 this._tabPickerTabBarItem.element.classList.add("tab-picker"); 58 this._tabPickerTabBarItem.element.addEventListener("contextmenu", this._handleTabPickerTabContextMenu.bind(this));59 58 this.addTabBarItem(this._tabPickerTabBarItem, {suppressAnimations: true}); 60 59 } … … 851 850 } 852 851 853 _handleTabPickerTabContextMenu(event)854 {855 if (!this._hiddenTabBarItems.length)856 return;857 858 let contextMenu = WI.ContextMenu.createFromEvent(event);859 for (let item of this._hiddenTabBarItems) {860 contextMenu.appendItem(item.title, () => {861 this.selectedTabBarItem = item;862 });863 }864 }865 866 852 _handleNewTabMouseEnter(event) 867 853 { -
trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js
r247253 r247803 189 189 190 190 this._createBreakpointButton = new WI.ButtonNavigationItem("create-breakpoint", WI.UIString("Create Breakpoint"), "Images/Plus13.svg", 13, 13); 191 this._createBreakpointButton.element.addEventListener("mousedown", this._handleCreateBreakpointMouseDown.bind(this));191 WI.addMouseDownContextMenuHandlers(this._createBreakpointButton.element, this._populateCreateBreakpointContextMenu.bind(this)); 192 192 breakpointNavigationBar.addNavigationItem(this._createBreakpointButton); 193 193 … … 220 220 let resourceGroupingModeNavigationItem = new WI.ButtonNavigationItem("grouping-mode", WI.UIString("Grouping Mode"), "Images/Gear.svg", 15, 15); 221 221 resourceGroupingModeNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low; 222 resourceGroupingModeNavigationItem.element.addEventListener("mousedown", this._handleResourceGroupingModeMouseDown.bind(this));222 WI.addMouseDownContextMenuHandlers(resourceGroupingModeNavigationItem.element, this._populateResourceGroupingModeContextMenu.bind(this)); 223 223 this._resourcesNavigationBar.addNavigationItem(resourceGroupingModeNavigationItem); 224 224 … … 1400 1400 } 1401 1401 1402 _handleResourceGroupingModeMouseDown(event) 1403 { 1404 if (this._ignoreResourceGroupingModeMouseDown) 1405 return; 1406 1407 this._ignoreResourceGroupingModeMouseDown = true; 1408 1409 let contextMenu = WI.ContextMenu.createFromEvent(event); 1410 contextMenu.addBeforeShowCallback(() => { 1411 this._ignoreResourceGroupingModeMouseDown = false; 1412 }); 1413 1402 _populateResourceGroupingModeContextMenu(contextMenu) 1403 { 1414 1404 function addOption(mode, label) { 1415 1405 contextMenu.appendCheckboxItem(label, () => { … … 1419 1409 addOption(WI.Resource.GroupingMode.Path, WI.UIString("Group by Path")); 1420 1410 addOption(WI.Resource.GroupingMode.Type, WI.UIString("Group by Type")); 1421 1422 contextMenu.show();1423 1411 } 1424 1412 … … 1519 1507 } 1520 1508 1521 _handleCreateBreakpointMouseDown(event) 1522 { 1523 if (this._ignoreCreateBreakpointMouseDown) 1524 return; 1525 1526 this._ignoreCreateBreakpointMouseDown = true; 1527 1528 let contextMenu = WI.ContextMenu.createFromEvent(event); 1529 contextMenu.addBeforeShowCallback(() => { 1530 this._ignoreCreateBreakpointMouseDown = false; 1531 }); 1532 1509 _populateCreateBreakpointContextMenu(contextMenu) 1510 { 1533 1511 // COMPATIBILITY (iOS 10): DebuggerAgent.setPauseOnAssertions did not exist yet. 1534 1512 if (InspectorBackend.domains.Debugger.setPauseOnAssertions) { … … 1571 1549 }); 1572 1550 } 1573 1574 contextMenu.show();1575 1551 } 1576 1552 -
trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js
r242937 r247803 49 49 this._tabPickerTabBarItem = new WI.PinnedTabBarItem("Images/TabPicker.svg", WI.UIString("Show hidden tabs")); 50 50 this._tabPickerTabBarItem.element.classList.add("tab-picker", "hidden"); 51 this._tabPickerTabBarItem.element.addEventListener("contextmenu", this._handleTabPickerTabContextMenu.bind(this));52 51 this.addTabBarItem(this._tabPickerTabBarItem, {suppressAnimations: true}); 53 52 } … … 811 810 } 812 811 } 813 814 _handleTabPickerTabContextMenu(event)815 {816 if (!this._hiddenTabBarItems.length)817 return;818 819 let contextMenu = WI.ContextMenu.createFromEvent(event);820 for (let item of this._hiddenTabBarItems) {821 contextMenu.appendItem(item.title, () => {822 this.selectedTabBarItem = item;823 });824 }825 }826 812 }; 827 813
Note:
See TracChangeset
for help on using the changeset viewer.