| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 appendTab(id, tabTitle, view, tabTooltip, userGesture, isCloseable, index) { | 190 appendTab(id, tabTitle, view, tabTooltip, userGesture, isCloseable, index) { |
| 191 isCloseable = typeof isCloseable === 'boolean' ? isCloseable : this._closeab
leTabs; | 191 isCloseable = typeof isCloseable === 'boolean' ? isCloseable : this._closeab
leTabs; |
| 192 var tab = new UI.TabbedPaneTab(this, id, tabTitle, isCloseable, view, tabToo
ltip); | 192 var tab = new UI.TabbedPaneTab(this, id, tabTitle, isCloseable, view, tabToo
ltip); |
| 193 tab.setDelegate(this._delegate); | 193 tab.setDelegate(this._delegate); |
| 194 this._tabsById[id] = tab; | 194 this._tabsById[id] = tab; |
| 195 if (index !== undefined) | 195 if (index !== undefined) |
| 196 this._tabs.splice(index, 0, tab); | 196 this._tabs.splice(index, 0, tab); |
| 197 else | 197 else |
| 198 this._tabs.push(tab); | 198 this._tabs.push(tab); |
| 199 this._tabsHistory.push(tab); | 199 this._tabsHistory.push(tab); |
| 200 view.attach(this); | 200 view.attach(this, this.element); |
| 201 if (this._tabsHistory[0] === tab && this.isShowing()) | 201 if (this._tabsHistory[0] === tab && this.isShowing()) |
| 202 this.selectTab(tab.id, userGesture); | 202 this.selectTab(tab.id, userGesture); |
| 203 this._updateTabElements(); | 203 this._updateTabElements(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 /** | 206 /** |
| 207 * @param {string} id | 207 * @param {string} id |
| 208 * @param {boolean=} userGesture | 208 * @param {boolean=} userGesture |
| 209 */ | 209 */ |
| 210 closeTab(id, userGesture) { | 210 closeTab(id, userGesture) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 var shouldFocus = tab.view.hasFocus(); | 414 var shouldFocus = tab.view.hasFocus(); |
| 415 | 415 |
| 416 this.suspendInvalidations(); | 416 this.suspendInvalidations(); |
| 417 | 417 |
| 418 var isSelected = this._currentTab && this._currentTab.id === id; | 418 var isSelected = this._currentTab && this._currentTab.id === id; |
| 419 if (isSelected) | 419 if (isSelected) |
| 420 this._hideTab(tab); | 420 this._hideTab(tab); |
| 421 tab.view.detach(); | 421 tab.view.detach(); |
| 422 tab.view = view; | 422 tab.view = view; |
| 423 tab.view.attach(this); | 423 tab.view.attach(this, this.element); |
| 424 if (isSelected) | 424 if (isSelected) |
| 425 this._showTab(tab); | 425 this._showTab(tab); |
| 426 if (shouldFocus) | 426 if (shouldFocus) |
| 427 tab.view.focus(); | 427 tab.view.focus(); |
| 428 | 428 |
| 429 this.resumeInvalidations(); | 429 this.resumeInvalidations(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 /** | 432 /** |
| 433 * @override | 433 * @override |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 this._hideTab(this._currentTab); | 740 this._hideTab(this._currentTab); |
| 741 delete this._currentTab; | 741 delete this._currentTab; |
| 742 } | 742 } |
| 743 | 743 |
| 744 /** | 744 /** |
| 745 * @param {!UI.TabbedPaneTab} tab | 745 * @param {!UI.TabbedPaneTab} tab |
| 746 */ | 746 */ |
| 747 _showTab(tab) { | 747 _showTab(tab) { |
| 748 tab.tabElement.classList.add('selected'); | 748 tab.tabElement.classList.add('selected'); |
| 749 tab.tabElement.setAttribute('aria-selected', 'true'); | 749 tab.tabElement.setAttribute('aria-selected', 'true'); |
| 750 tab.view.showWidget(this.element); | 750 tab.view.showWidget(); |
| 751 this._updateTabSlider(); | 751 this._updateTabSlider(); |
| 752 } | 752 } |
| 753 | 753 |
| 754 _updateTabSlider() { | 754 _updateTabSlider() { |
| 755 if (!this._currentTab || !this._sliderEnabled) | 755 if (!this._currentTab || !this._sliderEnabled) |
| 756 return; | 756 return; |
| 757 var left = 0; | 757 var left = 0; |
| 758 for (var i = 0; i < this._tabs.length && this._currentTab !== this._tabs[i]
&& this._tabs[i]._shown; i++) | 758 for (var i = 0; i < this._tabs.length && this._currentTab !== this._tabs[i]
&& this._tabs[i]._shown; i++) |
| 759 left += this._tabs[i]._measuredWidth; | 759 left += this._tabs[i]._measuredWidth; |
| 760 var sliderWidth = this._currentTab._shown ? this._currentTab._measuredWidth
: this._dropDownButton.offsetWidth; | 760 var sliderWidth = this._currentTab._shown ? this._currentTab._measuredWidth
: this._dropDownButton.offsetWidth; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 * @param {!Array.<string>} ids | 1209 * @param {!Array.<string>} ids |
| 1210 */ | 1210 */ |
| 1211 closeTabs(tabbedPane, ids) {}, | 1211 closeTabs(tabbedPane, ids) {}, |
| 1212 | 1212 |
| 1213 /** | 1213 /** |
| 1214 * @param {string} tabId | 1214 * @param {string} tabId |
| 1215 * @param {!UI.ContextMenu} contextMenu | 1215 * @param {!UI.ContextMenu} contextMenu |
| 1216 */ | 1216 */ |
| 1217 onContextMenu(tabId, contextMenu) {} | 1217 onContextMenu(tabId, contextMenu) {} |
| 1218 }; | 1218 }; |
| OLD | NEW |