Title: [207227] trunk/Source/WebInspectorUI
Revision
207227
Author
commit-qu...@webkit.org
Date
2016-10-12 11:43:19 -0700 (Wed, 12 Oct 2016)

Log Message

Web Inspector: Whole program sometimes highlighted instead of just first statement
https://bugs.webkit.org/show_bug.cgi?id=163300
<rdar://problem/28723162>

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-10-12
Reviewed by Timothy Hatcher.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
Avoid highlighting the entire program by skipping a Program type Node.

* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype.setExecutionLineAndColumn):
Avoid unnecessary work before content has loaded.

(WebInspector.TextEditor.prototype.currentPositionToOriginalOffset):
Avoid unnecessary indirection to get the CodeMirror editor.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (207226 => 207227)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-10-12 18:27:50 UTC (rev 207226)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-10-12 18:43:19 UTC (rev 207227)
@@ -1,3 +1,22 @@
+2016-10-12  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Whole program sometimes highlighted instead of just first statement
+        https://bugs.webkit.org/show_bug.cgi?id=163300
+        <rdar://problem/28723162>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
+        Avoid highlighting the entire program by skipping a Program type Node.
+
+        * UserInterface/Views/TextEditor.js:
+        (WebInspector.TextEditor.prototype.setExecutionLineAndColumn):
+        Avoid unnecessary work before content has loaded.
+
+        (WebInspector.TextEditor.prototype.currentPositionToOriginalOffset):
+        Avoid unnecessary indirection to get the CodeMirror editor.
+
 2016-10-11  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Remove line highlight on primary execution line while stepping because it is distracting

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (207226 => 207227)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2016-10-12 18:27:50 UTC (rev 207226)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2016-10-12 18:43:19 UTC (rev 207227)
@@ -1235,9 +1235,10 @@
             }
 
             // Find a node starting at this offset.
+            // Avoid highlighting the entire program if this is the start of the first statement.
             for (let node of nodes) {
                 let startOffset = node.range[0];
-                if (startOffset === offset) {
+                if (startOffset === offset && node.type !== WebInspector.ScriptSyntaxTree.NodeType.Program) {
                     callback(convertRangeOffsetsToSourceCodeOffsets(node.range));
                     return;
                 }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (207226 => 207227)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2016-10-12 18:27:50 UTC (rev 207226)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2016-10-12 18:43:19 UTC (rev 207227)
@@ -336,8 +336,10 @@
         this._executionLineNumber = lineNumber;
         this._executionColumnNumber = columnNumber;
 
-        this._updateExecutionLine();
-        this._updateExecutionRangeHighlight();
+        if (!this._initialStringNotSet) {
+            this._updateExecutionLine();
+            this._updateExecutionRangeHighlight();
+        }
 
         // Still dispatch the event even if the number didn't change. The execution state still
         // could have changed (e.g. continuing in a loop with a breakpoint inside).
@@ -703,7 +705,7 @@
         if (this._formatterSourceMap)
             offset = this._formatterSourceMap.formattedToOriginalOffset(position.line, position.ch);
         else
-            offset = this.tokenTrackingController._codeMirror.getDoc().indexFromPos(position);
+            offset = this._codeMirror.getDoc().indexFromPos(position);
 
         return offset;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to