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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 }; | 743 }; |
744 }, | 744 }, |
745 | 745 |
746 /** | 746 /** |
747 * @param {number} x | 747 * @param {number} x |
748 * @param {number} y | 748 * @param {number} y |
749 * @return {?WebInspector.TextRange} | 749 * @return {?WebInspector.TextRange} |
750 */ | 750 */ |
751 coordinatesToCursorPosition: function(x, y) | 751 coordinatesToCursorPosition: function(x, y) |
752 { | 752 { |
753 var element = document.deepElementFromPoint(x, y); | 753 var element = this.element.ownerDocument.deepElementFromPoint(x, y); |
754 if (!element || !element.isSelfOrDescendant(this._codeMirror.getWrapperE
lement())) | 754 if (!element || !element.isSelfOrDescendant(this._codeMirror.getWrapperE
lement())) |
755 return null; | 755 return null; |
756 var gutterBox = this._codeMirror.getGutterElement().boxInWindow(); | 756 var gutterBox = this._codeMirror.getGutterElement().boxInWindow(); |
757 if (x >= gutterBox.x && x <= gutterBox.x + gutterBox.width && | 757 if (x >= gutterBox.x && x <= gutterBox.x + gutterBox.width && |
758 y >= gutterBox.y && y <= gutterBox.y + gutterBox.height) | 758 y >= gutterBox.y && y <= gutterBox.y + gutterBox.height) |
759 return null; | 759 return null; |
760 var coords = this._codeMirror.coordsChar({left: x, top: y}); | 760 var coords = this._codeMirror.coordsChar({left: x, top: y}); |
761 return WebInspector.CodeMirrorUtils.toRange(coords, coords); | 761 return WebInspector.CodeMirrorUtils.toRange(coords, coords); |
762 }, | 762 }, |
763 | 763 |
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 function tokenOverride(superToken, stream, state) | 2434 function tokenOverride(superToken, stream, state) |
2435 { | 2435 { |
2436 var token = superToken(stream, state); | 2436 var token = superToken(stream, state); |
2437 return token ? tokenPrefix + token.split(/ +/).join(" " + tokenPrefix) :
token; | 2437 return token ? tokenPrefix + token.split(/ +/).join(" " + tokenPrefix) :
token; |
2438 } | 2438 } |
2439 } | 2439 } |
2440 | 2440 |
2441 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-")
; | 2441 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-")
; |
2442 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript",
"js-"); | 2442 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript",
"js-"); |
2443 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-")
; | 2443 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-")
; |
OLD | NEW |