* feat: GPU shared texture offscreen rendering * docs: clarify texture infos that passed by the paint event. * feat: make gpu osr spec test optional * fix: osr image compare * fix: remove duplicate test * fix: update patch file * fix: code review * feat: expose more metadata * feat: use better switch design * feat: add warning when user forget to release the texture. * fix: typo * chore: update patch * fix: update patch * fix: update patch description * fix: update docs * fix: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * fix: apply suggested fixes --------- Co-authored-by: Charles Kerr <charles@charleskerr.com>
10 KiB
10 KiB
WebPreferences Object
devToolsboolean (optional) - Whether to enable DevTools. If it is set tofalse, can not useBrowserWindow.webContents.openDevTools()to open DevTools. Default istrue.nodeIntegrationboolean (optional) - Whether node integration is enabled. Default isfalse.nodeIntegrationInWorkerboolean (optional) - Whether node integration is enabled in web workers. Default isfalse. More about this can be found in Multithreading.nodeIntegrationInSubFramesboolean (optional) - Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. All your preloads will load for every iframe, you can useprocess.isMainFrameto determine if you are in the main frame or not.preloadstring (optional) - Specifies a script that will be loaded before other scripts run in the page. This script will always have access to node APIs no matter whether node integration is turned on or off. The value should be the absolute file path to the script. When node integration is turned off, the preload script can reintroduce Node global symbols back to the global scope. See example here.sandboxboolean (optional) - If set, this will sandbox the renderer associated with the window, making it compatible with the Chromium OS-level sandbox and disabling the Node.js engine. This is not the same as thenodeIntegrationoption and the APIs available to the preload script are more limited. Read more about the option here.sessionSession (optional) - Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use thepartitionoption instead, which accepts a partition string. When bothsessionandpartitionare provided,sessionwill be preferred. Default is the default session.partitionstring (optional) - Sets the session used by the page according to the session's partition string. Ifpartitionstarts withpersist:, the page will use a persistent session available to all pages in the app with the samepartition. If there is nopersist:prefix, the page will use an in-memory session. By assigning the samepartition, multiple pages can share the same session. Default is the default session.zoomFactornumber (optional) - The default zoom factor of the page,3.0represents300%. Default is1.0.javascriptboolean (optional) - Enables JavaScript support. Default istrue.webSecurityboolean (optional) - Whenfalse, it will disable the same-origin policy (usually using testing websites by people), and setallowRunningInsecureContenttotrueif this options has not been set by user. Default istrue.allowRunningInsecureContentboolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Default isfalse.imagesboolean (optional) - Enables image support. Default istrue.imageAnimationPolicystring (optional) - Specifies how to run image animations (E.g. GIFs). Can beanimate,animateOnceornoAnimation. Default isanimate.textAreasAreResizableboolean (optional) - Make TextArea elements resizable. Default istrue.webglboolean (optional) - Enables WebGL support. Default istrue.pluginsboolean (optional) - Whether plugins should be enabled. Default isfalse.experimentalFeaturesboolean (optional) - Enables Chromium's experimental features. Default isfalse.scrollBounceboolean (optional) macOS - Enables scroll bounce (rubber banding) effect on macOS. Default isfalse.enableBlinkFeaturesstring (optional) - A list of feature strings separated by,, likeCSSVariables,KeyboardEventKeyto enable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.disableBlinkFeaturesstring (optional) - A list of feature strings separated by,, likeCSSVariables,KeyboardEventKeyto disable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.defaultFontFamilyObject (optional) - Sets the default font for the font-family.standardstring (optional) - Defaults toTimes New Roman.serifstring (optional) - Defaults toTimes New Roman.sansSerifstring (optional) - Defaults toArial.monospacestring (optional) - Defaults toCourier New.cursivestring (optional) - Defaults toScript.fantasystring (optional) - Defaults toImpact.mathstring (optional) - Defaults toLatin Modern Math.
defaultFontSizeInteger (optional) - Defaults to16.defaultMonospaceFontSizeInteger (optional) - Defaults to13.minimumFontSizeInteger (optional) - Defaults to0.defaultEncodingstring (optional) - Defaults toISO-8859-1.backgroundThrottlingboolean (optional) - Whether to throttle animations and timers when the page becomes background. This also affects the Page Visibility API. When at least one webContents displayed in a single browserWindow has disabledbackgroundThrottlingthen frames will be drawn and swapped for the whole window and other webContents displayed by it. Defaults totrue.offscreenObject | boolean (optional) - Whether to enable offscreen rendering for the browser window. Defaults tofalse. See the offscreen rendering tutorial for more details.useSharedTextureboolean (optional) Experimental - Whether to use GPU shared texture for accelerated paint event. Defaults tofalse. See the offscreen rendering tutorial for more details.
contextIsolationboolean (optional) - Whether to run Electron APIs and the specifiedpreloadscript in a separate JavaScript context. Defaults totrue. The context that thepreloadscript runs in will only have access to its own dedicateddocumentandwindowglobals, as well as its own set of JavaScript builtins (Array,Object,JSON, etc.), which are all invisible to the loaded content. The Electron API will only be available in thepreloadscript and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with thepreloadscript and any Electron APIs being used. This option uses the same technique used by Chrome Content Scripts. You can access this context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab.webviewTagboolean (optional) - Whether to enable the<webview>tag. Defaults tofalse. Note: Thepreloadscript configured for the<webview>will have node integration enabled when it is executed so you should ensure remote/untrusted content is not able to create a<webview>tag with a possibly maliciouspreloadscript. You can use thewill-attach-webviewevent on webContents to strip away thepreloadscript and to validate or alter the<webview>'s initial settings.additionalArgumentsstring[] (optional) - A list of strings that will be appended toprocess.argvin the renderer process of this app. Useful for passing small bits of data down to renderer process preload scripts.safeDialogsboolean (optional) - Whether to enable browser style consecutive dialog protection. Default isfalse.safeDialogsMessagestring (optional) - The message to display when consecutive dialog protection is triggered. If not defined the default message would be used, note that currently the default message is in English and not localized.disableDialogsboolean (optional) - Whether to disable dialogs completely. OverridessafeDialogs. Default isfalse.navigateOnDragDropboolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Default isfalse.autoplayPolicystring (optional) - Autoplay policy to apply to content in the window, can beno-user-gesture-required,user-gesture-required,document-user-activation-required. Defaults tono-user-gesture-required.disableHtmlFullscreenWindowResizeboolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default isfalse.accessibleTitlestring (optional) - An alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.spellcheckboolean (optional) - Whether to enable the builtin spellchecker. Default istrue.enableWebSQLboolean (optional) - Whether to enable the WebSQL api. Default istrue.v8CacheOptionsstring (optional) - Enforces the v8 code caching policy used by blink. Accepted values arenone- Disables code cachingcode- Heuristic based code cachingbypassHeatCheck- Bypass code caching heuristics but with lazy compilationbypassHeatCheckAndEagerCompile- Same as above except compilation is eager. Default policy iscode.
enablePreferredSizeModeboolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause thepreferred-size-changedevent to be emitted on theWebContentswhen the preferred size changes. Default isfalse.transparentboolean (optional) - Whether to enable background transparency for the guest page. Default istrue. Note: The guest page's text and background colors are derived from the color scheme of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.