Title: [116853] trunk/Source/WebCore
Revision
116853
Author
[email protected]
Date
2012-05-12 06:09:41 -0700 (Sat, 12 May 2012)

Log Message

Web Inspector: add tab context menu
https://bugs.webkit.org/show_bug.cgi?id=86292

Reviewed by Yury Semikhatsky.

This tab context menu will have "Close", "Close Others" and "Close All".

* English.lproj/localizedStrings.js:
* inspector/front-end/TabbedPane.js:
(WebInspector.TabbedPane.prototype.closeOtherTabs):
(WebInspector.TabbedPaneTab.prototype._createTabElement):
(WebInspector.TabbedPaneTab.prototype._tabClicked):
(WebInspector.TabbedPaneTab.prototype._tabContextMenu):
(WebInspector.TabbedPaneTab.prototype._tabContextMenu.closeOthers):
(WebInspector.TabbedPaneTab.prototype._tabContextMenu.closeAll):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116852 => 116853)


--- trunk/Source/WebCore/ChangeLog	2012-05-12 12:52:42 UTC (rev 116852)
+++ trunk/Source/WebCore/ChangeLog	2012-05-12 13:09:41 UTC (rev 116853)
@@ -1,5 +1,23 @@
 2012-05-12  Pavel Feldman  <[email protected]>
 
+        Web Inspector: add tab context menu
+        https://bugs.webkit.org/show_bug.cgi?id=86292
+
+        Reviewed by Yury Semikhatsky.
+
+        This tab context menu will have "Close", "Close Others" and "Close All".
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/TabbedPane.js:
+        (WebInspector.TabbedPane.prototype.closeOtherTabs):
+        (WebInspector.TabbedPaneTab.prototype._createTabElement):
+        (WebInspector.TabbedPaneTab.prototype._tabClicked):
+        (WebInspector.TabbedPaneTab.prototype._tabContextMenu):
+        (WebInspector.TabbedPaneTab.prototype._tabContextMenu.closeOthers):
+        (WebInspector.TabbedPaneTab.prototype._tabContextMenu.closeAll):
+
+2012-05-12  Pavel Feldman  <[email protected]>
+
         Web Inspector: make call frame selector pane focusable, allow Up / Down to select current call frame.
         https://bugs.webkit.org/show_bug.cgi?id=86291
 

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/TabbedPane.js (116852 => 116853)


--- trunk/Source/WebCore/inspector/front-end/TabbedPane.js	2012-05-12 12:52:42 UTC (rev 116852)
+++ trunk/Source/WebCore/inspector/front-end/TabbedPane.js	2012-05-12 13:09:41 UTC (rev 116853)
@@ -160,6 +160,20 @@
 
     /**
      * @param {string} id
+     */
+    closeOtherTabs: function(id)
+    {
+        var tabs = this._tabs.slice();
+        for (var i = 0; i < tabs.length; ++i) {
+            if (tabs[i].id !== id)
+                this._innerCloseTab(tabs[i].id, true);
+        }
+        this._updateTabElements();
+        this.selectTab(id, true);
+    },
+
+    /**
+     * @param {string} id
      * @param {boolean=} userGesture
      */
     selectTab: function(id, userGesture)
@@ -614,6 +628,8 @@
         else {
             this._tabElement = tabElement;
             tabElement.addEventListener("click", this._tabClicked.bind(this), false);
+            if (this._closeable)
+                tabElement.addEventListener("contextmenu", this._tabContextMenu.bind(this), false);
         }
         
         return tabElement;
@@ -637,5 +653,29 @@
         else
             this._tabbedPane.selectTab(this.id, true);
         this._tabbedPane.focus();
+    },
+
+    _tabContextMenu: function(event)
+    {
+        function close()
+        {
+            this._tabbedPane.closeTab(this.id, true);
+        }
+  
+        function closeOthers()
+        {
+            this._tabbedPane.closeOtherTabs(this.id);
+        }
+  
+        function closeAll()
+        {
+            this._tabbedPane.closeAllTabs(true);
+        }
+  
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.UIString("Close"), close.bind(this));
+        contextMenu.appendItem(WebInspector.UIString("Close Others"), closeOthers.bind(this));
+        contextMenu.appendItem(WebInspector.UIString("Close All"), closeAll.bind(this));
+        contextMenu.show(event);
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to