5.8 KiB
5.8 KiB
XCUI Editor Windowing Plan
更新日期: 2026-04-26
状态: In Progress, authority/planner 已收口,下一阶段聚焦 projection 与 host executor 解耦
1. 长期目标
这个计划只关注 editor/app/Windowing 到 editor/app/Platform/Win32/Windowing 的多窗口工作区主线。目标不是继续把行为堆进 EditorWindowWorkspaceCoordinator,而是把 editor 窗口系统收口为下面的单向数据流:
EditorWindowSystem authoritative window set
-> semantic mutation / lifecycle policy
-> synchronization plan
-> Win32 host execution
-> native observation / frame requests
-> app-layer reconciliation
长期完成态应满足:
EditorWindowSystem是窗口工作区 authority、validation、planner、destroy reconciliation 的唯一 app 层入口。EditorWorkspaceWindowContentController只负责 projection、交互和 mutation request 生产,不再充当 host 可写的 authority 副本。EditorWindow不再把TryGetWorkspaceController()/ReplaceWorkspaceController()作为跨层同步主接口;host 侧消费的是受控 projection 或 presentation data。EditorWindowWorkspaceCoordinator收缩为 host executor + native event bridge,不再同时承担领域编排、live projection 回滚和跨窗口语义决策。- detach、dock、close、destroy、primary switch 都先形成 app 层 mutation / transition,再生成 sync plan,再由 host 执行。
验证基线统一收口到 tests/UI/Editor:
editor_windowing_phase1_tests负责 planner / reconcile / transition 规则。editor_app_feature_tests负责 host 集成行为。xcui_editor_app_smoke负责启动烟测。tests/UI/Editor/manual_validation保留复杂交互人工验证。
当前已经具备的基础:
EditorWindowSystem已拥有BuildPlanForWorkspaceMutationRequest(...)、BuildPlanForDestroyedWindow(...)、CommitSynchronizationPlan(...)。EditorWindowWorkspaceCoordinator已不再直接写 authority store。- live frame 内工作区变化已经通过显式
workspaceMutationrequest 回到 app 层。
当前离长期目标仍有两个核心缺口:
- live content 仍持有可变
UIEditorWorkspaceController,projection 和 authority 的边界还不够硬。 EditorWindowWorkspaceCoordinator仍然过厚,把 host 执行、projection 替换、标题刷新、drag/detach 流程和失败回滚串在同一层。
2. 下一个阶段执行计划
2.1 阶段目标
下一阶段只做一个切口: 把“live workspace controller 是 host 可写副本”收口为“content 只持有受控 projection,并通过显式 request 回传语义变化”。
做完这一阶段后,EditorWindowWorkspaceCoordinator 可以暂时保留现有 drag/detach 能力,但它不应再依赖 EditorWindow::GetWorkspaceController() / ReplaceWorkspaceController() 作为常规同步手段。
2.2 范围
主要涉及:
editor/app/Windowing/Content/**editor/app/Windowing/System/**editor/app/Platform/Win32/Windowing/**tests/UI/Editor/unit- 必要时补
tests/UI/Editor/smoke
本阶段不扩到 shell、viewport、panel feature 业务重构。
2.3 执行步骤
- 定义 projection 边界
- 为 workspace window 引入明确的 projection / presentation payload,至少覆盖 content compose、title、minimum size、detached title bar 所需数据。
EditorWorkspaceWindowContentController改为消费 projection 并产出 request,不再把内部UIEditorWorkspaceController暴露为 host 通用读写接口。
- 改造窗口更新路径
- 拆分
EditorWindowWorkspaceCoordinator::ApplySynchronizationPlan(...),把“host 执行”和“projection 刷新/commit”从同一段流程里拆开。 UpdateWorkspaceWindow动作不再通过ReplaceWorkspaceController(...)整体替换 live controller,而是通过受控 projection refresh API 更新窗口内容。
- 收口 presentation 读取路径
RefreshWindowTitle(...)、ResolveMinimumOuterSize()、ResolveDetachedWindowTitleText(...)等 presentation 决策统一基于 authoritative state 或 projection payload。- 清理
EditorWindow::TryGetWorkspaceController()在 Win32 协调器里的常规读路径,只保留确实无法在本阶段消除的过渡性接口。
- 保持 frame mutation 显式化
- 保持
workspaceMutationrequest 作为 frame 内唯一工作区回传入口。 - 若 content 侧还需要额外语义事件,继续新增显式 request 类型,不回退到 host 直接读取 live controller 补状态。
- 建立回归验证
- 为 projection refresh、title refresh、destroy reconciliation、unknown window rejection 增补 unit coverage。
- 为 detach、dock、primary switch 至少补一组 focused integration 或 app feature tests,确保改造后 host 行为不回退。
- 继续保留
xcui_editor_app_smoke作为 editor 启动基线。
2.4 本阶段验收标准
EditorWorkspaceWindowContentController不再被当成 authority 副本使用。EditorWindowWorkspaceCoordinator的常规同步路径不再依赖ReplaceWorkspaceController(...)。- 标题、最小尺寸、detached tab strip 文案等 presentation 行为能从 projection / authoritative state 稳定导出。
workspaceMutation仍是 frame 内工作区变化的显式入口,没有恢复任何平台隐式写回。editor_windowing_phase1_tests与相关editor_app_feature_tests能覆盖本阶段新增规则。xcui_editor_app_smoke继续通过。
2.5 本阶段非目标
- 不重写
XCUIEditorApp启动流程。 - 不在本阶段改造
EditorShellRuntime、viewport render loop 或各 feature panel 业务。 - 不追求一次性删除所有
UIEditorWorkspaceController使用点,先消除 host 常规同步路径上的 authority 副本语义。 - 不把 Win32 host adapter 直接扩写成跨平台窗口系统。