From ea07e9bbdc598480dadfd1297e9e817e40802bce Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 30 Apr 2020 12:24:38 -0700 Subject: [PATCH] Don't give webview a width if its container has none Fixes #94805 When the panel is maximized over a webview, on reload VS Code calls `.layout` with the dimensions of the editor. However in this case, the dimensions do not match what is actually visible In this case, the parent element should have zero width so we should make sure that we do not try giving the webview a width too --- .../contrib/webview/browser/dynamicWebviewEditorOverlay.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts b/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts index b7c7a60d8fc..c8396d281d7 100644 --- a/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts +++ b/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts @@ -102,8 +102,8 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewOv this.container.style.position = 'absolute'; this.container.style.top = `${frameRect.top - containerRect.top}px`; this.container.style.left = `${frameRect.left - containerRect.left}px`; - this.container.style.width = `${dimension ? dimension.width : frameRect.width}px`; - this.container.style.height = `${dimension ? dimension.height : frameRect.height}px`; + this.container.style.width = `${dimension && frameRect.width > 0 ? dimension.width : frameRect.width}px`; + this.container.style.height = `${dimension && frameRect.height > 0 ? dimension.height : frameRect.height}px`; } private show() {