Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js

Issue 2460513003: DevTools: [Persistence] tabs should not change order during reload (Closed)
Patch Set: fix test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (networkTabId) 94 if (networkTabId)
95 this._tabbedPane.changeTabTitle(networkTabId, this._titleForFile(bin ding.fileSystem), this._tooltipForFile(binding.fileSystem)); 95 this._tabbedPane.changeTabTitle(networkTabId, this._titleForFile(bin ding.fileSystem), this._tooltipForFile(binding.fileSystem));
96 if (!fileSystemTabId) 96 if (!fileSystemTabId)
97 return; 97 return;
98 98
99 var wasSelectedInFileSystem = this._currentFile === binding.fileSystem; 99 var wasSelectedInFileSystem = this._currentFile === binding.fileSystem;
100 var currentSelectionRange = this._history.selectionRange(binding.fileSys tem.url()); 100 var currentSelectionRange = this._history.selectionRange(binding.fileSys tem.url());
101 var currentScrollLineNumber = this._history.scrollLineNumber(binding.fil eSystem.url()); 101 var currentScrollLineNumber = this._history.scrollLineNumber(binding.fil eSystem.url());
102 102
103 var tabIndex = this._tabbedPane.tabIndex(fileSystemTabId); 103 var tabIndex = this._tabbedPane.tabIndex(fileSystemTabId);
104 this._closeTabs([fileSystemTabId], true); 104 var tabsToClose = [fileSystemTabId];
105 if (!networkTabId) 105 if (networkTabId)
106 networkTabId = this._appendFileTab(binding.network, false, tabIndex) ; 106 tabsToClose.push(networkTabId);
107 this._closeTabs(tabsToClose, true);
108 networkTabId = this._appendFileTab(binding.network, false, tabIndex);
107 this._updateHistory(); 109 this._updateHistory();
108 110
109 if (wasSelectedInFileSystem) 111 if (wasSelectedInFileSystem)
110 this._tabbedPane.selectTab(networkTabId, false); 112 this._tabbedPane.selectTab(networkTabId, false);
111 113
112 var networkTabView = /** @type {!WebInspector.Widget} */(this._tabbedPan e.tabView(networkTabId)); 114 var networkTabView = /** @type {!WebInspector.Widget} */(this._tabbedPan e.tabView(networkTabId));
113 this._restoreEditorProperties(networkTabView, currentSelectionRange, cur rentScrollLineNumber); 115 this._restoreEditorProperties(networkTabView, currentSelectionRange, cur rentScrollLineNumber);
114 }, 116 },
115 117
116 /** 118 /**
117 * @param {!WebInspector.Event} event 119 * @param {!WebInspector.Event} event
118 */ 120 */
119 _onBindingRemoved: function(event) 121 _onBindingRemoved: function(event)
120 { 122 {
121 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data ); 123 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data );
122 var networkTabId = this._tabIds.get(binding.network); 124 var networkTabId = this._tabIds.get(binding.network);
123 if (!networkTabId) 125 if (!networkTabId)
124 return; 126 return;
127 var tabIndex = this._tabbedPane.tabIndex(networkTabId);
128 var wasSelected = this._currentFile === binding.network;
129 var fileSystemTabId = this._appendFileTab(binding.fileSystem, false, tab Index);
130 this._updateHistory();
125 131
126 var fileSystemTabId = this._appendFileTab(binding.fileSystem, false); 132 if (wasSelected)
127 this._updateHistory(); 133 this._tabbedPane.selectTab(fileSystemTabId, false);
128 134
129 var fileSystemTabView = /** @type {!WebInspector.Widget} */(this._tabbed Pane.tabView(fileSystemTabId)); 135 var fileSystemTabView = /** @type {!WebInspector.Widget} */(this._tabbed Pane.tabView(fileSystemTabId));
130 var savedSelectionRange = this._history.selectionRange(binding.network.u rl()); 136 var savedSelectionRange = this._history.selectionRange(binding.network.u rl());
131 var savedScrollLineNumber = this._history.scrollLineNumber(binding.netwo rk.url()); 137 var savedScrollLineNumber = this._history.scrollLineNumber(binding.netwo rk.url());
132 this._restoreEditorProperties(fileSystemTabView, savedSelectionRange, sa vedScrollLineNumber); 138 this._restoreEditorProperties(fileSystemTabView, savedSelectionRange, sa vedScrollLineNumber);
133 }, 139 },
134 140
135 /** 141 /**
136 * @return {!WebInspector.Widget} 142 * @return {!WebInspector.Widget}
137 */ 143 */
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 /** 850 /**
845 * @override 851 * @override
846 * @param {string} tabId 852 * @param {string} tabId
847 * @param {!WebInspector.ContextMenu} contextMenu 853 * @param {!WebInspector.ContextMenu} contextMenu
848 */ 854 */
849 onContextMenu: function(tabId, contextMenu) 855 onContextMenu: function(tabId, contextMenu)
850 { 856 {
851 this._editorContainer._onContextMenu(tabId, contextMenu); 857 this._editorContainer._onContextMenu(tabId, contextMenu);
852 } 858 }
853 }; 859 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698