Web Inspector: we should show artificial context menus on mousedown instead of click
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Mar 2019 08:00:56 +0000 (08:00 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Mar 2019 08:00:56 +0000 (08:00 +0000)
commit79717ebe8c9b17ced87472dfae05f49105bdb14f
tree7d3df31a2380a3829147374918fdb215a1aed87d
parent4d108487c08364b595c67532348e5b22d785f274
Web Inspector: we should show artificial context menus on mousedown instead of click
https://bugs.webkit.org/show_bug.cgi?id=195494

Reviewed by Joseph Pecoraro.

* UserInterface/Views/ContextMenu.js:
(WI.ContextMenu):
(WI.ContextMenu.prototype.show):
(WI.ContextMenu.prototype.addBeforeShowCallback): Added.
(WI.ContextMenu.prototype.handleEvent):
Provide a way to register a callback that will be called right as the "contextmenu" event is
handled, but before the context menu is actually shown. Since "mousedown" events are also
fired when/before a "contextmenu" event is fired, each of the below callers has to maintain
some state indicating "we are about to show a context menu, so ignore all "mousedown" events
until that time". Without this, the below callers wouldn't be able to tell when the context
menu is finally shown.

* UserInterface/Base/SearchUtilities.js:
(WI.SearchUtilities.createSettingsButton):
* UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView):
(WI.CanvasContentView.prototype.initialLayout):
(WI.CanvasContentView.prototype._handleCanvasElementButtonMouseDown): Added.
(WI.CanvasContentView.prototype._handleViewShaderButtonMouseDown): Added.
(WI.CanvasContentView.prototype._handleViewRecordingButtonMouseDown): Added.
(WI.CanvasContentView.prototype._canvasElementButtonClicked): Deleted.
(WI.CanvasContentView.prototype._handleViewShaderButtonClicked): Deleted.
(WI.CanvasContentView.prototype._handleViewRecordingButtonClicked): Deleted.
* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel):
(WI.DebuggerSidebarPanel.prototype._handleCreateBreakpointMouseDown): Added.
(WI.DebuggerSidebarPanel.prototype._handleCreateBreakpointClicked): Deleted.
* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel):
(WI.SourcesNavigationSidebarPanel.prototype._handleCreateBreakpointMouseDown): Added.
(WI.SourcesNavigationSidebarPanel.prototype._handleCreateBreakpointClicked): Deleted.
* UserInterface/Views/TabBar.js:
(WI.TabBar.prototype._handleMouseDown):
* UserInterface/Views/LegacyTabBar.js:
(WI.LegacyTabBar.prototype._handleMouseDown):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/SearchUtilities.js
Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
Source/WebInspectorUI/UserInterface/Views/ContextMenu.js
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/LegacyTabBar.js
Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/TabBar.js