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

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

Issue 2740053002: DevTools: keep selected tab as persistence binding comes in (Closed)
Patch Set: thoughtful code Created 3 years, 9 months 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 var fileSystemTabId = this._tabIds.get(binding.fileSystem); 84 var fileSystemTabId = this._tabIds.get(binding.fileSystem);
85 85
86 var wasSelectedInNetwork = this._currentFile === binding.network; 86 var wasSelectedInNetwork = this._currentFile === binding.network;
87 var currentSelectionRange = this._history.selectionRange(binding.network.url ()); 87 var currentSelectionRange = this._history.selectionRange(binding.network.url ());
88 var currentScrollLineNumber = this._history.scrollLineNumber(binding.network .url()); 88 var currentScrollLineNumber = this._history.scrollLineNumber(binding.network .url());
89 this._history.remove(binding.network.url()); 89 this._history.remove(binding.network.url());
90 90
91 if (!networkTabId) 91 if (!networkTabId)
92 return; 92 return;
93 93
94 var tabIndex = this._tabbedPane.tabIndex(networkTabId); 94 if (!fileSystemTabId) {
dgozman 2017/03/10 19:23:38 Do we have to move filsystem in place of network o
95 var tabsToClose = [networkTabId]; 95 var tabIndex = this._tabbedPane.tabIndex(networkTabId);
96 if (fileSystemTabId) 96 fileSystemTabId = this._appendFileTab(binding.fileSystem, false, tabIndex) ;
97 tabsToClose.push(fileSystemTabId); 97 var fileSystemTabView = /** @type {!UI.Widget} */ (this._tabbedPane.tabVie w(fileSystemTabId));
98 this._closeTabs(tabsToClose, true); 98 this._restoreEditorProperties(fileSystemTabView, currentSelectionRange, cu rrentScrollLineNumber);
99 fileSystemTabId = this._appendFileTab(binding.fileSystem, false, tabIndex); 99 }
100 this._updateHistory();
101 100
101 this._closeTabs([networkTabId], true);
102 if (wasSelectedInNetwork) 102 if (wasSelectedInNetwork)
103 this._tabbedPane.selectTab(fileSystemTabId, false); 103 this._tabbedPane.selectTab(fileSystemTabId, false);
104 104
105 var fileSystemTabView = /** @type {!UI.Widget} */ (this._tabbedPane.tabView( fileSystemTabId)); 105 this._updateHistory();
106 this._restoreEditorProperties(fileSystemTabView, currentSelectionRange, curr entScrollLineNumber);
107 } 106 }
108 107
109 /** 108 /**
110 * @param {!Common.Event} event 109 * @param {!Common.Event} event
111 */ 110 */
112 _onBindingRemoved(event) { 111 _onBindingRemoved(event) {
113 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); 112 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data);
114 this._updateFileTitle(binding.fileSystem); 113 this._updateFileTitle(binding.fileSystem);
115 } 114 }
116 115
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 807
809 /** 808 /**
810 * @override 809 * @override
811 * @param {string} tabId 810 * @param {string} tabId
812 * @param {!UI.ContextMenu} contextMenu 811 * @param {!UI.ContextMenu} contextMenu
813 */ 812 */
814 onContextMenu(tabId, contextMenu) { 813 onContextMenu(tabId, contextMenu) {
815 this._editorContainer._onContextMenu(tabId, contextMenu); 814 this._editorContainer._onContextMenu(tabId, contextMenu);
816 } 815 }
817 }; 816 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698