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 5829c1f0d1e738c46d11cda9b30fb668c5441a3a..7c53c2c74120da7dd02b20eda2fb4cb89dd0ce4e 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js |
| @@ -641,6 +641,49 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement { |
| this.listItemElement.classList.toggle('wait', statusUpdate.wait); |
| } |
| + /** |
| + * @override |
|
alph
2017/07/06 02:09:07
the padding is off
|
| + * @return {boolean} |
| + */ |
| + ondblclick(event) { |
|
alph
2017/07/06 02:09:07
please annotate the argument
|
| + if (this._editing) |
| + return false; |
| + if (this._startEditing(/** @type {!Element} */ (event.target))) |
|
alph
2017/07/06 02:09:07
no need for an 'if' as it always returns false.
|
| + return false; |
| + return false; |
| + } |
| + |
| + |
|
alph
2017/07/06 02:09:07
remove the extra line
|
| + _startEditing(eventTarget) { |
|
alph
2017/07/06 02:09:07
please add annotation.
|
| + var container = eventTarget.enclosingNodeOrSelfWithClass('title-container'); |
| + if (container) { |
|
alph
2017/07/06 02:09:07
we prefer early return to keep the code indents mi
|
| + 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); |
| + // this.listItemElement.getComponentSelection().selectAllChildren(textNodeElement); |
|
alph
2017/07/06 02:09:07
please do not add commented out code.
|
| + } |
| + } |
| + |
| + _editingCommitted(container, element, newTitle) { |
|
alph
2017/07/06 02:09:07
annotate please
|
| + delete this._editing; |
| + |
| + this.profile.setTitle(newTitle); |
|
alph
2017/07/06 02:09:07
the third argument is in fact an oldTitle.
|
| + this.updateTitle(); |
| + } |
| + |
| + _editingCancelled(element, context) { |
|
alph
2017/07/06 02:09:07
annotate please
|
| + delete this._editing; |
| + |
| + // Need to restore attributes structure. |
|
alph
2017/07/06 02:09:07
no need for a comment.
|
| + this.updateTitle(); |
| + } |
| + |
| + updateTitle() { |
|
alph
2017/07/06 02:09:07
make it private, i.e. _updateTitle
|
| + if (this._titleContainer.getElementsByClassName('save-link').length === 0) |
| + this._createSaveLink(); |
|
alph
2017/07/06 02:09:07
I wonder, why do you need to create a save link? I
|
| + 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); |