fix(desktop): 修复首次 WebView 黑屏 - #17
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
修复 macOS Compose Desktop 中 windowed JCEF 首次进入 WebView 黑屏、调整窗口大小后才显示的问题。保持 JCEF windowed 模式,不修改 Android、iOS、JS/Wasm 行为。
改动内容
revalidate → paintImmediately → repaint同步一次原生视图布局,触发 JCEF 的JPanel.paint()、doUpdate()与原生子窗口绑定。stopLoad → setCloseAllowed → close(false)关闭流程。DesktopWebViewRuntime.prepareComposeInterop();仅 macOS 且宿主未设置compose.interop.blending时写入true,initialize()保留兼容性兜底调用。平台影响
验证命令与结果
./gradlew :webview-desktop:test :webview-compose:jvmTest --stacktrace --console=plain --no-configuration-cache:通过。./gradlew :sample-compose:desktopTest --stacktrace --console=plain --no-configuration-cache:通过。./gradlew :webview-compose:jvmApiCheck --stacktrace --console=plain --no-configuration-cache:通过。./gradlew apiCheck --stacktrace --console=plain --no-configuration-cache:受本机缺少xcodebuild阻断,失败于既有:webview-ios:cinteropMultiWebFileChooserIosArm64,xcrunexit 72;与本次 Desktop 改动无关。风险与兼容性
prepareComposeInterop()为新增公开 API;不覆盖宿主显式的全局 Compose 设置,旧接入方仍可只调用initialize()。文档变更
docs/使用指南.md与docs/架构说明.md,说明 macOS 推荐调用时机、一次性即时绘制行为与兼容性兜底。