Run source measurement and arrangement in the frame pipeline
Verify Tessera GUI / verify (push) Failing after 7m30s
Verify Tessera GUI / verify (push) Failing after 7m30s
This commit is contained in:
+40
-10
@@ -22,7 +22,7 @@ fn object(value: &Value) -> Result<ObjectRef, VmError> {
|
||||
Err(invalid("visual protocol requires objects"))
|
||||
}
|
||||
}
|
||||
fn number(
|
||||
pub(crate) fn number(
|
||||
cx: &NativeContext<'_>,
|
||||
object: ObjectRef,
|
||||
name: &str,
|
||||
@@ -40,10 +40,10 @@ fn number(
|
||||
}
|
||||
Ok(value)
|
||||
}
|
||||
fn value(value: f32) -> Value {
|
||||
pub(crate) fn value(value: f32) -> Value {
|
||||
Value::Number((value as f64).into())
|
||||
}
|
||||
fn record(
|
||||
pub(crate) fn record(
|
||||
cx: &mut NativeContext<'_>,
|
||||
desktop: ObjectRef,
|
||||
kind: &str,
|
||||
@@ -93,15 +93,37 @@ impl NativeCallable for Method {
|
||||
));
|
||||
}
|
||||
let geometry = mount.geometry.clone();
|
||||
let staged = mount
|
||||
.layout
|
||||
.as_ref()
|
||||
.map(|layout| {
|
||||
let layout = layout
|
||||
.lock()
|
||||
.map_err(|_| invalid("layout context poisoned"))?;
|
||||
Ok::<_, VmError>((layout.node.clone(), layout.children.clone()))
|
||||
})
|
||||
.transpose()?;
|
||||
let input = object(input)?;
|
||||
if matches!(self.query, Query::HitTest) {
|
||||
if staged.is_some() {
|
||||
return Err(invalid("hitTest is unavailable during layout"));
|
||||
}
|
||||
let x = number(cx, input, "x", true)?;
|
||||
let y = number(cx, input, "y", true)?;
|
||||
return Ok(NativeResult::Return(Value::Bool(
|
||||
x >= 0.0 && y >= 0.0 && x < geometry.width && y < geometry.height,
|
||||
)));
|
||||
}
|
||||
let node = block::snapshot(cx.store(), owner)?;
|
||||
if matches!(&staged, Some((None, _))) {
|
||||
return Err(invalid(
|
||||
"layout context is not prepared for this occurrence",
|
||||
));
|
||||
}
|
||||
let node = if let Some((Some(node), _)) = &staged {
|
||||
node.clone()
|
||||
} else {
|
||||
block::snapshot(cx.store(), owner)?
|
||||
};
|
||||
let result = match self.query {
|
||||
Query::Measure => {
|
||||
let min_w = number(cx, input, "minWidth", false)?;
|
||||
@@ -111,7 +133,12 @@ impl NativeCallable for Method {
|
||||
if min_w > max_w || min_h > max_h {
|
||||
return Err(invalid("minimum exceeds maximum constraint"));
|
||||
}
|
||||
let size = size(&node)?;
|
||||
let size = if let Some((_, children)) = &staged {
|
||||
layout::measure_native(&node, children.clone())
|
||||
.map_err(|_| invalid("native measurement exceeds layout limits"))?
|
||||
} else {
|
||||
size(&node)?
|
||||
};
|
||||
Value::Object(record(
|
||||
cx,
|
||||
self.desktop,
|
||||
@@ -130,11 +157,14 @@ impl NativeCallable for Method {
|
||||
if x + width > MAX_DIMENSION as f32 || y + height > MAX_DIMENSION as f32 {
|
||||
return Err(invalid("visual bounds exceed limits"));
|
||||
}
|
||||
let children: Vec<_> = node
|
||||
.children()
|
||||
.iter()
|
||||
.map(|child| size(child))
|
||||
.collect::<Result<_, _>>()?;
|
||||
let children = if let Some((_, children)) = &staged {
|
||||
children.clone()
|
||||
} else {
|
||||
node.children()
|
||||
.iter()
|
||||
.map(|child| size(child))
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
};
|
||||
let points = layout::arrange_native(&node, x, y, &children)
|
||||
.map_err(|_| invalid("native arrangement exceeds limits"))?;
|
||||
let mut result = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user