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

Side by Side Diff: Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 472793002: DevTools: Make TextEditor.tokenAtTextPosition() return exclusive end column (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix remaining cases Created 6 years, 4 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 | « Source/devtools/front_end/sources/CSSSourceFrame.js ('k') | no next file » | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 }; 508 };
509 anchorBox.forSelection = true; 509 anchorBox.forSelection = true;
510 return anchorBox; 510 return anchorBox;
511 } 511 }
512 512
513 var token = this.textEditor.tokenAtTextPosition(textPosition.startLine, textPosition.startColumn); 513 var token = this.textEditor.tokenAtTextPosition(textPosition.startLine, textPosition.startColumn);
514 if (!token) 514 if (!token)
515 return; 515 return;
516 var lineNumber = textPosition.startLine; 516 var lineNumber = textPosition.startLine;
517 var line = this.textEditor.line(lineNumber); 517 var line = this.textEditor.line(lineNumber);
518 var tokenContent = line.substring(token.startColumn, token.endColumn + 1 ); 518 var tokenContent = line.substring(token.startColumn, token.endColumn);
519 519
520 var isIdentifier = token.type.startsWith("js-variable") || token.type.st artsWith("js-property") || token.type == "js-def"; 520 var isIdentifier = token.type.startsWith("js-variable") || token.type.st artsWith("js-property") || token.type == "js-def";
521 if (!isIdentifier && (token.type !== "js-keyword" || tokenContent !== "t his")) 521 if (!isIdentifier && (token.type !== "js-keyword" || tokenContent !== "t his"))
522 return; 522 return;
523 523
524 var leftCorner = this.textEditor.cursorPositionToCoordinates(lineNumber, token.startColumn); 524 var leftCorner = this.textEditor.cursorPositionToCoordinates(lineNumber, token.startColumn);
525 var rightCorner = this.textEditor.cursorPositionToCoordinates(lineNumber , token.endColumn + 1); 525 var rightCorner = this.textEditor.cursorPositionToCoordinates(lineNumber , token.endColumn - 1);
526 var anchorBox = new AnchorBox(leftCorner.x, leftCorner.y, rightCorner.x - leftCorner.x, leftCorner.height); 526 var anchorBox = new AnchorBox(leftCorner.x, leftCorner.y, rightCorner.x - leftCorner.x, leftCorner.height);
527 527
528 anchorBox.highlight = { 528 anchorBox.highlight = {
529 lineNumber: lineNumber, 529 lineNumber: lineNumber,
530 startColumn: token.startColumn, 530 startColumn: token.startColumn,
531 endColumn: token.endColumn 531 endColumn: token.endColumn - 1
532 }; 532 };
533 533
534 return anchorBox; 534 return anchorBox;
535 }, 535 },
536 536
537 _resolveObjectForPopover: function(anchorBox, showCallback, objectGroupName) 537 _resolveObjectForPopover: function(anchorBox, showCallback, objectGroupName)
538 { 538 {
539 var target = WebInspector.context.flavor(WebInspector.Target); 539 var target = WebInspector.context.flavor(WebInspector.Target);
540 if (!target || !target.debuggerModel.isPaused()) { 540 if (!target || !target.debuggerModel.isPaused()) {
541 this._popoverHelper.hidePopover(); 541 this._popoverHelper.hidePopover();
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this); 910 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this);
911 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); 911 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this);
912 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); 912 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this);
913 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. TitleChanged, this._showBlackboxInfobarIfNeeded, this); 913 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. TitleChanged, this._showBlackboxInfobarIfNeeded, this);
914 WebInspector.settings.skipStackFramesPattern.removeChangeListener(this._ showBlackboxInfobarIfNeeded, this); 914 WebInspector.settings.skipStackFramesPattern.removeChangeListener(this._ showBlackboxInfobarIfNeeded, this);
915 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); 915 WebInspector.UISourceCodeFrame.prototype.dispose.call(this);
916 }, 916 },
917 917
918 __proto__: WebInspector.UISourceCodeFrame.prototype 918 __proto__: WebInspector.UISourceCodeFrame.prototype
919 } 919 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sources/CSSSourceFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698