Chromium Code Reviews| 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..60007e0efa3418a60209001182576f2ca16515f5 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,55 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement { |
| this.listItemElement.classList.toggle('wait', statusUpdate.wait); |
| } |
| + /** |
| + * @override |
|
alph
2017/07/10 21:16:30
@param {!Event} event
diana.suvorova
2017/07/11 16:54:26
thanks!
|
| + * @return {boolean} |
| + */ |
| + ondblclick(event) { |
| + if (this._editing) |
| + return false; |
| + this._startEditing(/** @type {!Element} */ (event.target)); |
| + return false; |
| + } |
| + |
| + /** |
| + * @param {!Element} eventTarget |
| + */ |
| + _startEditing(eventTarget) { |
| + var container = eventTarget.enclosingNodeOrSelfWithClass('title-container'); |
|
alph
2017/07/10 21:16:30
Can you please attach the editor to the title elem
diana.suvorova
2017/07/11 16:54:26
Yes, thanks for suggesting this. It is much cleane
|
| + 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/10 21:16:31
you can drop oldTitle args as it's not used.
diana.suvorova
2017/07/11 16:54:26
gone
|
| + 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); |
| } |
| /** |