Wrap native text within occurrence constraints and preserve paint bounds
Verify Tessera GUI / verify (push) Failing after 7m33s
Verify Tessera GUI / verify (push) Failing after 7m33s
This commit is contained in:
+33
-14
@@ -56,9 +56,15 @@ pub(crate) fn record(
|
||||
}
|
||||
Ok(object)
|
||||
}
|
||||
fn size(node: &crate::ui_bridge::UiNode) -> Result<Size, VmError> {
|
||||
let frame =
|
||||
layout::frame(node).map_err(|_| invalid("native measurement exceeds layout limits"))?;
|
||||
fn size(node: &crate::ui_bridge::UiNode, constraints: [f32; 4]) -> Result<Size, VmError> {
|
||||
let frame = layout::frame_with_viewport(
|
||||
node,
|
||||
Size {
|
||||
width: constraints[2],
|
||||
height: constraints[3],
|
||||
},
|
||||
)
|
||||
.map_err(|_| invalid("native measurement exceeds layout limits"))?;
|
||||
let root = frame
|
||||
.mounts
|
||||
.first()
|
||||
@@ -138,10 +144,10 @@ impl NativeCallable for Method {
|
||||
return Err(invalid("minimum exceeds maximum constraint"));
|
||||
}
|
||||
let size = if let Some((_, children)) = &staged {
|
||||
layout::measure_native(&node, children.clone())
|
||||
layout::measure_native(&node, children.clone(), [min_w, min_h, max_w, max_h])
|
||||
.map_err(|_| invalid("native measurement exceeds layout limits"))?
|
||||
} else {
|
||||
size(&node)?
|
||||
size(&node, [min_w, min_h, max_w, max_h])?
|
||||
};
|
||||
Value::Object(record(
|
||||
cx,
|
||||
@@ -166,7 +172,12 @@ impl NativeCallable for Method {
|
||||
} else {
|
||||
node.children()
|
||||
.iter()
|
||||
.map(|child| size(child))
|
||||
.map(|child| {
|
||||
size(
|
||||
child,
|
||||
layout::child_constraints(&node, [0.0, 0.0, width, height]),
|
||||
)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
};
|
||||
let points = layout::arrange_native(&node, x, y, &children)
|
||||
@@ -212,14 +223,22 @@ impl NativeCallable for Method {
|
||||
value: text,
|
||||
size,
|
||||
color,
|
||||
} => vec![
|
||||
("kind", Value::Text("text".into())),
|
||||
("x", value(x)),
|
||||
("y", value(y)),
|
||||
("text", Value::Text(text)),
|
||||
("size", Value::Number((size as i64).into())),
|
||||
("color", Value::Text(color)),
|
||||
],
|
||||
wrap_bounds,
|
||||
} => {
|
||||
let mut fields = vec![
|
||||
("kind", Value::Text("text".into())),
|
||||
("x", value(x)),
|
||||
("y", value(y)),
|
||||
("text", Value::Text(text)),
|
||||
("size", Value::Number((size as i64).into())),
|
||||
("color", Value::Text(color)),
|
||||
];
|
||||
if let Some([width, height]) = wrap_bounds {
|
||||
fields.push(("wrapWidth", value(width)));
|
||||
fields.push(("wrapHeight", value(height)));
|
||||
}
|
||||
fields
|
||||
}
|
||||
RenderCommand::RoundedRect {
|
||||
x,
|
||||
y,
|
||||
|
||||
Reference in New Issue
Block a user