Title: [237145] trunk/Source/WebInspectorUI
Revision
237145
Author
mattba...@apple.com
Date
2018-10-15 14:21:16 -0700 (Mon, 15 Oct 2018)

Log Message

Web Inspector: REGRESSION (r233824): execution highlight range missing/incorrect in pretty printed code
https://bugs.webkit.org/show_bug.cgi?id=188082
<rdar://problem/42640580>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
TextEditor expects positions returned by the delegate to be relative to
the editor's text content, not the original source code content.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor.prototype._updateExecutionRangeHighlight):
Convert positions to CodeMirror format here rather than in the delegate
method, which is a layer removed from CodeMirror.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (237144 => 237145)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-10-15 21:21:07 UTC (rev 237144)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-10-15 21:21:16 UTC (rev 237145)
@@ -1,3 +1,21 @@
+2018-10-15  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: REGRESSION (r233824): execution highlight range missing/incorrect in pretty printed code
+        https://bugs.webkit.org/show_bug.cgi?id=188082
+        <rdar://problem/42640580>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WI.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
+        TextEditor expects positions returned by the delegate to be relative to
+        the editor's text content, not the original source code content.
+
+        * UserInterface/Views/TextEditor.js:
+        (WI.TextEditor.prototype._updateExecutionRangeHighlight):
+        Convert positions to CodeMirror format here rather than in the delegate
+        method, which is a layer removed from CodeMirror.
+
 2018-10-15  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Dark Mode: unreadable text when hovering CSS properties while holding Command

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (237144 => 237145)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-10-15 21:21:07 UTC (rev 237144)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-10-15 21:21:16 UTC (rev 237145)
@@ -1426,10 +1426,10 @@
             return new WI.SourceCodePosition(position.lineNumber + startLine, columnNumber);
         }
 
-        // When returning offsets, convert to offsets within the SourceCode being viewed.
+        // When returning positions, convert to positions relative to the TextEditor content.
         let highlightSourceCodeRange = (startPosition, endPosition) => {
-            startPosition = fromInlineScriptPosition(startPosition).toCodeMirror();
-            endPosition = fromInlineScriptPosition(endPosition).toCodeMirror();
+            startPosition = this.originalPositionToCurrentPosition(fromInlineScriptPosition(startPosition));
+            endPosition = this.originalPositionToCurrentPosition(fromInlineScriptPosition(endPosition));
             callback({startPosition, endPosition});
         };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (237144 => 237145)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-10-15 21:21:07 UTC (rev 237144)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-10-15 21:21:16 UTC (rev 237145)
@@ -1345,8 +1345,8 @@
                 end = {line: this._executionLineNumber};
             } else {
                 // Highlight the range.
-                start = range.startPosition;
-                end = range.endPosition;
+                start = range.startPosition.toCodeMirror();
+                end = range.endPosition.toCodeMirror();
             }
 
             // Ensure the marker is cleared in case there were multiple updates very quickly.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to