From 2e479ff799e9228abec9be7e69a8413363402839 Mon Sep 17 00:00:00 2001 From: "trop[bot]" Date: Fri, 31 Aug 2018 14:48:08 -0700 Subject: [PATCH] fix: use flexbox to style webview (backport: 3-0-x) (#14408) * fix: use flexbox to style webview * docs: remove notes on browserplugin based webview --- docs/api/webview-tag.md | 25 +++---------------------- lib/renderer/web-view/web-view.js | 3 +-- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/docs/api/webview-tag.md b/docs/api/webview-tag.md index fd48cf064f93..f3213fed362e 100644 --- a/docs/api/webview-tag.md +++ b/docs/api/webview-tag.md @@ -65,30 +65,11 @@ and displays a "loading..." message during the load time: ## CSS Styling Notes Please note that the `webview` tag's style uses `display:flex;` internally to -ensure the child `object` element fills the full height and width of its `webview` -container when used with traditional and flexbox layouts (since v0.36.11). Please -do not overwrite the default `display:flex;` CSS property, unless specifying +ensure the child `iframe` element fills the full height and width of its `webview` +container when used with traditional and flexbox layouts. Please do not +overwrite the default `display:flex;` CSS property, unless specifying `display:inline-flex;` for inline layout. -`webview` has issues being hidden using the `hidden` attribute or using -`display: none;`. It can cause unusual rendering behaviour within its child -`browserplugin` object and the web page is reloaded when the `webview` is -un-hidden. The recommended approach is to hide the `webview` using -`visibility: hidden`. - -```html - -``` - ## Tag Attributes The `webview` tag has the following attributes: diff --git a/lib/renderer/web-view/web-view.js b/lib/renderer/web-view/web-view.js index 775abddfdeec..2a029cce24b6 100644 --- a/lib/renderer/web-view/web-view.js +++ b/lib/renderer/web-view/web-view.js @@ -61,8 +61,7 @@ class WebViewImpl { createInternalElement () { const iframeElement = document.createElement('iframe') - iframeElement.style.width = '100%' - iframeElement.style.height = '100%' + iframeElement.style.flex = '1 1 auto' iframeElement.style.border = '0' v8Util.setHiddenValue(iframeElement, 'internal', this) return iframeElement