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 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 return stream.column() === selectionStart.ch ? "token-highlight colu
mn-with-selection" : "token-highlight"; | 1416 return stream.column() === selectionStart.ch ? "token-highlight colu
mn-with-selection" : "token-highlight"; |
1417 | 1417 |
1418 var eatenChar; | 1418 var eatenChar; |
1419 do { | 1419 do { |
1420 eatenChar = stream.next(); | 1420 eatenChar = stream.next(); |
1421 } while (eatenChar && (WebInspector.TextUtils.isWordChar(eatenChar) || s
tream.peek() !== tokenFirstChar)); | 1421 } while (eatenChar && (WebInspector.TextUtils.isWordChar(eatenChar) || s
tream.peek() !== tokenFirstChar)); |
1422 }, | 1422 }, |
1423 | 1423 |
1424 /** | 1424 /** |
1425 * @param {function(!CodeMirror.StringStream)} highlighter | 1425 * @param {function(!CodeMirror.StringStream)} highlighter |
| 1426 * @param {?CodeMirror.Pos} selectionStart |
1426 */ | 1427 */ |
1427 _setHighlighter: function(highlighter, selectionStart) | 1428 _setHighlighter: function(highlighter, selectionStart) |
1428 { | 1429 { |
1429 var overlayMode = { | 1430 var overlayMode = { |
1430 token: highlighter | 1431 token: highlighter |
1431 }; | 1432 }; |
1432 this._codeMirror.addOverlay(overlayMode); | 1433 this._codeMirror.addOverlay(overlayMode); |
1433 this._highlightDescriptor = { | 1434 this._highlightDescriptor = { |
1434 overlay: overlayMode, | 1435 overlay: overlayMode, |
1435 selectionStart: selectionStart | 1436 selectionStart: selectionStart |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 2124 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
2124 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 2125 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
2125 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 2126 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
2126 if (!foregroundColorRule && !backgroundColorRule) | 2127 if (!foregroundColorRule && !backgroundColorRule) |
2127 return; | 2128 return; |
2128 | 2129 |
2129 var style = document.createElement("style"); | 2130 var style = document.createElement("style"); |
2130 style.textContent = backgroundColorRule + foregroundColorRule; | 2131 style.textContent = backgroundColorRule + foregroundColorRule; |
2131 document.head.appendChild(style); | 2132 document.head.appendChild(style); |
2132 })(); | 2133 })(); |
OLD | NEW |