Changeset 116853 in webkit
- Timestamp:
- May 12, 2012 6:09:41 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116852 r116853 1 2012-05-12 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: add tab context menu 4 https://bugs.webkit.org/show_bug.cgi?id=86292 5 6 Reviewed by Yury Semikhatsky. 7 8 This tab context menu will have "Close", "Close Others" and "Close All". 9 10 * English.lproj/localizedStrings.js: 11 * inspector/front-end/TabbedPane.js: 12 (WebInspector.TabbedPane.prototype.closeOtherTabs): 13 (WebInspector.TabbedPaneTab.prototype._createTabElement): 14 (WebInspector.TabbedPaneTab.prototype._tabClicked): 15 (WebInspector.TabbedPaneTab.prototype._tabContextMenu): 16 (WebInspector.TabbedPaneTab.prototype._tabContextMenu.closeOthers): 17 (WebInspector.TabbedPaneTab.prototype._tabContextMenu.closeAll): 18 1 19 2012-05-12 Pavel Feldman <pfeldman@chromium.org> 2 20 -
trunk/Source/WebCore/inspector/front-end/TabbedPane.js
r114740 r116853 161 161 /** 162 162 * @param {string} id 163 */ 164 closeOtherTabs: function(id) 165 { 166 var tabs = this._tabs.slice(); 167 for (var i = 0; i < tabs.length; ++i) { 168 if (tabs[i].id !== id) 169 this._innerCloseTab(tabs[i].id, true); 170 } 171 this._updateTabElements(); 172 this.selectTab(id, true); 173 }, 174 175 /** 176 * @param {string} id 163 177 * @param {boolean=} userGesture 164 178 */ … … 615 629 this._tabElement = tabElement; 616 630 tabElement.addEventListener("click", this._tabClicked.bind(this), false); 631 if (this._closeable) 632 tabElement.addEventListener("contextmenu", this._tabContextMenu.bind(this), false); 617 633 } 618 634 … … 638 654 this._tabbedPane.selectTab(this.id, true); 639 655 this._tabbedPane.focus(); 656 }, 657 658 _tabContextMenu: function(event) 659 { 660 function close() 661 { 662 this._tabbedPane.closeTab(this.id, true); 663 } 664 665 function closeOthers() 666 { 667 this._tabbedPane.closeOtherTabs(this.id); 668 } 669 670 function closeAll() 671 { 672 this._tabbedPane.closeAllTabs(true); 673 } 674 675 var contextMenu = new WebInspector.ContextMenu(); 676 contextMenu.appendItem(WebInspector.UIString("Close"), close.bind(this)); 677 contextMenu.appendItem(WebInspector.UIString("Close Others"), closeOthers.bind(this)); 678 contextMenu.appendItem(WebInspector.UIString("Close All"), closeAll.bind(this)); 679 contextMenu.show(event); 640 680 } 641 681 }
Note: See TracChangeset
for help on using the changeset viewer.