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