OLD | NEW |
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 */ | 727 */ |
728 tokenAtTextPosition: function(lineNumber, column) | 728 tokenAtTextPosition: function(lineNumber, column) |
729 { | 729 { |
730 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount()) | 730 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount()) |
731 return null; | 731 return null; |
732 var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, (
column || 0) + 1)); | 732 var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, (
column || 0) + 1)); |
733 if (!token || !token.type) | 733 if (!token || !token.type) |
734 return null; | 734 return null; |
735 return { | 735 return { |
736 startColumn: token.start, | 736 startColumn: token.start, |
737 endColumn: token.end - 1, | 737 endColumn: token.end, |
738 type: token.type | 738 type: token.type |
739 }; | 739 }; |
740 }, | 740 }, |
741 | 741 |
742 /** | 742 /** |
743 * @param {!WebInspector.TextRange} textRange | 743 * @param {!WebInspector.TextRange} textRange |
744 * @return {string} | 744 * @return {string} |
745 */ | 745 */ |
746 copyRange: function(textRange) | 746 copyRange: function(textRange) |
747 { | 747 { |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 2406 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
2407 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 2407 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
2408 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 2408 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
2409 if (!foregroundColorRule && !backgroundColorRule) | 2409 if (!foregroundColorRule && !backgroundColorRule) |
2410 return; | 2410 return; |
2411 | 2411 |
2412 var style = document.createElement("style"); | 2412 var style = document.createElement("style"); |
2413 style.textContent = backgroundColorRule + foregroundColorRule; | 2413 style.textContent = backgroundColorRule + foregroundColorRule; |
2414 document.head.appendChild(style); | 2414 document.head.appendChild(style); |
2415 })(); | 2415 })(); |
OLD | NEW |