Repository navigation
Conversation
royhang
marked this pull request as ready for review
October 14, 2026 17:22
freedomkk-qfeng
added a commit
that referenced
this pull request
Oct 15, 2026
Retain royhang's content-box measurement and iframe overflow fix for the legacy Office compatibility viewer, with its standalone zoom regression. Keep real scrollbar layout in the test and extend the official viewer's assembled-host regression to fractional CSS widths and heights as well. Adapted from #155, commits 0317ab3 and 4e65db3. Co-authored-by: royhang <[email protected]>
Contributor
Author
|
桌面端实测通过:原 DOCX 自动适应频闪问题已解决。 2026-10-15,原问题报告者使用包含本 PR 修复的 macOS arm64 桌面开发包,通过会话生成 DOCX 并在右侧栏打开预览,实测反馈「实测解决了」。下图为本次实际使用路径的截图,当前选择「适应窗口」。 此前已完成 macOS 桌面构建、原生 Electron 窗口 20 组 DOCX 缩放检查,以及两种适应模式、不同容器尺寸与滚动条条件下的回归验证;现在补齐原报告者的桌面实测确认。跳动比例与显示环境和布局有关,问题描述不限定具体百分比。 感谢维护者通过 #156 整合本 PR 的修复和回归测试,并保留贡献署名。PR 正文已同步更新原因、解决方案、验证结果和截图。本次截图及用户实测对应 #155 的开发包,#156 的官方预览迁移版本属于另一构建。 |
4 tasks
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.

修复结果
已修复 DOCX 自动适应时缩放比例反复跳动、文档持续频闪的问题,并由原问题报告者在 macOS arm64 桌面开发包中实测确认。 实测使用会话生成 DOCX,再从右侧栏打开预览,补齐了实际使用路径的验收。
本 PR 的代码与回归测试已由维护者整合进 #156,并于 2026-10-15 合入 main;集成提交保留来源说明及
Co-authored-by: royhang。本 PR 关闭是因为修复已被整合。问题原因
选择「适应窗口」或「适应宽度」后,查看器会按容器尺寸自动计算缩放比例。分栏、窗口调整与显示缩放可能产生带小数的布局尺寸,而原实现使用整数
clientWidth/clientHeight。尺寸取整偏大时,文档会略微超出实际内容区,触发滚动条;滚动条又改变可用空间并触发ResizeObserver,缩小后的文档使滚动条消失,随后再次放大,形成持续反馈循环。跳动的百分比取决于窗口和侧栏尺寸、分辨率、显示缩放及滚动条样式,不局限于固定区间。 手动缩放不依赖这条自动计算循环,因此可以保持稳定。
解决方案
ResizeObserver使用contentRect;同步测量使用小数 CSS 尺寸,并扣除内边距与滚动条占用。.stage设置overflow: hidden,阻止 iframe 在变换前的尺寸扩大外层滚动范围。test:exports与现有客户端冒烟脚本,覆盖两种适应模式、整数/小数尺寸、原生/经典滚动条及手动缩放。修复后,自动适应会随真实容器变化正常调整,尺寸稳定后不再自行反复缩放。该修复位于会话附件和知识工作台共用的旧 HTML 查看器;#156 同时迁移当前产品入口到官方预览,并保留本修复用于旧宿主兼容路径。
桌面实测截图
2026-10-15,原问题报告者实测反馈:「实测解决了」。 下图展示包含本 PR 修复的桌面开发包中,会话生成 DOCX 后在右侧栏使用「适应窗口」正常预览的结果。
截图对应本 PR 提交
4e65db3bb246fb4811d053870fea24f307579ebb构建的0.4.3-dev.20261015.1macOS arm64 开发包;本次用户实测针对该开发包。#156 中官方预览迁移后的产品版本属于另一构建。验证结果
node scripts/office-preview-zoom-smoke.mjsnpm run checknode --test dsh-electron/tests/*.test.mjs桌面 ZIP SHA-256:
f6af351f23621ca48a10172f75d76c6dee4dcd7d1de30171e30a5288c40d33c7。验证范围与既有问题
office-preview-client-smoke.mjs在「刷新后切换文件版本」断言失败,未修改的上游查看器同样失败;这是已确认的既有问题,本 PR 未混入其他修复。独立缩放回归检查全部通过。