| 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 return; | 590 return; |
| 591 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); | 591 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); |
| 592 if (!callFrame) | 592 if (!callFrame) |
| 593 return; | 593 return; |
| 594 var localScope = callFrame.localScope(); | 594 var localScope = callFrame.localScope(); |
| 595 if (!localScope) | 595 if (!localScope) |
| 596 return; | 596 return; |
| 597 var start = localScope.startLocation(); | 597 var start = localScope.startLocation(); |
| 598 var end = localScope.endLocation(); | 598 var end = localScope.endLocation(); |
| 599 var debuggerModel = callFrame.debuggerModel; | 599 var debuggerModel = callFrame.debuggerModel; |
| 600 var executionLocation = callFrame.location(); |
| 600 debuggerModel.getPossibleBreakpoints(start, end, true) | 601 debuggerModel.getPossibleBreakpoints(start, end, true) |
| 601 .then(locations => this.textEditor.operation(renderLocations.bind(this,
locations))); | 602 .then(locations => this.textEditor.operation(renderLocations.bind(this,
locations))); |
| 602 | 603 |
| 603 if (this._clearContinueToLocationsTimer) { | 604 if (this._clearContinueToLocationsTimer) { |
| 604 clearTimeout(this._clearContinueToLocationsTimer); | 605 clearTimeout(this._clearContinueToLocationsTimer); |
| 605 delete this._clearContinueToLocationsTimer; | 606 delete this._clearContinueToLocationsTimer; |
| 606 } | 607 } |
| 607 | 608 |
| 608 /** | 609 /** |
| 609 * @param {!Array<!SDK.DebuggerModel.Location>} locations | 610 * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations |
| 610 * @this {Sources.JavaScriptSourceFrame} | 611 * @this {Sources.JavaScriptSourceFrame} |
| 611 */ | 612 */ |
| 612 function renderLocations(locations) { | 613 function renderLocations(locations) { |
| 613 var bookmarks = this.textEditor.bookmarks( | 614 var bookmarks = this.textEditor.bookmarks( |
| 614 this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToL
ocationDecorationSymbol); | 615 this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToL
ocationDecorationSymbol); |
| 615 bookmarks.map(bookmark => bookmark.clear()); | 616 bookmarks.map(bookmark => bookmark.clear()); |
| 616 | 617 |
| 617 for (var location of locations) { | 618 for (var location of locations) { |
| 618 var icon = UI.Icon.create('smallicon-green-arrow'); | 619 var icon; |
| 620 var isCurrent = location.lineNumber === executionLocation.lineNumber && |
| 621 location.columnNumber === executionLocation.columnNumber; |
| 622 if (!isCurrent || (location.type !== SDK.DebuggerModel.BreakLocationType
.Call && |
| 623 location.type !== SDK.DebuggerModel.BreakLocationType
.Return)) { |
| 624 icon = UI.Icon.create('smallicon-green-arrow'); |
| 625 icon.addEventListener('click', location.continueToLocation.bind(locati
on)); |
| 626 } else if (location.type === SDK.DebuggerModel.BreakLocationType.Call) { |
| 627 icon = UI.Icon.create('smallicon-step-in'); |
| 628 icon.addEventListener('click', () => { |
| 629 debuggerModel.scheduleStepIntoAsync(); |
| 630 debuggerModel.stepInto(); |
| 631 }); |
| 632 } else if (location.type === SDK.DebuggerModel.BreakLocationType.Return)
{ |
| 633 icon = UI.Icon.create('smallicon-step-out'); |
| 634 icon.addEventListener('click', () => { |
| 635 debuggerModel.stepOut(); |
| 636 }); |
| 637 } |
| 619 icon.classList.add('cm-continue-to-location'); | 638 icon.classList.add('cm-continue-to-location'); |
| 620 icon.addEventListener('click', location.continueToLocation.bind(location
)); | |
| 621 icon.addEventListener('mousemove', hidePopoverAndConsumeEvent.bind(this)
); | 639 icon.addEventListener('mousemove', hidePopoverAndConsumeEvent.bind(this)
); |
| 622 this.textEditor.addBookmark( | 640 this.textEditor.addBookmark( |
| 623 location.lineNumber, location.columnNumber, icon, | 641 location.lineNumber, location.columnNumber, icon, |
| 624 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol); | 642 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol); |
| 625 } | 643 } |
| 626 } | 644 } |
| 627 | 645 |
| 628 /** | 646 /** |
| 629 * @param {!Event} event | 647 * @param {!Event} event |
| 630 * @this {Sources.JavaScriptSourceFrame} | 648 * @this {Sources.JavaScriptSourceFrame} |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 return; | 1459 return; |
| 1442 this.bookmark.clear(); | 1460 this.bookmark.clear(); |
| 1443 this.bookmark = null; | 1461 this.bookmark = null; |
| 1444 } | 1462 } |
| 1445 }; | 1463 }; |
| 1446 | 1464 |
| 1447 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); | 1465 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); |
| 1448 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); | 1466 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); |
| 1449 | 1467 |
| 1450 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); | 1468 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); |
| OLD | NEW |