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 29059af4b4d6c24729cc230f164bb6f5b32662df..4d2ac87d0b385007a6253767ffcc0581faf694b9 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
@@ -612,6 +612,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 +642,52 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement { |
this.listItemElement.classList.toggle('wait', statusUpdate.wait); |
} |
+ /** |
+ * @override |
+ * @param {!Event} event |
+ * @return {boolean} |
+ */ |
+ ondblclick(event) { |
+ if (this._editing) |
alph
2017/07/11 18:44:23
nit:
if (!this._editing)
this._startEditing(/**
diana.suvorova
2017/07/11 19:19:53
updated
|
+ return false; |
+ this._startEditing(/** @type {!Element} */ (event.target)); |
+ return false; |
+ } |
+ |
+ /** |
+ * @param {!Element} eventTarget |
+ */ |
+ _startEditing(eventTarget) { |
+ var container = eventTarget.enclosingNodeOrSelfWithClass('title'); |
+ if (!container) |
+ return; |
+ container.textContent = this.profile.title; |
alph
2017/07/11 18:44:23
seems to be not needed anymore.
diana.suvorova
2017/07/11 19:19:53
true, removed
|
+ 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 |
+ */ |
+ _editingCommitted(container, newTitle) { |
+ delete this._editing; |
+ this.profile.setTitle(newTitle); |
+ } |
+ |
+ _editingCancelled() { |
+ delete this._editing; |
+ this._updateTitle(); |
+ } |
+ |
+ _updateTitle() { |
+ this._titleElement.textContent = this.profile.title; |
alph
2017/07/11 18:44:23
Now as you editing the title element directly, the
diana.suvorova
2017/07/11 19:19:53
Thanks, gone
|
+ } |
+ |
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); |
} |
/** |