Upgrade yoga-rs to v0.5.0 (#791)
Signed-off-by: Nico Burns <nico@nicoburns.com>
6594bbdc723b4c6b6cd9b01e8b63cd714d8148dd · by Nico Burns · (1 year ago) · parent 80cc4a080 · browse the tree at this commit
Semantic delta · 4
benches/src/yoga_helpers.rs
diff --git a/benches/Cargo.toml b/benches/Cargo.toml
index a0a288d16..c7a0cd2a4 100644
--- a/benches/Cargo.toml
+++ b/benches/Cargo.toml
@@ -18,8 +18,8 @@ rand = { version = "0.8.5" }
rand_chacha = "0.3.1"
taffy = { path = ".." }
taffy_03 = { package = "taffy", version = "0.3", optional = true }
-yoga = { version = "0.4.0", optional = true }
-ordered-float = { version = "3.4.0", optional = true }
+yoga = { version = "0.5.0", optional = true }
+ordered-float = { version = "4", optional = true }
slotmap = { version = "1.0.6", optional = true }
[features]
diff --git a/benches/src/yoga_helpers.rs b/benches/src/yoga_helpers.rs
index de9717551..d46a8cd52 100644
--- a/benches/src/yoga_helpers.rs
+++ b/benches/src/yoga_helpers.rs
@@ -106,7 +106,7 @@ fn create_yg_node(tree: &mut yg::YogaTree, style: &tf::Style, children: &[yg::De
let mut node = yg::Node::new();
apply_taffy_style(&mut node, &style);
for (i, child) in children.into_iter().enumerate() {
- node.insert_child(&mut tree[*child], i as u32);
+ node.insert_child(&mut tree[*child], i);
}
tree.insert(node)
}
@@ -114,7 +114,7 @@ fn create_yg_node(tree: &mut yg::YogaTree, style: &tf::Style, children: &[yg::De
pub fn new_default_style_with_children(tree: &mut yg::YogaTree, children: &[yg::DefaultKey]) -> yg::DefaultKey {
let mut node = yg::Node::new();
for (i, child) in children.into_iter().enumerate() {
- node.insert_child(&mut tree[*child], i as u32);
+ node.insert_child(&mut tree[*child], i);
}
tree.insert(node)
}
@@ -123,7 +123,7 @@ fn set_node_children(tree: &mut yg::YogaTree, node_id: yg::DefaultKey, children:
// TODO: clear existing children.
for (i, child_id) in children.into_iter().enumerate() {
let [node, child] = tree.get_disjoint_mut([node_id, *child_id]).unwrap();
- node.insert_child(child, i as u32);
+ node.insert_child(child, i);
}
}
@@ -194,6 +194,12 @@ fn apply_taffy_style(node: &mut yg::Node, style: &tf::Style) {
tf::Display::Block => panic!("Yoga does not support CSS Block layout"),
});
+ // box_sizing
+ node.set_box_sizing(match style.box_sizing {
+ tf::BoxSizing::BorderBox => yg::BoxSizing::BorderBox,
+ tf::BoxSizing::ContentBox => yg::BoxSizing::ContentBox,
+ });
+
// position
node.set_position_type(match style.position {
tf::Position::Relative => yg::PositionType::Relative,
@@ -239,8 +245,8 @@ fn apply_taffy_style(node: &mut yg::Node, style: &tf::Style) {
node.set_justify_content(content_into_justify(style.justify_content));
// gap
- node.set_column_gap(into_pixels(style.gap.width));
- node.set_row_gap(into_pixels(style.gap.height));
+ node.set_column_gap(into_yg_units(style.gap.width));
+ node.set_row_gap(into_yg_units(style.gap.height));
// flex
node.set_flex_direction(match style.flex_direction {