docs: explain intrinsic visual paths and shared font cache lifetimes
This commit is contained in:
@@ -60,6 +60,7 @@ pub(crate) fn value(value: f32) -> Value {
|
||||
Value::Number((value as f64).into())
|
||||
}
|
||||
/// 新建指定名义类型的托管记录,并逐项设置字段,作为视觉协议的结果返回。
|
||||
/// 默认协议、graphics 和 Window 查询等原生入口共用;这里只附类型/写字段,结果几何与列表成员的语义仍由消费者解码验证。
|
||||
pub(crate) fn record(
|
||||
cx: &mut NativeContext<'_>,
|
||||
desktop: ObjectRef,
|
||||
@@ -185,6 +186,7 @@ impl NativeCallable for Method {
|
||||
// 复制最后提交几何,只有非 staged 的命中/独立调用使用这份出现值。
|
||||
let geometry = mount.geometry.clone();
|
||||
// 布局阶段从临时 Context 取当前节点、孩子实测尺寸与首选尺寸;克隆派生数据后释放锁再进行计算。
|
||||
// 源覆盖显式调用 Block.measure/arrange 时也会进入这里,必须沿用本轮子测量,不能重新用默认算法覆盖源孩子的返回值。
|
||||
let staged = mount
|
||||
.layout
|
||||
.as_ref()
|
||||
@@ -303,6 +305,7 @@ impl NativeCallable for Method {
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
};
|
||||
// preferred 保留弹性分配所需首选大小,与已受约束的实测 children 区分;无 staged 时两者相同。
|
||||
// 收敛循环可能反复改变 children 的分配,preferred 不随每轮分配累计变化,避免 flex 把上轮结果当新自然基准。
|
||||
let preferred = staged
|
||||
.as_ref()
|
||||
.map_or(children.as_slice(), |(_, _, preferred)| {
|
||||
@@ -357,6 +360,7 @@ impl NativeCallable for Method {
|
||||
return Err(invalid("visual bounds exceed limits"));
|
||||
}
|
||||
// 本次 paint 的派生结果集合,不能包含运行时可变 VM 场景对象。
|
||||
// 普通原生 paint 可由 source_paint 快速路径直接保留默认命令;源覆盖调用基类 paint 时才需要这里反向编码为托管结果。
|
||||
let mut commands = Vec::new();
|
||||
// 将 Rust 默认绘制命令反向编码成源 PaintCommand,允许源覆盖方法调用基类 paint 后继续组合。
|
||||
for command in layout::paint_commands(&node, x, y, Size { width, height }) {
|
||||
|
||||
Reference in New Issue
Block a user