Revert "chore: Bump taffy version to 0.4.3" (#11622)

Reverts zed-industries/zed#11606
This commit is contained in:
Piotr Osiewicz 2024-05-09 19:11:37 +02:00 committed by GitHub
parent 5fe4070501
commit f0af508ae5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 11 deletions

View file

@ -61,7 +61,7 @@ slotmap = "1.0.6"
smallvec.workspace = true
smol.workspace = true
sum_tree.workspace = true
taffy = "0.4.3"
taffy = { git = "https://github.com/DioxusLabs/taffy", rev = "1876f72bee5e376023eaa518aa7b8a34c769bd1b" }
thiserror.workspace = true
time.workspace = true
util.workspace = true

View file

@ -9,14 +9,14 @@ use taffy::{
geometry::{Point as TaffyPoint, Rect as TaffyRect, Size as TaffySize},
style::AvailableSpace as TaffyAvailableSpace,
tree::NodeId,
TaffyTree, TraversePartialTree as _,
Taffy,
};
type NodeMeasureFn =
Box<dyn FnMut(Size<Option<Pixels>>, Size<AvailableSpace>, &mut WindowContext) -> Size<Pixels>>;
pub struct TaffyLayoutEngine {
taffy: TaffyTree<()>,
taffy: Taffy,
styles: FxHashMap<LayoutId, Style>,
children_to_parents: FxHashMap<LayoutId, LayoutId>,
absolute_layout_bounds: FxHashMap<LayoutId, Bounds<Pixels>>,
@ -29,7 +29,7 @@ static EXPECT_MESSAGE: &str = "we should avoid taffy layout errors by constructi
impl TaffyLayoutEngine {
pub fn new() -> Self {
TaffyLayoutEngine {
taffy: TaffyTree::new(),
taffy: Taffy::new(),
styles: FxHashMap::default(),
children_to_parents: FxHashMap::default(),
absolute_layout_bounds: FxHashMap::default(),
@ -114,7 +114,7 @@ impl TaffyLayoutEngine {
fn max_depth(&self, depth: u32, parent: LayoutId) -> anyhow::Result<u32> {
println!(
"{parent:?} at depth {depth} has {} children",
self.taffy.child_count(parent.0)
self.taffy.child_count(parent.0)?
);
let mut max_child_depth = 0;