Changeset 207227 in webkit


Ignore:
Timestamp:
Oct 12, 2016 11:43:19 AM (8 years ago)
Author:
commit-queue@webkit.org
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 <Joseph Pecoraro> 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.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r207165 r207227  
     12016-10-12  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Whole program sometimes highlighted instead of just first statement
     4        https://bugs.webkit.org/show_bug.cgi?id=163300
     5        <rdar://problem/28723162>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Views/SourceCodeTextEditor.js:
     10        (WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
     11        Avoid highlighting the entire program by skipping a Program type Node.
     12
     13        * UserInterface/Views/TextEditor.js:
     14        (WebInspector.TextEditor.prototype.setExecutionLineAndColumn):
     15        Avoid unnecessary work before content has loaded.
     16
     17        (WebInspector.TextEditor.prototype.currentPositionToOriginalOffset):
     18        Avoid unnecessary indirection to get the CodeMirror editor.
     19
    1202016-10-11  Joseph Pecoraro  <pecoraro@apple.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

    r206655 r207227  
    12361236
    12371237            // Find a node starting at this offset.
     1238            // Avoid highlighting the entire program if this is the start of the first statement.
    12381239            for (let node of nodes) {
    12391240                let startOffset = node.range[0];
    1240                 if (startOffset === offset) {
     1241                if (startOffset === offset && node.type !== WebInspector.ScriptSyntaxTree.NodeType.Program) {
    12411242                    callback(convertRangeOffsetsToSourceCodeOffsets(node.range));
    12421243                    return;
  • trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js

    r207165 r207227  
    337337        this._executionColumnNumber = columnNumber;
    338338
    339         this._updateExecutionLine();
    340         this._updateExecutionRangeHighlight();
     339        if (!this._initialStringNotSet) {
     340            this._updateExecutionLine();
     341            this._updateExecutionRangeHighlight();
     342        }
    341343
    342344        // Still dispatch the event even if the number didn't change. The execution state still
     
    704706            offset = this._formatterSourceMap.formattedToOriginalOffset(position.line, position.ch);
    705707        else
    706             offset = this.tokenTrackingController._codeMirror.getDoc().indexFromPos(position);
     708            offset = this._codeMirror.getDoc().indexFromPos(position);
    707709
    708710        return offset;
Note: See TracChangeset for help on using the changeset viewer.