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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 if (!remoteObject) | 451 if (!remoteObject) |
452 return false; | 452 return false; |
453 objectPopoverHelper = await ObjectUI.ObjectPopoverHelper.buildObjectPopo
ver(remoteObject, popover); | 453 objectPopoverHelper = await ObjectUI.ObjectPopoverHelper.buildObjectPopo
ver(remoteObject, popover); |
454 var potentiallyUpdatedCallFrame = UI.context.flavor(SDK.DebuggerModel.Ca
llFrame); | 454 var potentiallyUpdatedCallFrame = UI.context.flavor(SDK.DebuggerModel.Ca
llFrame); |
455 if (!objectPopoverHelper || selectedCallFrame !== potentiallyUpdatedCall
Frame) { | 455 if (!objectPopoverHelper || selectedCallFrame !== potentiallyUpdatedCall
Frame) { |
456 debuggerModel.runtimeModel().releaseObjectGroup('popover'); | 456 debuggerModel.runtimeModel().releaseObjectGroup('popover'); |
457 if (objectPopoverHelper) | 457 if (objectPopoverHelper) |
458 objectPopoverHelper.dispose(); | 458 objectPopoverHelper.dispose(); |
459 return false; | 459 return false; |
460 } | 460 } |
461 var highlightRange = new Common.TextRange(lineNumber, startHighlight, li
neNumber, endHighlight); | 461 var highlightRange = new TextUtils.TextRange(lineNumber, startHighlight,
lineNumber, endHighlight); |
462 highlightDescriptor = this.textEditor.highlightRange(highlightRange, 'so
urce-frame-eval-expression'); | 462 highlightDescriptor = this.textEditor.highlightRange(highlightRange, 'so
urce-frame-eval-expression'); |
463 return true; | 463 return true; |
464 }, | 464 }, |
465 hide: () => { | 465 hide: () => { |
466 objectPopoverHelper.dispose(); | 466 objectPopoverHelper.dispose(); |
467 debuggerModel.runtimeModel().releaseObjectGroup('popover'); | 467 debuggerModel.runtimeModel().releaseObjectGroup('popover'); |
468 this.textEditor.removeHighlight(highlightDescriptor); | 468 this.textEditor.removeHighlight(highlightDescriptor); |
469 } | 469 } |
470 }; | 470 }; |
471 } | 471 } |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 for (var lineNumber of lineNumbers) { | 863 for (var lineNumber of lineNumbers) { |
864 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint', false); | 864 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint', false); |
865 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint-disabled', fa
lse); | 865 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint-disabled', fa
lse); |
866 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint-conditional',
false); | 866 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint-conditional',
false); |
867 | 867 |
868 var decorations = this._lineBreakpointDecorations(lineNumber); | 868 var decorations = this._lineBreakpointDecorations(lineNumber); |
869 var actualBookmarks = | 869 var actualBookmarks = |
870 new Set(decorations.map(decoration => decoration.bookmark).filter(bo
okmark => !!bookmark)); | 870 new Set(decorations.map(decoration => decoration.bookmark).filter(bo
okmark => !!bookmark)); |
871 var lineEnd = this.textEditor.line(lineNumber).length; | 871 var lineEnd = this.textEditor.line(lineNumber).length; |
872 var bookmarks = this.textEditor.bookmarks( | 872 var bookmarks = this.textEditor.bookmarks( |
873 new Common.TextRange(lineNumber, 0, lineNumber, lineEnd), | 873 new TextUtils.TextRange(lineNumber, 0, lineNumber, lineEnd), |
874 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol); | 874 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol); |
875 for (var bookmark of bookmarks) { | 875 for (var bookmark of bookmarks) { |
876 if (!actualBookmarks.has(bookmark)) | 876 if (!actualBookmarks.has(bookmark)) |
877 bookmark.clear(); | 877 bookmark.clear(); |
878 } | 878 } |
879 if (!decorations.length) | 879 if (!decorations.length) |
880 continue; | 880 continue; |
881 decorations.sort(Sources.JavaScriptSourceFrame.BreakpointDecoration.most
SpecificFirst); | 881 decorations.sort(Sources.JavaScriptSourceFrame.BreakpointDecoration.most
SpecificFirst); |
882 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint', true); | 882 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint', true); |
883 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint-disabled', !d
ecorations[0].enabled || this._muted); | 883 this.textEditor.toggleLineClass(lineNumber, 'cm-breakpoint-disabled', !d
ecorations[0].enabled || this._muted); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 decoration.element.addEventListener( | 996 decoration.element.addEventListener( |
997 'contextmenu', this._inlineBreakpointContextMenu.bind(this, decoration
), true); | 997 'contextmenu', this._inlineBreakpointContextMenu.bind(this, decoration
), true); |
998 this._breakpointDecorations.add(decoration); | 998 this._breakpointDecorations.add(decoration); |
999 } | 999 } |
1000 this._decorationByBreakpoint.set(breakpoint, decoration); | 1000 this._decorationByBreakpoint.set(breakpoint, decoration); |
1001 this._updateBreakpointDecoration(decoration); | 1001 this._updateBreakpointDecoration(decoration); |
1002 if (!lineDecorations.length) { | 1002 if (!lineDecorations.length) { |
1003 this._willAddInlineDecorationsForTest(); | 1003 this._willAddInlineDecorationsForTest(); |
1004 this._breakpointManager | 1004 this._breakpointManager |
1005 .possibleBreakpoints( | 1005 .possibleBreakpoints( |
1006 this._debuggerSourceCode, new Common.TextRange(uiLocation.lineNumb
er, 0, uiLocation.lineNumber + 1, 0)) | 1006 this._debuggerSourceCode, new TextUtils.TextRange(uiLocation.lineN
umber, 0, uiLocation.lineNumber + 1, 0)) |
1007 .then(addInlineDecorations.bind(this, uiLocation.lineNumber)); | 1007 .then(addInlineDecorations.bind(this, uiLocation.lineNumber)); |
1008 } | 1008 } |
1009 | 1009 |
1010 /** | 1010 /** |
1011 * @this {Sources.JavaScriptSourceFrame} | 1011 * @this {Sources.JavaScriptSourceFrame} |
1012 * @param {number} lineNumber | 1012 * @param {number} lineNumber |
1013 * @param {!Array<!Workspace.UILocation>} possibleLocations | 1013 * @param {!Array<!Workspace.UILocation>} possibleLocations |
1014 */ | 1014 */ |
1015 function addInlineDecorations(lineNumber, possibleLocations) { | 1015 function addInlineDecorations(lineNumber, possibleLocations) { |
1016 var decorations = this._lineBreakpointDecorations(lineNumber); | 1016 var decorations = this._lineBreakpointDecorations(lineNumber); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 * @param {number} lineNumber | 1294 * @param {number} lineNumber |
1295 * @return {!Promise<?Array<!Workspace.UILocation>>} | 1295 * @return {!Promise<?Array<!Workspace.UILocation>>} |
1296 */ | 1296 */ |
1297 function findPossibleBreakpoints(lineNumber) { | 1297 function findPossibleBreakpoints(lineNumber) { |
1298 const maxLengthToCheck = 1024; | 1298 const maxLengthToCheck = 1024; |
1299 if (lineNumber >= this.textEditor.linesCount) | 1299 if (lineNumber >= this.textEditor.linesCount) |
1300 return Promise.resolve(/** @type {?Array<!Workspace.UILocation>} */ ([])
); | 1300 return Promise.resolve(/** @type {?Array<!Workspace.UILocation>} */ ([])
); |
1301 if (this.textEditor.line(lineNumber).length >= maxLengthToCheck) | 1301 if (this.textEditor.line(lineNumber).length >= maxLengthToCheck) |
1302 return Promise.resolve(/** @type {?Array<!Workspace.UILocation>} */ ([])
); | 1302 return Promise.resolve(/** @type {?Array<!Workspace.UILocation>} */ ([])
); |
1303 return this._breakpointManager | 1303 return this._breakpointManager |
1304 .possibleBreakpoints(this._debuggerSourceCode, new Common.TextRange(li
neNumber, 0, lineNumber + 1, 0)) | 1304 .possibleBreakpoints(this._debuggerSourceCode, new TextUtils.TextRange
(lineNumber, 0, lineNumber + 1, 0)) |
1305 .then(locations => locations.length ? locations : null); | 1305 .then(locations => locations.length ? locations : null); |
1306 } | 1306 } |
1307 | 1307 |
1308 /** | 1308 /** |
1309 * @this {!Sources.JavaScriptSourceFrame} | 1309 * @this {!Sources.JavaScriptSourceFrame} |
1310 * @param {number} currentLineNumber | 1310 * @param {number} currentLineNumber |
1311 * @param {number} linesToCheck | 1311 * @param {number} linesToCheck |
1312 * @param {?Array<!Workspace.UILocation>} locations | 1312 * @param {?Array<!Workspace.UILocation>} locations |
1313 * @return {!Promise<?Array<!Workspace.UILocation>>} | 1313 * @return {!Promise<?Array<!Workspace.UILocation>>} |
1314 */ | 1314 */ |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 return; | 1452 return; |
1453 this.bookmark.clear(); | 1453 this.bookmark.clear(); |
1454 this.bookmark = null; | 1454 this.bookmark = null; |
1455 } | 1455 } |
1456 }; | 1456 }; |
1457 | 1457 |
1458 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); | 1458 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book
mark'); |
1459 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); | 1459 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo
l('element'); |
1460 | 1460 |
1461 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); | 1461 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm
ark'); |
OLD | NEW |