Skip to content

Commit 25f01f5

Browse files
authored
Removes diffEditorWidget2 trusted type, uses diffEditorWidget TT instead. (microsoft#185895)
1 parent 25e5a2a commit 25f01f5

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

src/vs/code/electron-sandbox/workbench/workbench-dev.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
cellRendererEditorText
5252
defaultWorkerFactory
5353
diffEditorWidget
54-
diffEditorWidget2
5554
diffReview
5655
domLineBreaksComputer
5756
dompurify

src/vs/code/electron-sandbox/workbench/workbench.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
cellRendererEditorText
5252
defaultWorkerFactory
5353
diffEditorWidget
54-
diffEditorWidget2
5554
diffReview
5655
domLineBreaksComputer
5756
dompurify

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ let DIFF_EDITOR_ID = 0;
175175

176176
const diffInsertIcon = registerIcon('diff-insert', Codicon.add, nls.localize('diffInsertIcon', 'Line decoration for inserts in the diff editor.'));
177177
const diffRemoveIcon = registerIcon('diff-remove', Codicon.remove, nls.localize('diffRemoveIcon', 'Line decoration for removals in the diff editor.'));
178-
const ttPolicy = createTrustedTypesPolicy('diffEditorWidget', { createHTML: value => value });
178+
export const diffEditorWidgetTtPolicy = createTrustedTypesPolicy('diffEditorWidget', { createHTML: value => value });
179179

180180
const ariaNavigationTip = nls.localize('diff-aria-navigation-tip', ' use Shift + F7 to navigate changes');
181181

@@ -2588,7 +2588,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
25882588
maxCharsPerLine += scrollBeyondLastColumn;
25892589

25902590
const html = sb.build();
2591-
const trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;
2591+
const trustedhtml = diffEditorWidgetTtPolicy ? diffEditorWidgetTtPolicy.createHTML(html) : html;
25922592
domNode.innerHTML = trustedhtml as string;
25932593
viewZone.minWidthInPx = (maxCharsPerLine * typicalHalfwidthCharacterWidth);
25942594

src/vs/editor/browser/widget/diffEditorWidget2/renderLines.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { createTrustedTypesPolicy } from 'vs/base/browser/trustedTypes';
76
import { applyFontInfo } from 'vs/editor/browser/config/domFontInfo';
87
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
9-
import { EditorOption, EditorFontLigatures, FindComputedEditorOptionValueById } from 'vs/editor/common/config/editorOptions';
8+
import { diffEditorWidgetTtPolicy } from 'vs/editor/browser/widget/diffEditorWidget';
9+
import { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById } from 'vs/editor/common/config/editorOptions';
1010
import { FontInfo } from 'vs/editor/common/config/fontInfo';
1111
import { StringBuilder } from 'vs/editor/common/core/stringBuilder';
1212
import { ModelLineProjectionData } from 'vs/editor/common/modelLineProjectionData';
1313
import { IViewLineTokens, LineTokens } from 'vs/editor/common/tokens/lineTokens';
1414
import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
15-
import { renderViewLine, RenderLineInput } from 'vs/editor/common/viewLayout/viewLineRenderer';
15+
import { RenderLineInput, renderViewLine } from 'vs/editor/common/viewLayout/viewLineRenderer';
1616
import { InlineDecoration, ViewLineRenderingData } from 'vs/editor/common/viewModel';
1717

18-
const ttPolicy = createTrustedTypesPolicy('diffEditorWidget2', { createHTML: value => value });
18+
const ttPolicy = diffEditorWidgetTtPolicy;
1919

2020
export function renderLines(source: LineSource, options: RenderOptions, decorations: InlineDecoration[], domNode: HTMLElement): RenderLinesResult {
2121
applyFontInfo(domNode, options.fontInfo);

0 commit comments

Comments
 (0)