From aa6926e57ae78afc421dbdaabcab5907936d3d1e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 16 Feb 2024 14:30:31 +0100 Subject: [PATCH] Revert "Upgrade to Taffy 0.4" (#7896) Reverts zed-industries/zed#7868 @nicoburns: this seems to break text input in the chat panel, so reverting this for now. image It would be great to upgrade to Taffy 0.4 though, so we should figure out why that particular input breaks. Release notes: - N/A --- Cargo.lock | 10 ++++------ crates/gpui/Cargo.toml | 2 +- crates/gpui/src/taffy.rs | 12 +++++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aeb4524576..064192a69f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4016,9 +4016,9 @@ dependencies = [ [[package]] name = "grid" -version = "0.13.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d196ffc1627db18a531359249b2bf8416178d84b729f3cebeb278f285fb9b58c" +checksum = "1df00eed8d1f0db937f6be10e46e8072b0671accb504cf0f959c5c52c679f5b9" [[package]] name = "group" @@ -9103,14 +9103,12 @@ dependencies = [ [[package]] name = "taffy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fddbee94e20bc4612dcb789953324236eebd4fc6a08c650ccbf7f615e59a0d6a" +version = "0.3.11" +source = "git+https://github.com/DioxusLabs/taffy?rev=1876f72bee5e376023eaa518aa7b8a34c769bd1b#1876f72bee5e376023eaa518aa7b8a34c769bd1b" dependencies = [ "arrayvec 0.7.4", "grid", "num-traits", - "serde", "slotmap", ] diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index 399b8ae3f3..7679761291 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -60,7 +60,7 @@ slotmap = "1.0.6" smallvec.workspace = true smol.workspace = true sum_tree.workspace = true -taffy = "0.4" +taffy = { git = "https://github.com/DioxusLabs/taffy", rev = "1876f72bee5e376023eaa518aa7b8a34c769bd1b" } thiserror.workspace = true time.workspace = true tiny-skia = "0.5" diff --git a/crates/gpui/src/taffy.rs b/crates/gpui/src/taffy.rs index 1d46630494..0797c8f3b4 100644 --- a/crates/gpui/src/taffy.rs +++ b/crates/gpui/src/taffy.rs @@ -6,15 +6,17 @@ use collections::{FxHashMap, FxHashSet}; use smallvec::SmallVec; use std::fmt::Debug; use taffy::{ - AvailableSpace as TaffyAvailableSpace, NodeId, Point as TaffyPoint, Rect as TaffyRect, - Size as TaffySize, TaffyTree, TraversePartialTree, + geometry::{Point as TaffyPoint, Rect as TaffyRect, Size as TaffySize}, + style::AvailableSpace as TaffyAvailableSpace, + tree::NodeId, + Taffy, }; type NodeMeasureFn = Box>, Size, &mut WindowContext) -> Size>; pub struct TaffyLayoutEngine { - taffy: TaffyTree<()>, + taffy: Taffy, styles: FxHashMap, children_to_parents: FxHashMap, absolute_layout_bounds: FxHashMap>, @@ -27,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(), @@ -118,7 +120,7 @@ impl TaffyLayoutEngine { fn max_depth(&self, depth: u32, parent: LayoutId) -> anyhow::Result { 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;