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

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

Issue 661103002: DevTools: make web component anchor handling go the generic route. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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-") ;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698