6.8 KiB
XCUI Editor Windowing Plan
阶段门禁
- 每完成一个阶段,必须先编译
XCUIEditorApp。 - 编译通过后,必须实际运行 editor,并执行一次 12 秒冒烟测试。
- 只有在编译与 12 秒冒烟测试都通过后,才能提交并推送该阶段改动。
更新日期: 2026-04-26
状态: In Progress, live projection payload、常规 sync/presentation 去副本化已收口,下一阶段聚焦交互 / 过渡路径去 controller 读依赖
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 规则。- 若当前 checkout 提供对应 target,则由
editor_app_feature_tests负责 host 集成行为。 xcui_editor_app_smoke负责启动烟测。tests/UI/Editor/manual_validation保留复杂交互人工验证。
2. 当前进展
已完成并已经并回总 plan 的收口项:
EditorWindowSystem已拥有BuildPlanForWorkspaceMutationRequest(...)、BuildPlanForDestroyedWindow(...)、CommitSynchronizationPlan(...)。EditorWindowWorkspaceCoordinator已不再直接写 authority store。- live frame 内工作区变化已经通过显式
workspaceMutationrequest 回到 app 层。 editor_windowing_phase1_tests已覆盖显式 mutation request commit、unknownwindowIdrejection、detached window create/close、destroyed primary closeout 等基础规则。- workspace window 已引入显式
EditorWorkspaceWindowProjection,标题、minimum size、detached title bar/tab strip 文案改由 projection / authoritative state 导出。 EditorWindowWorkspaceCoordinator的常规同步路径已改为RefreshWorkspaceProjection(...),不再依赖ReplaceWorkspaceController(...)整体替换 live controller。xcui_editor_app_smoke对应 runner 已支持 12 秒 smoke auto-exit 门禁,能作为阶段收口验证入口。
这意味着前一轮 subplan 里围绕“authority 回写收口”“显式 request 成为主输入”“destroy reconciliation 回到 app 层”的工作已经完成,后续不再继续保留为独立 subplan。
当前离长期目标仍有两个核心缺口:
- live content 仍持有可变
UIEditorWorkspaceController,且 drag bootstrap、少量 runtime/过渡路径仍会直接读 controller。 EditorWindowWorkspaceCoordinator仍然过厚,把 host 执行、drag/detach 流程、标题刷新和失败回滚串在同一层。
3. 下一个阶段执行计划
3.1 阶段目标
下一阶段只做一个切口: 把“live workspace controller 是 host 可写副本”收口为“content 只持有受控 projection,并通过显式 request 回传语义变化”。
做完这一阶段后,EditorWindowWorkspaceCoordinator 可以暂时保留现有 drag/detach 能力,但它不应再依赖 EditorWindow::GetWorkspaceController() / ReplaceWorkspaceController() 作为常规同步手段。
3.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 业务重构。
3.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 协调器里的常规读路径,只保留确实无法在本阶段消除的过渡性接口。
- 建立回归验证
- 保持现有
workspaceMutationrequest / destroyed window reconciliation 测试基线不回退。 - 为 projection refresh、title refresh 增补 focused unit coverage。
- 为 detach、dock、primary switch 至少补一组 focused integration 或 app feature tests,确保改造后 host 行为不回退。
- 继续保留
xcui_editor_app_smoke作为 editor 启动基线。
3.4 本阶段验收标准
EditorWorkspaceWindowContentController不再被当成 authority 副本使用。EditorWindowWorkspaceCoordinator的常规同步路径不再依赖ReplaceWorkspaceController(...)。- 标题、最小尺寸、detached tab strip 文案等 presentation 行为能从 projection / authoritative state 稳定导出。
workspaceMutation仍是 frame 内工作区变化的显式入口,没有恢复任何平台隐式写回。editor_windowing_phase1_tests与可用的 host 集成测试入口能覆盖本阶段新增规则。xcui_editor_app_smoke继续通过。
3.5 本阶段非目标
- 不重写
XCUIEditorApp启动流程。 - 不在本阶段改造
EditorShellRuntime、viewport render loop 或各 feature panel 业务。 - 不追求一次性删除所有
UIEditorWorkspaceController使用点,先消除 host 常规同步路径上的 authority 副本语义。 - 不把 Win32 host adapter 直接扩写成跨平台窗口系统。