OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
634 _updateStatus(event) { | 634 _updateStatus(event) { |
635 var statusUpdate = event.data; | 635 var statusUpdate = event.data; |
636 if (statusUpdate.subtitle !== null) { | 636 if (statusUpdate.subtitle !== null) { |
637 this._subtitleElement.textContent = statusUpdate.subtitle || ''; | 637 this._subtitleElement.textContent = statusUpdate.subtitle || ''; |
638 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle ); | 638 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle ); |
639 } | 639 } |
640 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) | 640 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) |
641 this.listItemElement.classList.toggle('wait', statusUpdate.wait); | 641 this.listItemElement.classList.toggle('wait', statusUpdate.wait); |
642 } | 642 } |
643 | 643 |
644 /** | |
645 * @override | |
alph
2017/07/06 02:09:07
the padding is off
| |
646 * @return {boolean} | |
647 */ | |
648 ondblclick(event) { | |
alph
2017/07/06 02:09:07
please annotate the argument
| |
649 if (this._editing) | |
650 return false; | |
651 if (this._startEditing(/** @type {!Element} */ (event.target))) | |
alph
2017/07/06 02:09:07
no need for an 'if' as it always returns false.
| |
652 return false; | |
653 return false; | |
654 } | |
655 | |
656 | |
alph
2017/07/06 02:09:07
remove the extra line
| |
657 _startEditing(eventTarget) { | |
alph
2017/07/06 02:09:07
please add annotation.
| |
658 var container = eventTarget.enclosingNodeOrSelfWithClass('title-container'); | |
659 if (container) { | |
alph
2017/07/06 02:09:07
we prefer early return to keep the code indents mi
| |
660 container.textContent = this.profile.title; | |
661 var config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this) , this._editingCancelled.bind(this)); | |
662 this._editing = UI.InplaceEditor.startEditing(container, config); | |
663 // this.listItemElement.getComponentSelection().selectAllChildren(textNode Element); | |
alph
2017/07/06 02:09:07
please do not add commented out code.
| |
664 } | |
665 } | |
666 | |
667 _editingCommitted(container, element, newTitle) { | |
alph
2017/07/06 02:09:07
annotate please
| |
668 delete this._editing; | |
669 | |
670 this.profile.setTitle(newTitle); | |
alph
2017/07/06 02:09:07
the third argument is in fact an oldTitle.
| |
671 this.updateTitle(); | |
672 } | |
673 | |
674 _editingCancelled(element, context) { | |
alph
2017/07/06 02:09:07
annotate please
| |
675 delete this._editing; | |
676 | |
677 // Need to restore attributes structure. | |
alph
2017/07/06 02:09:07
no need for a comment.
| |
678 this.updateTitle(); | |
679 } | |
680 | |
681 updateTitle() { | |
alph
2017/07/06 02:09:07
make it private, i.e. _updateTitle
| |
682 if (this._titleContainer.getElementsByClassName('save-link').length === 0) | |
683 this._createSaveLink(); | |
alph
2017/07/06 02:09:07
I wonder, why do you need to create a save link? I
| |
684 this._titleElement.textContent = this.profile.title; | |
685 } | |
686 | |
644 dispose() { | 687 dispose() { |
645 this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); | 688 this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); |
646 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceiv ed, this._onProfileReceived, this); | 689 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceiv ed, this._onProfileReceived, this); |
647 } | 690 } |
648 | 691 |
649 /** | 692 /** |
650 * @override | 693 * @override |
651 * @return {boolean} | 694 * @return {boolean} |
652 */ | 695 */ |
653 onselect() { | 696 onselect() { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 * @param {string} actionId | 858 * @param {string} actionId |
816 * @return {boolean} | 859 * @return {boolean} |
817 */ | 860 */ |
818 handleAction(context, actionId) { | 861 handleAction(context, actionId) { |
819 var panel = UI.context.flavor(Profiler.JSProfilerPanel); | 862 var panel = UI.context.flavor(Profiler.JSProfilerPanel); |
820 console.assert(panel && panel instanceof Profiler.JSProfilerPanel); | 863 console.assert(panel && panel instanceof Profiler.JSProfilerPanel); |
821 panel.toggleRecord(); | 864 panel.toggleRecord(); |
822 return true; | 865 return true; |
823 } | 866 } |
824 }; | 867 }; |
OLD | NEW |