- a/Source/WebInspectorUI/ChangeLog +41 lines
Lines 1-3 a/Source/WebInspectorUI/ChangeLog_sec1
1
2019-06-12  Devin Rousso  <drousso@apple.com>
2
3
        Web Inspector: Settings: indent type and size settings aren't respected everywhere
4
        https://bugs.webkit.org/show_bug.cgi?id=198804
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * UserInterface/Views/CodeMirrorEditor.js:
9
        (WI.CodeMirrorEditor.create):
10
        When creating a `CodeMirror` instance, default to using the global `Setting`s as the options.
11
        If an override is specified in `options`, it will take precedence and the `CodeMirror` will
12
        ignore any changes to the `Setting` as well.
13
14
        * UserInterface/Views/TextEditor.js:
15
        (WI.TextEditor):
16
        (WI.TextEditor.prototype.close): Deleted.
17
18
        * UserInterface/Views/AuditTestCaseContentView.js:
19
        (WI.AuditTestCaseContentView.prototype.layout):
20
        * UserInterface/Views/BreakpointActionView.js:
21
        (WI.BreakpointActionView.prototype._updateBody):
22
        * UserInterface/Views/ConsolePrompt.js:
23
        (WI.ConsolePrompt):
24
        * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
25
        (WI.ScopeChainDetailsSidebarPanel.prototype._addWatchExpressionButtonClicked):
26
        Remove overrides that aren't necessary for `CodeMirror` to fit in the container element:
27
         - `showWhitespaceCharacters`
28
         - `indentWithTabs`
29
         - `indentUnit`
30
31
        * UserInterface/Views/SourceCodeTextEditor.js:
32
        (WI.SourceCodeTextEditor.prototype.close):
33
        * UserInterface/Views/ShaderProgramContentView.js:
34
        (WI.ShaderProgramContentView.prototype.closed): Deleted.
35
        * UserInterface/Views/TextContentView.js:
36
        (WI.TextContentView.prototype.closed): Deleted.
37
        * UserInterface/Views/TextResourceContentView.js:
38
        (WI.TextResourceContentView.prototype.closed):
39
        Delete the logic for removing event listeners from global `Setting`, as it didn't work
40
        anyways, since none of the event listeners were added using a `thisObject`.
41
1
2019-06-10  Devin Rousso  <drousso@apple.com>
42
2019-06-10  Devin Rousso  <drousso@apple.com>
2
43
3
        Web Inspector: Timelines: imported recordings do not have JavaScript call trees
44
        Web Inspector: Timelines: imported recordings do not have JavaScript call trees
- a/Source/WebInspectorUI/UserInterface/Views/AuditTestCaseContentView.js -1 lines
Lines 217-223 WI.AuditTestCaseContentView = class AuditTestCaseContentView extends WI.AuditTes a/Source/WebInspectorUI/UserInterface/Views/AuditTestCaseContentView.js_sec1
217
                        mode: "css",
217
                        mode: "css",
218
                        readOnly: true,
218
                        readOnly: true,
219
                        lineWrapping: true,
219
                        lineWrapping: true,
220
                        showWhitespaceCharacters: WI.settings.showWhitespaceCharacters.value,
221
                        styleSelectedText: true,
220
                        styleSelectedText: true,
222
                    });
221
                    });
223
                    codeMirror.setValue(domNode);
222
                    codeMirror.setValue(domNode);
- a/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js -2 lines
Lines 158-165 WI.BreakpointActionView = class BreakpointActionView extends WI.Object a/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js_sec1
158
            this._codeMirror = WI.CodeMirrorEditor.create(editorElement, {
158
            this._codeMirror = WI.CodeMirrorEditor.create(editorElement, {
159
                lineWrapping: true,
159
                lineWrapping: true,
160
                mode: "text/javascript",
160
                mode: "text/javascript",
161
                indentWithTabs: true,
162
                indentUnit: 4,
163
                matchBrackets: true,
161
                matchBrackets: true,
164
                value: this._action.data || "",
162
                value: this._action.data || "",
165
            });
163
            });
- a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js -1 / +23 lines
Lines 33-39 WI.CodeMirrorEditor = class CodeMirrorEditor a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js_sec1
33
        element.setAttribute("dir", "ltr");
33
        element.setAttribute("dir", "ltr");
34
        element.classList.toggle("read-only", options.readOnly);
34
        element.classList.toggle("read-only", options.readOnly);
35
35
36
        let codeMirror = new CodeMirror(element, options);
