Title: [211445] trunk/Source/WebInspectorUI
Revision
211445
Author
[email protected]
Date
2017-01-31 13:04:27 -0800 (Tue, 31 Jan 2017)

Log Message

Web Inspector: User Settings: Secondary-clicking the New Tab and Settings tabs should not produce a context menu
https://bugs.webkit.org/show_bug.cgi?id=167651

Patch by Devin Rousso <[email protected]> on 2017-01-31
Reviewed by Joseph Pecoraro.

* UserInterface/Views/PinnedTabBarItem.js:
(WebInspector.PinnedTabBarItem):
(WebInspector.PinnedTabBarItem.prototype._handleContextMenuEvent):
Always preventDefault() to ensure that the system context menu is never shown.

* UserInterface/Views/TabBar.js:
(WebInspector.TabBar):
(WebInspector.TabBar.prototype.get newTabTabBarItem):
(WebInspector.TabBar.prototype._handleNewTabContextMenu): Deleted.
Move the event dispatch to WebInspector.PinnedTabBarItem to give all instances a contextmenu
event handler.

* UserInterface/Views/TabBrowser.js:
(WebInspector.TabBrowser):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (211444 => 211445)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-01-31 20:45:45 UTC (rev 211444)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-01-31 21:04:27 UTC (rev 211445)
@@ -1,3 +1,25 @@
+2017-01-31  Devin Rousso  <[email protected]>
+
+        Web Inspector: User Settings: Secondary-clicking the New Tab and Settings tabs should not produce a context menu
+        https://bugs.webkit.org/show_bug.cgi?id=167651
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/PinnedTabBarItem.js:
+        (WebInspector.PinnedTabBarItem):
+        (WebInspector.PinnedTabBarItem.prototype._handleContextMenuEvent):
+        Always preventDefault() to ensure that the system context menu is never shown.
+
+        * UserInterface/Views/TabBar.js:
+        (WebInspector.TabBar):
+        (WebInspector.TabBar.prototype.get newTabTabBarItem):
+        (WebInspector.TabBar.prototype._handleNewTabContextMenu): Deleted.
+        Move the event dispatch to WebInspector.PinnedTabBarItem to give all instances a contextmenu
+        event handler.
+
+        * UserInterface/Views/TabBrowser.js:
+        (WebInspector.TabBrowser):
+
 2017-01-31  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Address some ESLint warnings

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js (211444 => 211445)


--- trunk/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js	2017-01-31 20:45:45 UTC (rev 211444)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js	2017-01-31 21:04:27 UTC (rev 211445)
@@ -30,5 +30,22 @@
         super(image, title, representedObject);
 
         this.element.classList.add("pinned");
+
+        this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
     }
+
+    // Private
+
+    _handleContextMenuEvent(event)
+    {
+        event.preventDefault();
+
+        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+
+        this.dispatchEventToListeners(WebInspector.PinnedTabBarItem.Event.ContextMenu, {contextMenu});
+    }
 };
+
+WebInspector.PinnedTabBarItem.Event = {
+    ContextMenu: "pinned-tab-bar-item-context-menu",
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (211444 => 211445)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2017-01-31 20:45:45 UTC (rev 211444)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2017-01-31 21:04:27 UTC (rev 211445)
@@ -49,12 +49,13 @@
         this._newTabTabBarItem = new WebInspector.PinnedTabBarItem("Images/NewTabPlus.svg", WebInspector.UIString("Create a new tab"));
         this._newTabTabBarItem.element.addEventListener("mouseenter", this._handleNewTabMouseEnter.bind(this));
         this._newTabTabBarItem.element.addEventListener("click", this._handleNewTabClick.bind(this));
-        this._newTabTabBarItem.element.addEventListener("contextmenu", this._handleNewTabContextMenu.bind(this));
         this.addTabBarItem(this._newTabTabBarItem, true);
     }
 
     // Public
 
+    get newTabTabBarItem() { return this._newTabTabBarItem; }
+
     updateNewTabTabBarItemState()
     {
         let newTabExists = !WebInspector.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type);
@@ -729,13 +730,6 @@
         WebInspector.showNewTabTab(shouldAnimate);
     }
 
-    _handleNewTabContextMenu(event)
-    {
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
-
-        this.dispatchEventToListeners(WebInspector.TabBar.Event.NewTabContextMenu, {contextMenu});
-    }
-
     _handleNewTabMouseEnter(event)
     {
         if (!this._tabAnimatedClosedSinceMouseEnter || !this.element.classList.contains("static-layout") || this.element.classList.contains("animating"))
@@ -750,6 +744,5 @@
     TabBarItemAdded: "tab-bar-tab-bar-item-added",
     TabBarItemRemoved: "tab-bar-tab-bar-item-removed",
     TabBarItemsReordered: "tab-bar-tab-bar-items-reordered",
-    NewTabContextMenu: "tab-bar-new-tab-contextmenu",
     OpenDefaultTab: "tab-bar-open-default-tab"
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js (211444 => 211445)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js	2017-01-31 20:45:45 UTC (rev 211444)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js	2017-01-31 21:04:27 UTC (rev 211445)
@@ -74,7 +74,7 @@
         this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemSelected, this._tabBarItemSelected, this);
         this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded, this._tabBarItemAdded, this);
         this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved, this._tabBarItemRemoved, this);
-        this._tabBar.addEventListener(WebInspector.TabBar.Event.NewTabContextMenu, this._handleNewTabContextMenu, this);
+        this._tabBar.newTabTabBarItem.addEventListener(WebInspector.PinnedTabBarItem.Event.ContextMenu, this._handleNewTabContextMenu, this);
 
         this._recentTabContentViews = [];
         this._closedTabClasses = new Set;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to