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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 this._titleContainer = this._titlesElement.createChild('span', 'title-contai ner'); | 605 this._titleContainer = this._titlesElement.createChild('span', 'title-contai ner'); |
606 this._titleElement = this._titleContainer.createChild('span', 'title'); | 606 this._titleElement = this._titleContainer.createChild('span', 'title'); |
607 this._subtitleElement = this._titlesElement.createChild('span', 'subtitle'); | 607 this._subtitleElement = this._titlesElement.createChild('span', 'subtitle'); |
608 | 608 |
609 this._titleElement.textContent = profile.title; | 609 this._titleElement.textContent = profile.title; |
610 this._className = className; | 610 this._className = className; |
611 this._small = false; | 611 this._small = false; |
612 this._dataDisplayDelegate = dataDisplayDelegate; | 612 this._dataDisplayDelegate = dataDisplayDelegate; |
613 this.profile = profile; | 613 this.profile = profile; |
614 profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._u pdateStatus, this); | 614 profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._u pdateStatus, this); |
615 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateTitle, this); | |
615 if (profile.canSaveToFile()) | 616 if (profile.canSaveToFile()) |
616 this._createSaveLink(); | 617 this._createSaveLink(); |
617 else | 618 else |
618 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileReceived, th is._onProfileReceived, this); | 619 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileReceived, th is._onProfileReceived, this); |
619 } | 620 } |
620 | 621 |
621 _createSaveLink() { | 622 _createSaveLink() { |
622 this._saveLinkElement = this._titleContainer.createChild('span', 'save-link' ); | 623 this._saveLinkElement = this._titleContainer.createChild('span', 'save-link' ); |
623 this._saveLinkElement.textContent = Common.UIString('Save'); | 624 this._saveLinkElement.textContent = Common.UIString('Save'); |
624 this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this) , false); | 625 this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this) , false); |
625 } | 626 } |
626 | 627 |
627 _onProfileReceived(event) { | 628 _onProfileReceived(event) { |
628 this._createSaveLink(); | 629 this._createSaveLink(); |
629 } | 630 } |
630 | 631 |
631 /** | 632 /** |
632 * @param {!Common.Event} event | 633 * @param {!Common.Event} event |
633 */ | 634 */ |
634 _updateStatus(event) { | 635 _updateStatus(event) { |
635 var statusUpdate = event.data; | 636 var statusUpdate = event.data; |
636 if (statusUpdate.subtitle !== null) { | 637 if (statusUpdate.subtitle !== null) { |
637 this._subtitleElement.textContent = statusUpdate.subtitle || ''; | 638 this._subtitleElement.textContent = statusUpdate.subtitle || ''; |
638 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle ); | 639 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle ); |
639 } | 640 } |
640 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) | 641 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) |
641 this.listItemElement.classList.toggle('wait', statusUpdate.wait); | 642 this.listItemElement.classList.toggle('wait', statusUpdate.wait); |
642 } | 643 } |
643 | 644 |
645 /** | |
646 * @override | |
647 * @param {!Event} event | |
648 * @return {boolean} | |
649 */ | |
650 ondblclick(event) { | |
651 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
| |
652 return false; | |
653 this._startEditing(/** @type {!Element} */ (event.target)); | |
654 return false; | |
655 } | |
656 | |
657 /** | |
658 * @param {!Element} eventTarget | |
659 */ | |
660 _startEditing(eventTarget) { | |
661 var container = eventTarget.enclosingNodeOrSelfWithClass('title'); | |
662 if (!container) | |
663 return; | |
664 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
| |
665 var config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this)); | |
666 this._editing = UI.InplaceEditor.startEditing(container, config); | |
667 } | |
668 | |
669 /** | |
670 * @param {!Element} container | |
671 * @param {string} newTitle | |
672 */ | |
673 _editingCommitted(container, newTitle) { | |
674 delete this._editing; | |
675 this.profile.setTitle(newTitle); | |
676 } | |
677 | |
678 _editingCancelled() { | |
679 delete this._editing; | |
680 this._updateTitle(); | |
681 } | |
682 | |
683 _updateTitle() { | |
684 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
| |
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); |
690 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleC hanged, this._updateTitle, this); | |
647 } | 691 } |
648 | 692 |
649 /** | 693 /** |
650 * @override | 694 * @override |
651 * @return {boolean} | 695 * @return {boolean} |
652 */ | 696 */ |
653 onselect() { | 697 onselect() { |
654 this._dataDisplayDelegate.showProfile(this.profile); | 698 this._dataDisplayDelegate.showProfile(this.profile); |
655 return true; | 699 return true; |
656 } | 700 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 * @param {string} actionId | 859 * @param {string} actionId |
816 * @return {boolean} | 860 * @return {boolean} |
817 */ | 861 */ |
818 handleAction(context, actionId) { | 862 handleAction(context, actionId) { |
819 var panel = UI.context.flavor(Profiler.JSProfilerPanel); | 863 var panel = UI.context.flavor(Profiler.JSProfilerPanel); |
820 console.assert(panel && panel instanceof Profiler.JSProfilerPanel); | 864 console.assert(panel && panel instanceof Profiler.JSProfilerPanel); |
821 panel.toggleRecord(); | 865 panel.toggleRecord(); |
822 return true; | 866 return true; |
823 } | 867 } |
824 }; | 868 }; |
OLD | NEW |