| 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 588 } |
| 589 } | 589 } |
| 590 | 590 |
| 591 _showContinueToLocations() { | 591 _showContinueToLocations() { |
| 592 var executionContext = UI.context.flavor(SDK.ExecutionContext); | 592 var executionContext = UI.context.flavor(SDK.ExecutionContext); |
| 593 if (!executionContext) | 593 if (!executionContext) |
| 594 return; | 594 return; |
| 595 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); | 595 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); |
| 596 if (!callFrame) | 596 if (!callFrame) |
| 597 return; | 597 return; |
| 598 if (this._clearContinueToLocationsTimer) { |
| 599 clearTimeout(this._clearContinueToLocationsTimer); |
| 600 delete this._clearContinueToLocationsTimer; |
| 601 } |
| 598 var localScope = callFrame.localScope(); | 602 var localScope = callFrame.localScope(); |
| 599 if (!localScope) | 603 if (!localScope) { |
| 604 this.textEditor.operation(clearExistingLocations.bind(this)); |
| 600 return; | 605 return; |
| 606 } |
| 601 var start = localScope.startLocation(); | 607 var start = localScope.startLocation(); |
| 602 var end = localScope.endLocation(); | 608 var end = localScope.endLocation(); |
| 603 var debuggerModel = callFrame.debuggerModel; | 609 var debuggerModel = callFrame.debuggerModel; |
| 604 var executionLocation = callFrame.location(); | 610 var executionLocation = callFrame.location(); |
| 605 debuggerModel.getPossibleBreakpoints(start, end, true) | 611 debuggerModel.getPossibleBreakpoints(start, end, true) |
| 606 .then(locations => this.textEditor.operation(renderLocations.bind(this,
locations))); | 612 .then(locations => this.textEditor.operation(renderLocations.bind(this,
locations))); |
| 607 | 613 |
| 608 if (this._clearContinueToLocationsTimer) { | |
| 609 clearTimeout(this._clearContinueToLocationsTimer); | |
| 610 delete this._clearContinueToLocationsTimer; | |
| 611 } | |
| 612 | |
| 613 /** | 614 /** |
| 614 * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations | 615 * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations |
| 615 * @this {Sources.JavaScriptSourceFrame} | 616 * @this {Sources.JavaScriptSourceFrame} |
| 616 */ | 617 */ |
| 617 function renderLocations(locations) { | 618 function renderLocations(locations) { |
| 618 var bookmarks = this.textEditor.bookmarks( | 619 clearExistingLocations.call(this); |
| 619 this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToL
ocationDecorationSymbol); | |
| 620 bookmarks.map(bookmark => bookmark.clear()); | |
| 621 | |
| 622 for (var location of locations) { | 620 for (var location of locations) { |
| 623 var icon; | 621 var icon; |
| 624 var isCurrent = location.lineNumber === executionLocation.lineNumber && | 622 var isCurrent = location.lineNumber === executionLocation.lineNumber && |
| 625 location.columnNumber === executionLocation.columnNumber; | 623 location.columnNumber === executionLocation.columnNumber; |
| 626 if (!isCurrent || (location.type !== SDK.DebuggerModel.BreakLocationType
.Call && | 624 if (!isCurrent || (location.type !== SDK.DebuggerModel.BreakLocationType
.Call && |
| 627 location.type !== SDK.DebuggerModel.BreakLocationType
.Return)) { | 625 location.type !== SDK.DebuggerModel.BreakLocationType
.Return)) { |
| 628 icon = UI.Icon.create('smallicon-green-arrow'); | 626 icon = UI.Icon.create('smallicon-green-arrow'); |
| 629 icon.addEventListener('click', location.continueToLocation.bind(locati
on)); | 627 icon.addEventListener('click', location.continueToLocation.bind(locati
on)); |
| 630 } else if (location.type === SDK.DebuggerModel.BreakLocationType.Call) { | 628 } else if (location.type === SDK.DebuggerModel.BreakLocationType.Call) { |
| 631 icon = UI.Icon.create('smallicon-step-in'); | 629 icon = UI.Icon.create('smallicon-step-in'); |
| 632 icon.addEventListener('click', () => { | 630 icon.addEventListener('click', () => { |
| 633 debuggerModel.scheduleStepIntoAsync(); | 631 debuggerModel.scheduleStepIntoAsync(); |
| 634 debuggerModel.stepInto(); | 632 debuggerModel.stepInto(); |
| 635 }); | 633 }); |
| 636 } else if (location.type === SDK.DebuggerModel.BreakLocationType.Return)
{ | 634 } else if (location.type === SDK.DebuggerModel.BreakLocationType.Return)
{ |
| 637 icon = UI.Icon.create('smallicon-step-out'); | 635 icon = UI.Icon.create('smallicon-step-out'); |
| 638 icon.addEventListener('click', () => { | 636 icon.addEventListener('click', () => { |
| 639 debuggerModel.stepOut(); | 637 debuggerModel.stepOut(); |
| 640 }); | 638 }); |
| 641 } | 639 } |
| 642 icon.classList.add('cm-continue-to-location'); | 640 icon.classList.add('cm-continue-to-location'); |
| 643 icon.addEventListener('mousemove', hidePopoverAndConsumeEvent.bind(this)
); | 641 icon.addEventListener('mousemove', hidePopoverAndConsumeEvent.bind(this)
); |
| 644 this.textEditor.addBookmark( | 642 this.textEditor.addBookmark( |
| 645 location.lineNumber, location.columnNumber, icon, | 643 location.lineNumber, location.columnNumber, icon, |
| 646 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol); | 644 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol); |
| 647 } | 645 } |
| 648 } | 646 } |
| 649 | 647 |
| 650 /** | 648 /** |
| 649 * @this {Sources.JavaScriptSourceFrame} |
| 650 */ |
| 651 function clearExistingLocations() { |
| 652 var bookmarks = this.textEditor.bookmarks( |
| 653 this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToL
ocationDecorationSymbol); |
| 654 bookmarks.map(bookmark => bookmark.clear()); |
| 655 } |
| 656 |
| 657 /** |
| 651 * @param {!Event} event | 658 * @param {!Event} event |
| 652 * @this {Sources.JavaScriptSourceFrame} | 659 * @this {Sources.JavaScriptSourceFrame} |
| 653 */ | 660 */ |
| 654 function hidePopoverAndConsumeEvent(event) { | 661 function hidePopoverAndConsumeEvent(event) { |
| 655 event.consume(true); | 662 event.consume(true); |
| 656 this._popoverHelper.hidePopover(); | 663 this._popoverHelper.hidePopover(); |
| 657 } | 664 } |
| 658 } | 665 } |
| 659 | 666 |
| 660 /** | 667 /** |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 return; | 1470 return; |
| 1464 this.bookmark.clear(); | 1471 this.bookmark.clear(); |
| 1465 this.bookmark = null; | 1472 this.bookmark = null; |
| 1466 } | 1473 } |
| 1467 }; | 1474 }; |
| 1468 | 1475 |
| 1469 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); | 1476 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); |
| 1470 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); | 1477 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); |
| 1471 | 1478 |
| 1472 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); | 1479 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); |
| OLD | NEW |