Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: Source/devtools/front_end/CodeMirrorTextEditor.js

Issue 203433002: DevTools: Reuse _showSourceLocation for execution line changes handling in sources panel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined and fixed highlighting after execution line changes Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/SourcesPanel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 if (classes[i].startsWith("cm-breakpoint")) 752 if (classes[i].startsWith("cm-breakpoint"))
753 this._codeMirror.removeLineClass(lineNumber, "wrap", classes[i]) ; 753 this._codeMirror.removeLineClass(lineNumber, "wrap", classes[i]) ;
754 } 754 }
755 }, 755 },
756 756
757 /** 757 /**
758 * @param {number} lineNumber 758 * @param {number} lineNumber
759 */ 759 */
760 setExecutionLine: function(lineNumber) 760 setExecutionLine: function(lineNumber)
761 { 761 {
762 this.clearPositionHighlight();
762 this._executionLine = this._codeMirror.getLineHandle(lineNumber); 763 this._executionLine = this._codeMirror.getLineHandle(lineNumber);
764 if (!this._executionLine)
765 return;
763 this._codeMirror.addLineClass(this._executionLine, "wrap", "cm-execution -line"); 766 this._codeMirror.addLineClass(this._executionLine, "wrap", "cm-execution -line");
764 }, 767 },
765 768
766 clearExecutionLine: function() 769 clearExecutionLine: function()
767 { 770 {
771 this.clearPositionHighlight();
768 if (this._executionLine) 772 if (this._executionLine)
769 this._codeMirror.removeLineClass(this._executionLine, "wrap", "cm-ex ecution-line"); 773 this._codeMirror.removeLineClass(this._executionLine, "wrap", "cm-ex ecution-line");
770 delete this._executionLine; 774 delete this._executionLine;
771 }, 775 },
772 776
773 /** 777 /**
774 * @param {number} lineNumber 778 * @param {number} lineNumber
775 * @param {!Element} element 779 * @param {!Element} element
776 */ 780 */
777 addDecoration: function(lineNumber, element) 781 addDecoration: function(lineNumber, element)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 } 818 }
815 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber, columnNumber)); 819 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber, columnNumber));
816 }, 820 },
817 821
818 clearPositionHighlight: function() 822 clearPositionHighlight: function()
819 { 823 {
820 if (this._clearHighlightTimeout) 824 if (this._clearHighlightTimeout)
821 clearTimeout(this._clearHighlightTimeout); 825 clearTimeout(this._clearHighlightTimeout);
822 delete this._clearHighlightTimeout; 826 delete this._clearHighlightTimeout;
823 827
824 if (this._highlightedLine) 828 if (this._highlightedLine)
825 this._codeMirror.removeLineClass(this._highlightedLine, null, "cm-hi ghlight"); 829 this._codeMirror.removeLineClass(this._highlightedLine, null, "cm-hi ghlight");
826 delete this._highlightedLine; 830 delete this._highlightedLine;
827 }, 831 },
828 832
829 /** 833 /**
830 * @return {!Array.<!Element>} 834 * @return {!Array.<!Element>}
831 */ 835 */
832 elementsToRestoreScrollPositionsFor: function() 836 elementsToRestoreScrollPositionsFor: function()
833 { 837 {
834 return []; 838 return [];
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte d { background-color: " + backgroundColor + ";}" : ""; 1723 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte d { background-color: " + backgroundColor + ";}" : "";
1720 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); 1724 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor();
1721 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import ant;}" : ""; 1725 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import ant;}" : "";
1722 if (!foregroundColorRule && !backgroundColorRule) 1726 if (!foregroundColorRule && !backgroundColorRule)
1723 return; 1727 return;
1724 1728
1725 var style = document.createElement("style"); 1729 var style = document.createElement("style");
1726 style.textContent = backgroundColorRule + foregroundColorRule; 1730 style.textContent = backgroundColorRule + foregroundColorRule;
1727 document.head.appendChild(style); 1731 document.head.appendChild(style);
1728 })(); 1732 })();
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/SourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698