Changeset 207358 in webkit
- Timestamp:
- Oct 14, 2016 4:04:04 PM (7 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r207356 r207358 1 2016-10-14 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Improve debugger highlight when inside of getter/setter calls 4 https://bugs.webkit.org/show_bug.cgi?id=163428 5 <rdar://problem/28769061> 6 7 Reviewed by Timothy Hatcher. 8 9 * UserInterface/Views/SourceCodeTextEditor.js: 10 (WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange): 11 When in the middle of a member expression at a '.' or '[' get the best member 12 expression range. 13 14 * UserInterface/Views/TextEditor.js: 15 (WebInspector.TextEditor.prototype._updateExecutionRangeHighlight): 16 Include the character at the current position. This is useful since AST Nodes 17 don't give us token info but we would like to know if we are at particular tokens. 18 1 19 2016-10-14 Joseph Pecoraro <pecoraro@apple.com> 2 20 -
trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
r207354 r207358 1216 1216 } 1217 1217 1218 textEditorExecutionHighlightRange(offset, position, c allback)1218 textEditorExecutionHighlightRange(offset, position, characterAtOffset, callback) 1219 1219 { 1220 1220 let script = this._getAssociatedScript(position); … … 1284 1284 }); 1285 1285 1286 let characterAtOffsetIsDotOrBracket = characterAtOffset === "." || characterAtOffset === "["; 1287 1286 1288 for (let i = 0; i < nodes.length; ++i) { 1287 1289 let node = nodes[i]; … … 1294 1296 } 1295 1297 1296 // In the middle of a member expression. 1298 // In the middle of a member expression we want to highlight the best 1299 // member expression range. We can end up in the middle when we are 1300 // paused inside of a getter and select the parent call frame. For 1301 // these cases we may be at a '.' or '[' and we can find the best member 1302 // expression from there. 1303 // 1304 // Examples: 1305 // 1306 // foo*.x.y.z => inside x looking at parent call frame => |foo.x|.y.z 1307 // foo.x*.y.z => inside y looking at parent call frame => |foo.x.y|.z 1308 // 1309 // foo*["x"]["y"]["z"] => inside x looking at parent call frame => |foo["x"]|["y"]["z"] 1310 // foo["x"]*["y"]["z"] => inside y looking at parent call frame => |foo["x"]["y"]|["z"] 1311 // 1297 1312 if (node.type === WebInspector.ScriptSyntaxTree.NodeType.ThisExpression 1298 || node.type === WebInspector.ScriptSyntaxTree.NodeType.IdentifierExpression) { 1299 let nextNode = nodes[i + 1]; 1300 if (nextNode && nextNode.type === WebInspector.ScriptSyntaxTree.NodeType.MemberExpression) { 1301 callback(convertRangeOffsetsToSourceCodeOffsets(nextNode.range)); 1313 || (characterAtOffsetIsDotOrBracket && (node.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier || node.type === WebInspector.ScriptSyntaxTree.NodeType.MemberExpression))) { 1314 let memberExpressionNode = null; 1315 for (let j = i + 1; j < nodes.length; ++j) { 1316 let nextNode = nodes[j]; 1317 if (nextNode.type === WebInspector.ScriptSyntaxTree.NodeType.MemberExpression) { 1318 memberExpressionNode = nextNode; 1319 if (offset === memberExpressionNode.range[1]) 1320 continue; 1321 } 1322 break; 1323 } 1324 1325 if (memberExpressionNode) { 1326 callback(convertRangeOffsetsToSourceCodeOffsets(memberExpressionNode.range)); 1302 1327 return; 1303 1328 } 1329 1304 1330 callback(convertRangeOffsetsToSourceCodeOffsets(node.range)); 1305 1331 return; -
trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js
r207227 r207358 1242 1242 let originalCodeMirrorPosition = this.currentPositionToOriginalPosition(currentPosition); 1243 1243 let originalPosition = new WebInspector.SourceCodePosition(originalCodeMirrorPosition.line, originalCodeMirrorPosition.ch); 1244 1245 this._delegate.textEditorExecutionHighlightRange(originalOffset, originalPosition, (range) => { 1244 let characterAtOffset = this._codeMirror.getRange(currentPosition, {line: this._executionLineNumber, ch: this._executionColumnNumber + 1}); 1245 1246 this._delegate.textEditorExecutionHighlightRange(originalOffset, originalPosition, characterAtOffset, (range) => { 1246 1247 let start, end; 1247 1248 if (!range) {
Note: See TracChangeset
for help on using the changeset viewer.