Index: third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
index 5829c1f0d1e738c46d11cda9b30fb668c5441a3a..2988c4c7a628c0e13b8b7c004072029aae3fb2e3 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
@@ -295,6 +295,7 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar { |
profileType.addEventListener(Profiler.ProfileType.Events.RemoveProfileHeader, onRemoveProfileHeader, this); |
profileType.addEventListener(Profiler.ProfileType.Events.ProfileComplete, profileComplete, this); |
+ |
alph
2017/07/07 22:37:25
nuke the extra line.
|
var profiles = profileType.getProfiles(); |
for (var i = 0; i < profiles.length; i++) |
this._addProfileHeader(profiles[i]); |
@@ -612,6 +613,7 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement { |
this._dataDisplayDelegate = dataDisplayDelegate; |
this.profile = profile; |
profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); |
+ profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateTitle, this); |
if (profile.canSaveToFile()) |
this._createSaveLink(); |
else |
@@ -641,9 +643,55 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement { |
this.listItemElement.classList.toggle('wait', statusUpdate.wait); |
} |
+ /** |
+ * @override |
+ * @return {boolean} |
+ */ |
+ ondblclick(event) { |
alph
2017/07/07 22:37:25
annotate event plz
|
+ if (this._editing) |
alph
2017/07/07 22:37:25
if (!this._editing)
this._startEditing();
return
|
+ return false; |
+ this._startEditing(/** @type {!Element} */ (event.target)); |
+ return false; |
+ } |
+ |
+ /** |
+ * @param {!Element} eventTarget |
+ */ |
+ _startEditing(eventTarget) { |
+ var container = eventTarget.enclosingNodeOrSelfWithClass('title-container'); |
alph
2017/07/07 22:37:25
Can you create the editor on 'title' element, not
|
+ if (!container) |
+ return; |
+ container.textContent = this.profile.title; |
+ var config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this)); |
+ this._editing = UI.InplaceEditor.startEditing(container, config); |
+ } |
+ |
+ /** |
+ * @param {!Element} container |
+ * @param {string} newTitle |
+ * @param {string} oldTitle |
+ */ |
+ _editingCommitted(container, newTitle, oldTitle) { |
alph
2017/07/07 22:37:25
nit: just drop oldTitle if it's not used.
|
+ delete this._editing; |
+ |
+ this.profile.setTitle(newTitle); |
+ } |
+ |
+ _editingCancelled() { |
+ delete this._editing; |
+ this._updateTitle(); |
+ } |
+ |
+ _updateTitle() { |
+ if (this._titleContainer.getElementsByClassName('save-link').length === 0) |
+ this._createSaveLink(); |
+ this._titleElement.textContent = this.profile.title; |
+ } |
+ |
dispose() { |
this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); |
this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceived, this._onProfileReceived, this); |
+ this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateTitle, this); |
} |
/** |