Web Inspector: Fix execution highlighting after r233820
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2018 20:06:52 +0000 (20:06 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2018 20:06:52 +0000 (20:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187703
<rdar://problem/42246167>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
* UserInterface/Views/TextEditor.js:
(WI.TextEditor.prototype.currentPositionToOriginalPosition):
(WI.TextEditor.prototype._updateExecutionRangeHighlight):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233861 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
Source/WebInspectorUI/UserInterface/Views/TextEditor.js

index 3c3d36a..23eeeba 100644 (file)
@@ -1,3 +1,17 @@
+2018-07-16  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: Fix execution highlighting after r233820
+        https://bugs.webkit.org/show_bug.cgi?id=187703
+        <rdar://problem/42246167>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WI.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
+        * UserInterface/Views/TextEditor.js:
+        (WI.TextEditor.prototype.currentPositionToOriginalPosition):
+        (WI.TextEditor.prototype._updateExecutionRangeHighlight):
+
 2018-07-16  Aaron Chu  <aaron_chu@apple.com>
 
         AX: Audit Tab should have an Audit Manager
index 37d4e4b..e5b2c6b 100644 (file)
@@ -1413,8 +1413,7 @@ WI.SourceCodeTextEditor = class SourceCodeTextEditor extends WI.TextEditor
 
     textEditorExecutionHighlightRange(currentPosition, callback)
     {
-        let {line, ch} = this.currentPositionToOriginalPosition(currentPosition);
-        let position = new WI.SourceCodePosition(line, ch);
+        let position = this.currentPositionToOriginalPosition(currentPosition);
 
         let script = this._getAssociatedScript(position);
         if (!script) {
@@ -1491,7 +1490,7 @@ WI.SourceCodeTextEditor = class SourceCodeTextEditor extends WI.TextEditor
                 return aLength - bLength;
             });
 
-            let characterAtPosition = this.getTextInRange(currentPosition, {line: currentPosition.line, ch: currentPosition.ch + 1});
+            let characterAtPosition = this.getTextInRange(currentPosition, currentPosition.offsetColumn(1));
             let characterAtPositionIsDotOrBracket = characterAtPosition === "." || characterAtPosition === "[";
 
             for (let i = 0; i < nodes.length; ++i) {
index e5896fe..c9660c7 100644 (file)
@@ -784,8 +784,8 @@ WI.TextEditor = class TextEditor extends WI.View
         if (!this._formatterSourceMap)
             return position;
 
-        let location = this._formatterSourceMap.formattedToOriginal(position.line, position.ch);
-        return {line: location.lineNumber, ch: location.columnNumber};
+        let location = this._formatterSourceMap.formattedToOriginal(position.lineNumber, position.columnNumber);
+        return new WI.SourceCodePosition(location.lineNumber, location.columnNumber);
     }
 
     currentPositionToCurrentOffset(position)
@@ -1323,7 +1323,7 @@ WI.TextEditor = class TextEditor extends WI.View
         if (isNaN(this._executionLineNumber))
             return;
 
-        let currentPosition = {line: this._executionLineNumber, ch: this._executionColumnNumber};
+        let currentPosition = new WI.SourceCodePosition(this._executionLineNumber, this._executionColumnNumber);
 
         this._delegate.textEditorExecutionHighlightRange(currentPosition, (range) => {
             let start, end;