refactor: 统一 webTab 背景色设置逻辑

- 移除 createWebTabView 中冗余的深色/浅色主题背景色判断分支
  - 统一使用 utils.getDefaultBackgroundColor() 获取默认背景色
  - 移除 did-stop-loading 事件中不必要的背景色重置逻辑
This commit is contained in:
kuaifan 2026-01-14 10:14:31 +08:00
parent a34b0c88d5
commit ce5bb5f187

View File

@ -680,12 +680,8 @@ function createWebTabView(windowId, args) {
if (args.backgroundColor) {
browserView.setBackgroundColor(args.backgroundColor)
} else if (isWindowMode) {
browserView.setBackgroundColor(utils.getDefaultBackgroundColor())
} else if (nativeTheme.shouldUseDarkColors) {
browserView.setBackgroundColor('#575757')
} else {
browserView.setBackgroundColor('#FFFFFF')
browserView.setBackgroundColor(utils.getDefaultBackgroundColor())
}
browserView.setBounds({
@ -852,9 +848,6 @@ function createWebTabView(windowId, args) {
})
browserView.webContents.on('did-stop-loading', _ => {
stopLoading()
if (nativeTheme.shouldUseDarkColors) {
browserView.setBackgroundColor('#FFFFFF')
}
})
browserView.webContents.on('before-input-event', (event, input) => {
// 使用动态窗口ID支持标签在窗口间转移