| OLD | NEW |
| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 { | 417 { |
| 418 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(thi
s._uiSourceCode); | 418 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(thi
s._uiSourceCode); |
| 419 for (var i = 0; i < breakpoints.length; ++i) | 419 for (var i = 0; i < breakpoints.length; ++i) |
| 420 breakpoints[i].remove(); | 420 breakpoints[i].remove(); |
| 421 }, | 421 }, |
| 422 | 422 |
| 423 _getPopoverAnchor: function(element, event) | 423 _getPopoverAnchor: function(element, event) |
| 424 { | 424 { |
| 425 var target = WebInspector.context.flavor(WebInspector.Target); | 425 var target = WebInspector.context.flavor(WebInspector.Target); |
| 426 if (!target || !target.debuggerModel.isPaused()) | 426 if (!target || !target.debuggerModel.isPaused()) |
| 427 return null; | 427 return; |
| 428 | 428 |
| 429 var textPosition = this.textEditor.coordinatesToCursorPosition(event.x,
event.y); | 429 var textPosition = this.textEditor.coordinatesToCursorPosition(event.x,
event.y); |
| 430 if (!textPosition) | 430 if (!textPosition) |
| 431 return null; | 431 return; |
| 432 var mouseLine = textPosition.startLine; | 432 var mouseLine = textPosition.startLine; |
| 433 var mouseColumn = textPosition.startColumn; | 433 var mouseColumn = textPosition.startColumn; |
| 434 var textSelection = this.textEditor.selection().normalize(); | 434 var textSelection = this.textEditor.selection().normalize(); |
| 435 if (textSelection && !textSelection.isEmpty()) { | 435 if (textSelection && !textSelection.isEmpty()) { |
| 436 if (textSelection.startLine !== textSelection.endLine || textSelecti
on.startLine !== mouseLine || mouseColumn < textSelection.startColumn || mouseCo
lumn > textSelection.endColumn) | 436 if (textSelection.startLine !== textSelection.endLine || textSelecti
on.startLine !== mouseLine || mouseColumn < textSelection.startColumn || mouseCo
lumn > textSelection.endColumn) |
| 437 return null; | 437 return; |
| 438 | 438 |
| 439 var leftCorner = this.textEditor.cursorPositionToCoordinates(textSel
ection.startLine, textSelection.startColumn); | 439 var leftCorner = this.textEditor.cursorPositionToCoordinates(textSel
ection.startLine, textSelection.startColumn); |
| 440 var rightCorner = this.textEditor.cursorPositionToCoordinates(textSe
lection.endLine, textSelection.endColumn); | 440 var rightCorner = this.textEditor.cursorPositionToCoordinates(textSe
lection.endLine, textSelection.endColumn); |
| 441 var anchorBox = new AnchorBox(leftCorner.x, leftCorner.y, rightCorne
r.x - leftCorner.x, leftCorner.height); | 441 var anchorBox = new AnchorBox(leftCorner.x, leftCorner.y, rightCorne
r.x - leftCorner.x, leftCorner.height); |
| 442 anchorBox.highlight = { | 442 anchorBox.highlight = { |
| 443 lineNumber: textSelection.startLine, | 443 lineNumber: textSelection.startLine, |
| 444 startColumn: textSelection.startColumn, | 444 startColumn: textSelection.startColumn, |
| 445 endColumn: textSelection.endColumn - 1 | 445 endColumn: textSelection.endColumn - 1 |
| 446 }; | 446 }; |
| 447 anchorBox.forSelection = true; | 447 anchorBox.forSelection = true; |
| 448 return anchorBox; | 448 return anchorBox; |
| 449 } | 449 } |
| 450 | 450 |
| 451 var token = this.textEditor.tokenAtTextPosition(textPosition.startLine,
textPosition.startColumn); | 451 var token = this.textEditor.tokenAtTextPosition(textPosition.startLine,
textPosition.startColumn); |
| 452 if (!token) | 452 if (!token) |
| 453 return null; | 453 return; |
| 454 var lineNumber = textPosition.startLine; | 454 var lineNumber = textPosition.startLine; |
| 455 var line = this.textEditor.line(lineNumber); | 455 var line = this.textEditor.line(lineNumber); |
| 456 var tokenContent = line.substring(token.startColumn, token.endColumn + 1
); | 456 var tokenContent = line.substring(token.startColumn, token.endColumn + 1
); |
| 457 | 457 |
| 458 var isIdentifier = token.type.startsWith("js-variable") || token.type.st
artsWith("js-property") || token.type == "js-def"; | 458 var isIdentifier = token.type.startsWith("js-variable") || token.type.st
artsWith("js-property") || token.type == "js-def"; |
| 459 if (!isIdentifier && (token.type !== "js-keyword" || tokenContent !== "t
his")) | 459 if (!isIdentifier && (token.type !== "js-keyword" || tokenContent !== "t
his")) |
| 460 return null; | 460 return; |
| 461 | 461 |
| 462 var leftCorner = this.textEditor.cursorPositionToCoordinates(lineNumber,
token.startColumn); | 462 var leftCorner = this.textEditor.cursorPositionToCoordinates(lineNumber,
token.startColumn); |
| 463 var rightCorner = this.textEditor.cursorPositionToCoordinates(lineNumber
, token.endColumn + 1); | 463 var rightCorner = this.textEditor.cursorPositionToCoordinates(lineNumber
, token.endColumn + 1); |
| 464 var anchorBox = new AnchorBox(leftCorner.x, leftCorner.y, rightCorner.x
- leftCorner.x, leftCorner.height); | 464 var anchorBox = new AnchorBox(leftCorner.x, leftCorner.y, rightCorner.x
- leftCorner.x, leftCorner.height); |
| 465 | 465 |
| 466 anchorBox.highlight = { | 466 anchorBox.highlight = { |
| 467 lineNumber: lineNumber, | 467 lineNumber: lineNumber, |
| 468 startColumn: token.startColumn, | 468 startColumn: token.startColumn, |
| 469 endColumn: token.endColumn | 469 endColumn: token.endColumn |
| 470 }; | 470 }; |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
ConsoleMessageRemoved, this._consoleMessageRemoved, this); | 839 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
ConsoleMessageRemoved, this._consoleMessageRemoved, this); |
| 840 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
ConsoleMessagesCleared, this._consoleMessagesCleared, this); | 840 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
ConsoleMessagesCleared, this._consoleMessagesCleared, this); |
| 841 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
SourceMappingChanged, this._onSourceMappingChanged, this); | 841 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
SourceMappingChanged, this._onSourceMappingChanged, this); |
| 842 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyChanged, this._workingCopyChanged, this); | 842 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyChanged, this._workingCopyChanged, this); |
| 843 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyCommitted, this._workingCopyCommitted, this); | 843 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyCommitted, this._workingCopyCommitted, this); |
| 844 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); | 844 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); |
| 845 }, | 845 }, |
| 846 | 846 |
| 847 __proto__: WebInspector.UISourceCodeFrame.prototype | 847 __proto__: WebInspector.UISourceCodeFrame.prototype |
| 848 } | 848 } |
| OLD | NEW |