36
        let codeMirror = new CodeMirror(element, {
37
            // These values will be overridden by any value with the same key in `options`.
38
            indentWithTabs: WI.settings.indentWithTabs.value,
39
            indentUnit: WI.settings.indentUnit.value,
40
            tabSize: WI.settings.tabSize.value,
41
            lineWrapping: WI.settings.enableLineWrapping.value,
42
            showWhitespaceCharacters: WI.settings.showWhitespaceCharacters.value,
43
            ...options,
44
        });
45
46
        function listenForChange(setting, codeMirrorOption) {
47
            if (options[codeMirrorOption] !== undefined)
48
                return;
49
50
            setting.addEventListener(WI.Setting.Event.Changed, (event) => {
51
                codeMirror.setOption(codeMirrorOption, setting.value);
52
            });
53
        }
54
        listenForChange(WI.settings.indentWithTabs, "indentWithTabs");
55
        listenForChange(WI.settings.indentUnit, "indentUnit");
56
        listenForChange(WI.settings.tabSize, "tabSize");
57
        listenForChange(WI.settings.enableLineWrapping, "lineWrapping");
58
        listenForChange(WI.settings.showWhitespaceCharacters, "showWhitespaceCharacters");
37
59
38
        // Override some Mac specific keybindings.
60
        // Override some Mac specific keybindings.
39
        if (WI.Platform.name === "mac") {
61
        if (WI.Platform.name === "mac") {
- a/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js -2 lines
Lines 40-47 WI.ConsolePrompt = class ConsolePrompt extends WI.View a/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js_sec1
40
        this._codeMirror = WI.CodeMirrorEditor.create(this.element, {
40
        this._codeMirror = WI.CodeMirrorEditor.create(this.element, {
41
            lineWrapping: true,
41
            lineWrapping: true,
42
            mode: {name: mimeType, globalVars: true},
42
            mode: {name: mimeType, globalVars: true},
43
            indentWithTabs: true,
44
            indentUnit: 4,
45
            matchBrackets: true
43
            matchBrackets: true
46
        });
44
        });
47
45
- a/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js -2 lines
Lines 364-371 WI.ScopeChainDetailsSidebarPanel = class ScopeChainDetailsSidebarPanel extends W a/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js_sec1
364
        this._codeMirror = WI.CodeMirrorEditor.create(editorElement, {
364
        this._codeMirror = WI.CodeMirrorEditor.create(editorElement, {
365
            lineWrapping: true,
365
            lineWrapping: true,
366
            mode: "text/javascript",
366
            mode: "text/javascript",
367
            indentWithTabs: true,
368
            indentUnit: 4,
369
            matchBrackets: true,
367
            matchBrackets: true,
370
            value: "",
368
            value: "",
371
        });
369
        });
- a/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js -8 lines
Lines 99-112 WI.ShaderProgramContentView = class ShaderProgramContentView extends WI.ContentV a/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js_sec1
99
        super.hidden();
99
        super.hidden();
100
    }
100
    }
101
101
102
    closed()
103
    {
104
        this._vertexEditor.close();
105
        this._fragmentEditor.close();
106
107
        super.closed();
108
    }
109
110
    get supportsSave()
102
    get supportsSave()
