Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Fix Interactivity prepaint to update scroll_handle bounds (#35013)
Jason Lee65759d43163b
diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rsindex 4655c92409d..fa47758581d 100644--- a/crates/gpui/src/elements/div.rs+++ b/crates/gpui/src/elements/div.rs@@ -1334,7 +1334,6 @@ impl Element for Div {} else if let Some(scroll_handle) = self.interactivity.tracked_scroll_handle.as_ref() {let mut state = scroll_handle.0.borrow_mut();state.child_bounds = Vec::with_capacity(request_layout.child_layout_ids.len());- state.bounds = bounds;for child_layout_id in &request_layout.child_layout_ids {let child_bounds = window.layout_bounds(*child_layout_id);child_min = child_min.min(&child_bounds.origin);@@ -1706,6 +1705,7 @@ impl Interactivity {if let Some(mut scroll_handle_state) = tracked_scroll_handle {scroll_handle_state.max_offset = scroll_max;+ scroll_handle_state.bounds = bounds;}*scroll_offset@@ -3007,11 +3007,6 @@ impl ScrollHandle {self.0.borrow().bounds}- /// Set the bounds into which this child is painted- pub(super) fn set_bounds(&self, bounds: Bounds<Pixels>) {- self.0.borrow_mut().bounds = bounds;- }-/// Get the bounds for a specific child.pub fn bounds_for_item(&self, ix: usize) -> Option<Bounds<Pixels>> {self.0.borrow().child_bounds.get(ix).cloned()diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rsindex 52e2015c20f..e80656a0787 100644--- a/crates/gpui/src/elements/uniform_list.rs+++ b/crates/gpui/src/elements/uniform_list.rs@@ -295,9 +295,8 @@ impl Element for UniformList {bounds.bottom_right() - point(border.right + padding.right, border.bottom),);- let y_flipped = if let Some(scroll_handle) = self.scroll_handle.as_mut() {- let mut scroll_state = scroll_handle.0.borrow_mut();- scroll_state.base_handle.set_bounds(bounds);+ let y_flipped = if let Some(scroll_handle) = &self.scroll_handle {+ let scroll_state = scroll_handle.0.borrow();scroll_state.y_flipped} else {false