Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js |
| index 871728aee8367a93d3d38f24ae44c29966f1355d..90d35f9a69d85b5355a3bbba204041c5cf2a1f88 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js |
| @@ -516,12 +516,27 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { |
| this._showContinueToLocations(); |
| } |
| if (this._continueToLocationDecorations) { |
| - this.textEditor.element.classList.toggle( |
| - 'source-frame-async-step-in-hovered', |
| - !!event.target.enclosingNodeOrSelfWithClass('source-frame-async-step-in')); |
| + var hovering = !!event.target.enclosingNodeOrSelfWithClass('source-frame-async-step-in'); |
| + var line = event.target.enclosingNodeOrSelfWithClass('CodeMirror-line'); |
|
lushnikov
2017/05/12 19:47:57
let's use codemirror's coordinatesToCursorPosition
dgozman
2017/05/12 21:02:39
Done.
|
| + this._highlightAsyncStepIn(line, hovering); |
| } |
| } |
| + /** |
| + * @param {?Element} element |
| + * @param {boolean} highlight |
| + */ |
| + _highlightAsyncStepIn(element, highlight) { |
| + if (this._asyncStepInElement === element && this._asyncStepInHighlight === highlight) |
|
lushnikov
2017/05/12 19:47:57
Let's rename _asyncStepInElement into _highlightAs
dgozman
2017/05/12 21:02:39
Done.
|
| + return; |
| + if (this._asyncStepInHighlight && this._asyncStepInElement) |
| + this._asyncStepInElement.classList.remove('source-frame-async-step-in-hovered'); |
| + this._asyncStepInElement = element; |
| + this._asyncStepInHighlight = highlight; |
| + if (this._asyncStepInHighlight && this._asyncStepInElement) |
| + this._asyncStepInElement.classList.add('source-frame-async-step-in-hovered'); |
| + } |
| + |
| /** |
| * @param {!MouseEvent} event |
| */ |
| @@ -724,7 +739,7 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { |
| tokenContent === 'setTimeout' || tokenContent === 'setInterval'; |
| var isCurrentPosition = this._executionLocation && lineNumber === this._executionLocation.lineNumber && |
| location.columnNumber === this._executionLocation.columnNumber; |
| - if (location.type === Protocol.Debugger.BreakLocationType.Call && isAsyncCall && isCurrentPosition) { |
| + if (location.type === Protocol.Debugger.BreakLocationType.Call && isAsyncCall) { |
| var functionPosition = line.indexOf('(', token.endColumn); |
| if (functionPosition !== -1) { |
| functionPosition++; |
| @@ -739,10 +754,8 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { |
| highlightRange = |
| new TextUtils.TextRange(lineNumber, nextToken.startColumn, lineNumber, nextToken.endColumn - 1); |
| decoration = this.textEditor.highlightRange(highlightRange, 'source-frame-async-step-in'); |
| - this._continueToLocationDecorations.set(decoration, () => { |
| - debuggerModel.scheduleStepIntoAsync(); |
| - debuggerModel.stepInto(); |
| - }); |
| + this._continueToLocationDecorations.set( |
| + decoration, this._asyncStepIn.bind(this, location, isCurrentPosition)); |
| } |
| } |
| } |
| @@ -750,6 +763,22 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { |
| } |
| } |
| + /** |
| + * @param {!SDK.DebuggerModel.BreakLocation} location |
| + * @param {boolean} isCurrentPosition |
| + */ |
| + _asyncStepIn(location, isCurrentPosition) { |
| + if (!isCurrentPosition) |
| + location.continueToLocation(asyncStepIn); |
| + else |
| + asyncStepIn(); |
| + |
| + function asyncStepIn() { |
| + location.debuggerModel.scheduleStepIntoAsync(); |
| + location.debuggerModel.stepInto(); |
| + } |
| + } |
| + |
| /** |
| * @param {!SDK.DebuggerModel.CallFrame} callFrame |
| * @param {?Array.<!SDK.RemoteObjectProperty>} properties |
| @@ -920,7 +949,7 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { |
| for (var decoration of this._continueToLocationDecorations.keys()) |
| this.textEditor.removeHighlight(decoration); |
| this._continueToLocationDecorations = null; |
| - this.textEditor.element.classList.remove('source-frame-async-step-in-hovered'); |
| + this._highlightAsyncStepIn(null, false); |
| }); |
| } |