111
    {
103
    {
112
        return true;
104
        return true;
- a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js -2 lines
Lines 165-172 WI.SourceCodeTextEditor = class SourceCodeTextEditor extends WI.TextEditor a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js_sec1
165
165
166
    close()
166
    close()
167
    {
167
    {
168
        super.close();
169
170
        if (this._supportsDebugging) {
168
        if (this._supportsDebugging) {
171
            WI.Breakpoint.removeEventListener(null, null, this);
169
            WI.Breakpoint.removeEventListener(null, null, this);
172
            WI.debuggerManager.removeEventListener(null, null, this);
170
            WI.debuggerManager.removeEventListener(null, null, this);
- a/Source/WebInspectorUI/UserInterface/Views/TextContentView.js -7 lines
Lines 92-104 WI.TextContentView = class TextContentView extends WI.ContentView a/Source/WebInspectorUI/UserInterface/Views/TextContentView.js_sec1
92
        this._textEditor.hidden();
92
        this._textEditor.hidden();
93
    }
93
    }
94
94
95
    closed()
96
    {
97
        super.closed();
98
99
        this._textEditor.close();
100
    }
101
102
    get supportsSave()
95
    get supportsSave()
103
    {
96
    {
104
        return true;
97
        return true;
- a/Source/WebInspectorUI/UserInterface/Views/TextEditor.js -34 lines
Lines 33-69 WI.TextEditor = class TextEditor extends WI.View a/Source/WebInspectorUI/UserInterface/Views/TextEditor.js_sec1
33
33
34
        this._codeMirror = WI.CodeMirrorEditor.create(this.element, {
34
        this._codeMirror = WI.CodeMirrorEditor.create(this.element, {
35
            readOnly: true,
35
            readOnly: true,
36
            indentWithTabs: WI.settings.indentWithTabs.value,
37
            indentUnit: WI.settings.indentUnit.value,
38
            tabSize: WI.settings.tabSize.value,
39
            lineNumbers: true,
36
            lineNumbers: true,
40
            lineWrapping: WI.settings.enableLineWrapping.value,
41
            matchBrackets: true,
37
            matchBrackets: true,
42
            autoCloseBrackets: true,
38
            autoCloseBrackets: true,
43
            showWhitespaceCharacters: WI.settings.showWhitespaceCharacters.value,
44
            styleSelectedText: true,
39
            styleSelectedText: true,
45
        });
40
        });
46
41
47
        WI.settings.indentWithTabs.addEventListener(WI.Setting.Event.Changed, (event) => {
48
            this._codeMirror.setOption("indentWithTabs", WI.settings.indentWithTabs.value);
49
        });
50
51
        WI.settings.indentUnit.addEventListener(WI.Setting.Event.Changed, (event) => {
52
            this._codeMirror.setOption("indentUnit", WI.settings.indentUnit.value);
53
        });
54
55
        WI.settings.tabSize.addEventListener(WI.Setting.Event.Changed, (event) => {
56
            this._codeMirror.setOption("tabSize", WI.settings.tabSize.value);
57
        });
58
59
        WI.settings.enableLineWrapping.addEventListener(WI.Setting.Event.Changed, (event) => {
60
            this._codeMirror.setOption("lineWrapping", WI.settings.enableLineWrapping.value);
61
        });
62
63
        WI.settings.showWhitespaceCharacters.addEventListener(WI.Setting.Event.Changed, (event) => {
64
            this._codeMirror.setOption("showWhitespaceCharacters", WI.settings.showWhitespaceCharacters.value);
65
        });
66
67
        this._codeMirror.on("focus", this._editorFocused.bind(this));
42
        this._codeMirror.on("focus", this._editorFocused.bind(this));
68
        this._codeMirror.on("change", this._contentChanged.bind(this));
43
        this._codeMirror.on("change", this._contentChanged.bind(this));
69
        this._codeMirror.on("gutterClick", this._gutterMouseDown.bind(this));
44
        this._codeMirror.on("gutterClick", this._gutterMouseDown.bind(this));
Lines 587-601 WI.TextEditor = class TextEditor extends WI.View a/Source/WebInspectorUI/UserInterface/Views/TextEditor.js_sec2
587
        this._visible = false;
562
        this._visible = false;
588
    }
563
    }
589
564
590
    close()
591
    {
592
        WI.settings.indentWithTabs.removeEventListener(null, null, this);
593
        WI.settings.indentUnit.removeEventListener(null, null, this);
594
        WI.settings.tabSize.removeEventListener(null, null, this);
595
        WI.settings.enableLineWrapping.removeEventListener(null, null, this);
596
        WI.settings.showWhitespaceCharacters.removeEventListener(null, null, this);
597
    }
598
599
    setBreakpointInfoForLineAndColumn(lineNumber, columnNumber, breakpointInfo)
565
    setBreakpointInfoForLineAndColumn(lineNumber, columnNumber, breakpointInfo)
600
    {
566
    {
601
        if (this._ignoreSetBreakpointInfoCalls)
567
        if (this._ignoreSetBreakpointInfoCalls)
- a/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js -2 lines
Lines 127-134 WI.TextResourceContentView = class TextResourceContentView extends WI.ResourceCo a/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js_sec1
127
        WI.debuggerManager.removeEventListener(null, null, this);
127
        WI.debuggerManager.removeEventListener(null, null, this);
128
        WI.settings.showJavaScriptTypeInformation.removeEventListener(null, null, this);
128
        WI.settings.showJavaScriptTypeInformation.removeEventListener(null, null, this);
129
        WI.settings.enableControlFlowProfiler.removeEventListener(null, null, this);
129
        WI.settings.enableControlFlowProfiler.removeEventListener(null, null, this);
130
131
        this._textEditor.close();
132
    }
130
    }
133
131
134
    contentAvailable(content, base64Encoded)
132
    contentAvailable(content, base64Encoded)

Return to Bug 198804