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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js

Issue 2152293002: DevTools: kill WI.SourcesView._showFile method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
index 270a9eec694fcb9169a92b62e8539e2e272f11c1..0324baae33cf4a6f643c8e5beb855cd10c089cb9 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
@@ -248,7 +248,7 @@ WebInspector.SourcesView.prototype = {
var networkURL = WebInspector.networkMapping.networkURL(uiSourceCode);
var currentNetworkURL = WebInspector.networkMapping.networkURL(currentUISourceCode);
if (currentUISourceCode.isFromServiceProject() && currentUISourceCode !== uiSourceCode && currentNetworkURL === networkURL && networkURL) {
- this._showFile(uiSourceCode);
+ this._editorContainer.showFile(uiSourceCode);
this._editorContainer.removeUISourceCode(currentUISourceCode);
}
},
@@ -298,37 +298,13 @@ WebInspector.SourcesView.prototype = {
showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, omitFocus, omitHighlight)
{
this._historyManager.updateCurrentState();
- var sourceView = this._showFile(uiSourceCode);
- if (typeof lineNumber === "number" && sourceView instanceof WebInspector.UISourceCodeFrame)
- /** @type {!WebInspector.UISourceCodeFrame} */(sourceView).revealPosition(lineNumber, columnNumber, !omitHighlight);
+ this._editorContainer.showFile(uiSourceCode)
+ var currentSourceFrame = this.currentSourceFrame();
+ if (currentSourceFrame && typeof lineNumber === "number")
+ currentSourceFrame.revealPosition(lineNumber, columnNumber, !omitHighlight);
this._historyManager.pushNewState();
if (!omitFocus)
- sourceView.focus();
- },
-
- /**
- * @param {!WebInspector.UISourceCode} uiSourceCode
- * @return {!WebInspector.Widget}
- */
- _showFile: function(uiSourceCode)
- {
- var sourceView = this._getOrCreateSourceView(uiSourceCode);
- if (this._currentUISourceCode === uiSourceCode)
- return sourceView;
-
- var currentFrame = this.currentSourceFrame();
- if (currentFrame)
- currentFrame.setSearchableView(null);
-
- this._currentUISourceCode = uiSourceCode;
- this._editorContainer.showFile(uiSourceCode);
- this._updateScriptViewToolbarItems();
-
- currentFrame = this.currentSourceFrame();
- if (currentFrame)
- currentFrame.setSearchableView(this._searchableView);
-
- return sourceView;
+ this.visibleView().focus();
},
/**
@@ -441,6 +417,9 @@ WebInspector.SourcesView.prototype = {
}
},
+ /**
+ * @param {!WebInspector.Event} event
+ */
_editorClosed: function(event)
{
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
@@ -462,20 +441,24 @@ WebInspector.SourcesView.prototype = {
this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorClosed, data);
},
+ /**
+ * @param {!WebInspector.Event} event
+ */
_editorSelected: function(event)
{
- var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data.currentFile);
- var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode && event.data.userGesture;
- if (shouldUseHistoryManager)
- this._historyManager.updateCurrentState();
- var sourceView = this._showFile(uiSourceCode);
- if (shouldUseHistoryManager)
- this._historyManager.pushNewState();
+ this._currentUISourceCode = /** @type {!WebInspector.UISourceCode} */(event.data.currentFile);
+ var previousSourceFrame = event.data.previousView instanceof WebInspector.UISourceCodeFrame ? event.data.previousView : null;
+ if (previousSourceFrame)
+ previousSourceFrame.setSearchableView(null);
+ var currentSourceFrame = event.data.currentView instanceof WebInspector.UISourceCodeFrame ? event.data.currentView : null;
+ if (currentSourceFrame)
+ currentSourceFrame.setSearchableView(this._searchableView);
- this._searchableView.setReplaceable(sourceView instanceof WebInspector.UISourceCodeFrame && /** @type {!WebInspector.UISourceCodeFrame} */(sourceView).canEditSource());
+ this._searchableView.setReplaceable(!!currentSourceFrame && currentSourceFrame.canEditSource());
this._searchableView.refreshSearch();
+ this._updateScriptViewToolbarItems();
- this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorSelected, uiSourceCode);
+ this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorSelected, this._currentUISourceCode);
},
/**
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698