feat: allocate weighted flex space and remeasure affected occurrences
Verify Tessera GUI / verify (push) Failing after 7m59s
Verify Tessera GUI / verify (push) Failing after 7m59s
This commit is contained in:
+20
-14
@@ -193,7 +193,8 @@ impl NativeCallable for Step {
|
||||
};
|
||||
if matches!(self.phase, Phase::Arrange) {
|
||||
plan.runtime.arranged += 1;
|
||||
plan.custom_arrange[self.index] = !intrinsic;
|
||||
plan.custom_arrange[self.index] =
|
||||
!intrinsic || node.children().iter().any(|child| child.flex > 0.0);
|
||||
}
|
||||
(node, children, bounds, native_size)
|
||||
};
|
||||
@@ -658,9 +659,6 @@ pub fn render(
|
||||
cache.entries.retain(|mount, _| live.contains(mount));
|
||||
// Preserve the existing native measurement cache and avoid VM/result
|
||||
// allocation for trees without custom layout methods. Contexts already exist.
|
||||
let block_type = desktop_type(vm.object_store(), "Block", desktop)?;
|
||||
let native_measure = vm.object_store().lookup_method(block_type, "measure")?;
|
||||
let native_arrange = vm.object_store().lookup_method(block_type, "arrange")?;
|
||||
let mut custom = false;
|
||||
for weak in &mounts {
|
||||
let mount = vm
|
||||
@@ -672,14 +670,28 @@ pub fn render(
|
||||
.object_store()
|
||||
.type_of(block)?
|
||||
.ok_or(invalid("untyped layout target"))?;
|
||||
Ok::<_, VmError>(
|
||||
vm.object_store().lookup_method(definition, "measure")? != native_measure
|
||||
|| vm.object_store().lookup_method(definition, "arrange")? != native_arrange,
|
||||
)
|
||||
for name in ["measure", "arrange"] {
|
||||
let Some(method) = vm.object_store().lookup_method(definition, name)? else {
|
||||
return Ok::<_, VmError>(true);
|
||||
};
|
||||
if !crate::native_visual::is_intrinsic(vm.object_store(), method, name, desktop)? {
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
Ok(false)
|
||||
})();
|
||||
vm.release(mount)?;
|
||||
custom |= result?;
|
||||
}
|
||||
let mut nodes = Vec::new();
|
||||
let mut work = vec![root.clone()];
|
||||
while let Some(node) = work.pop() {
|
||||
custom |= node.flex > 0.0;
|
||||
work.extend(node.children().iter().rev().cloned());
|
||||
nodes.push(node);
|
||||
}
|
||||
// Flex allocation can change text wrapping and ancestor measurements even
|
||||
// when every protocol method is native. Use the same settling driver.
|
||||
if !custom {
|
||||
cache.clear();
|
||||
let mut native = runtime.frame(&root)?;
|
||||
@@ -689,12 +701,6 @@ pub fn render(
|
||||
*frame = native;
|
||||
return Ok(BTreeSet::new());
|
||||
}
|
||||
let mut nodes = Vec::new();
|
||||
let mut work = vec![root];
|
||||
while let Some(node) = work.pop() {
|
||||
work.extend(node.children().iter().rev().cloned());
|
||||
nodes.push(node);
|
||||
}
|
||||
anyhow::ensure!(
|
||||
nodes.len() == mounts.len() && nodes.len() == frame.mounts.len(),
|
||||
"layout structure does not match Mount contexts"
|
||||
|
||||
Reference in New Issue
Block a user