| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 509 |
| 510 /** | 510 /** |
| 511 * @param {!MouseEvent} event | 511 * @param {!MouseEvent} event |
| 512 */ | 512 */ |
| 513 _onMouseMove(event) { | 513 _onMouseMove(event) { |
| 514 if (this._executionLocation && this._controlDown && UI.KeyboardShortcut.even
tHasCtrlOrMeta(event)) { | 514 if (this._executionLocation && this._controlDown && UI.KeyboardShortcut.even
tHasCtrlOrMeta(event)) { |
| 515 if (!this._continueToLocationDecorations) | 515 if (!this._continueToLocationDecorations) |
| 516 this._showContinueToLocations(); | 516 this._showContinueToLocations(); |
| 517 } | 517 } |
| 518 if (this._continueToLocationDecorations) { | 518 if (this._continueToLocationDecorations) { |
| 519 this.textEditor.element.classList.toggle( | 519 var textPosition = this.textEditor.coordinatesToCursorPosition(event.x, ev
ent.y); |
| 520 'source-frame-async-step-in-hovered', | 520 var hovering = !!event.target.enclosingNodeOrSelfWithClass('source-frame-a
sync-step-in'); |
| 521 !!event.target.enclosingNodeOrSelfWithClass('source-frame-async-step-i
n')); | 521 this._setAsyncStepInHoveredLine(textPosition ? textPosition.startLine : nu
ll, hovering); |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 | 524 |
| 525 /** | 525 /** |
| 526 * @param {?number} line |
| 527 * @param {boolean} hovered |
| 528 */ |
| 529 _setAsyncStepInHoveredLine(line, hovered) { |
| 530 if (this._asyncStepInHoveredLine === line && this._asyncStepInHovered === ho
vered) |
| 531 return; |
| 532 if (this._asyncStepInHovered && this._asyncStepInHoveredLine) |
| 533 this.textEditor.toggleLineClass(this._asyncStepInHoveredLine, 'source-fram
e-async-step-in-hovered', false); |
| 534 this._asyncStepInHoveredLine = line; |
| 535 this._asyncStepInHovered = hovered; |
| 536 if (this._asyncStepInHovered && this._asyncStepInHoveredLine) |
| 537 this.textEditor.toggleLineClass(this._asyncStepInHoveredLine, 'source-fram
e-async-step-in-hovered', true); |
| 538 } |
| 539 |
| 540 /** |
| 526 * @param {!MouseEvent} event | 541 * @param {!MouseEvent} event |
| 527 */ | 542 */ |
| 528 _onMouseDown(event) { | 543 _onMouseDown(event) { |
| 529 if (!this._executionLocation || !UI.KeyboardShortcut.eventHasCtrlOrMeta(even
t)) | 544 if (!this._executionLocation || !UI.KeyboardShortcut.eventHasCtrlOrMeta(even
t)) |
| 530 return; | 545 return; |
| 531 if (!this._continueToLocationDecorations) | 546 if (!this._continueToLocationDecorations) |
| 532 return; | 547 return; |
| 533 event.consume(); | 548 event.consume(); |
| 534 var textPosition = this.textEditor.coordinatesToCursorPosition(event.x, even
t.y); | 549 var textPosition = this.textEditor.coordinatesToCursorPosition(event.x, even
t.y); |
| 535 if (!textPosition) | 550 if (!textPosition) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 var highlightRange = new TextUtils.TextRange(lineNumber, token.startColu
mn, lineNumber, token.endColumn - 1); | 732 var highlightRange = new TextUtils.TextRange(lineNumber, token.startColu
mn, lineNumber, token.endColumn - 1); |
| 718 var decoration = this.textEditor.highlightRange(highlightRange, 'source-
frame-continue-to-location'); | 733 var decoration = this.textEditor.highlightRange(highlightRange, 'source-
frame-continue-to-location'); |
| 719 this._continueToLocationDecorations.set(decoration, location.continueToL
ocation.bind(location)); | 734 this._continueToLocationDecorations.set(decoration, location.continueToL
ocation.bind(location)); |
| 720 if (location.type === Protocol.Debugger.BreakLocationType.Call) | 735 if (location.type === Protocol.Debugger.BreakLocationType.Call) |
| 721 previousCallLine = lineNumber; | 736 previousCallLine = lineNumber; |
| 722 | 737 |
| 723 var isAsyncCall = (line[token.startColumn - 1] === '.' && tokenContent =
== 'then') || | 738 var isAsyncCall = (line[token.startColumn - 1] === '.' && tokenContent =
== 'then') || |
| 724 tokenContent === 'setTimeout' || tokenContent === 'setInterval'; | 739 tokenContent === 'setTimeout' || tokenContent === 'setInterval'; |
| 725 var isCurrentPosition = this._executionLocation && lineNumber === this._
executionLocation.lineNumber && | 740 var isCurrentPosition = this._executionLocation && lineNumber === this._
executionLocation.lineNumber && |
| 726 location.columnNumber === this._executionLocation.columnNumber; | 741 location.columnNumber === this._executionLocation.columnNumber; |
| 727 if (location.type === Protocol.Debugger.BreakLocationType.Call && isAsyn
cCall && isCurrentPosition) { | 742 if (location.type === Protocol.Debugger.BreakLocationType.Call && isAsyn
cCall) { |
| 728 var functionPosition = line.indexOf('(', token.endColumn); | 743 var functionPosition = line.indexOf('(', token.endColumn); |
| 729 if (functionPosition !== -1) { | 744 if (functionPosition !== -1) { |
| 730 functionPosition++; | 745 functionPosition++; |
| 731 while (functionPosition < line.length && line[functionPosition] ===
' ') | 746 while (functionPosition < line.length && line[functionPosition] ===
' ') |
| 732 functionPosition++; | 747 functionPosition++; |
| 733 var nextToken = this.textEditor.tokenAtTextPosition(lineNumber, func
tionPosition); | 748 var nextToken = this.textEditor.tokenAtTextPosition(lineNumber, func
tionPosition); |
| 734 if (nextToken) { | 749 if (nextToken) { |
| 735 if (line.substring(nextToken.startColumn, nextToken.endColumn) ===
'(') { | 750 if (line.substring(nextToken.startColumn, nextToken.endColumn) ===
'(') { |
| 736 var closeParen = line.indexOf(')', nextToken.endColumn); | 751 var closeParen = line.indexOf(')', nextToken.endColumn); |
| 737 nextToken.endColumn = closeParen === -1 ? line.length : closePar
en + 1; | 752 nextToken.endColumn = closeParen === -1 ? line.length : closePar
en + 1; |
| 738 } | 753 } |
| 739 highlightRange = | 754 highlightRange = |
| 740 new TextUtils.TextRange(lineNumber, nextToken.startColumn, lin
eNumber, nextToken.endColumn - 1); | 755 new TextUtils.TextRange(lineNumber, nextToken.startColumn, lin
eNumber, nextToken.endColumn - 1); |
| 741 decoration = this.textEditor.highlightRange(highlightRange, 'sourc
e-frame-async-step-in'); | 756 decoration = this.textEditor.highlightRange(highlightRange, 'sourc
e-frame-async-step-in'); |
| 742 this._continueToLocationDecorations.set(decoration, () => { | 757 this._continueToLocationDecorations.set( |
| 743 debuggerModel.scheduleStepIntoAsync(); | 758 decoration, this._asyncStepIn.bind(this, location, isCurrentPo
sition)); |
| 744 debuggerModel.stepInto(); | |
| 745 }); | |
| 746 } | 759 } |
| 747 } | 760 } |
| 748 } | 761 } |
| 749 } | 762 } |
| 750 } | 763 } |
| 751 } | 764 } |
| 752 | 765 |
| 753 /** | 766 /** |
| 767 * @param {!SDK.DebuggerModel.BreakLocation} location |
| 768 * @param {boolean} isCurrentPosition |
| 769 */ |
| 770 _asyncStepIn(location, isCurrentPosition) { |
| 771 if (!isCurrentPosition) |
| 772 location.continueToLocation(asyncStepIn); |
| 773 else |
| 774 asyncStepIn(); |
| 775 |
| 776 function asyncStepIn() { |
| 777 location.debuggerModel.scheduleStepIntoAsync(); |
| 778 location.debuggerModel.stepInto(); |
| 779 } |
| 780 } |
| 781 |
| 782 /** |
| 754 * @param {!SDK.DebuggerModel.CallFrame} callFrame | 783 * @param {!SDK.DebuggerModel.CallFrame} callFrame |
| 755 * @param {?Array.<!SDK.RemoteObjectProperty>} properties | 784 * @param {?Array.<!SDK.RemoteObjectProperty>} properties |
| 756 * @param {?Array.<!SDK.RemoteObjectProperty>} internalProperties | 785 * @param {?Array.<!SDK.RemoteObjectProperty>} internalProperties |
| 757 */ | 786 */ |
| 758 _prepareScopeVariables(callFrame, properties, internalProperties) { | 787 _prepareScopeVariables(callFrame, properties, internalProperties) { |
| 759 if (!properties || !properties.length || properties.length > 500 || !this.is
Showing()) { | 788 if (!properties || !properties.length || properties.length > 500 || !this.is
Showing()) { |
| 760 this._clearValueWidgets(); | 789 this._clearValueWidgets(); |
| 761 return; | 790 return; |
| 762 } | 791 } |
| 763 | 792 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 }); | 942 }); |
| 914 } | 943 } |
| 915 | 944 |
| 916 _clearContinueToLocationsNoRestore() { | 945 _clearContinueToLocationsNoRestore() { |
| 917 if (!this._continueToLocationDecorations) | 946 if (!this._continueToLocationDecorations) |
| 918 return; | 947 return; |
| 919 this.textEditor.operation(() => { | 948 this.textEditor.operation(() => { |
| 920 for (var decoration of this._continueToLocationDecorations.keys()) | 949 for (var decoration of this._continueToLocationDecorations.keys()) |
| 921 this.textEditor.removeHighlight(decoration); | 950 this.textEditor.removeHighlight(decoration); |
| 922 this._continueToLocationDecorations = null; | 951 this._continueToLocationDecorations = null; |
| 923 this.textEditor.element.classList.remove('source-frame-async-step-in-hover
ed'); | 952 this._setAsyncStepInHoveredLine(null, false); |
| 924 }); | 953 }); |
| 925 } | 954 } |
| 926 | 955 |
| 927 _clearContinueToLocations() { | 956 _clearContinueToLocations() { |
| 928 if (!this._continueToLocationDecorations) | 957 if (!this._continueToLocationDecorations) |
| 929 return; | 958 return; |
| 930 this.textEditor.operation(() => { | 959 this.textEditor.operation(() => { |
| 931 this.textEditor.showExecutionLineBackground(); | 960 this.textEditor.showExecutionLineBackground(); |
| 932 this._generateValuesInSource(); | 961 this._generateValuesInSource(); |
| 933 this._clearContinueToLocationsNoRestore(); | 962 this._clearContinueToLocationsNoRestore(); |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 return; | 1606 return; |
| 1578 this.bookmark.clear(); | 1607 this.bookmark.clear(); |
| 1579 this.bookmark = null; | 1608 this.bookmark = null; |
| 1580 } | 1609 } |
| 1581 }; | 1610 }; |
| 1582 | 1611 |
| 1583 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); | 1612 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); |
| 1584 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); | 1613 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); |
| 1585 | 1614 |
| 1586 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); | 1615 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); |
| OLD | NEW |