gpui: Fix debug selectors with cached views (#64433)

The debug-selector test mapping skipped cached views that weren't
rendered. Make sure we include them

---

Release Notes:

- [GPUI] N/A
This commit is contained in:
Cameron Mcloughlin authored and GitHub committed 2026-09-18 07:42:25 +00:00
1 parent ae59a5be17
commit 3eddbb7f4e
2 files changed
+24 -2

No files matched your search

+1 -2
View File
@@ -2522,8 +2522,7 @@ impl Interactivity {
if let Some(debug_selector) = &self.debug_selector {
window
.next_frame
.debug_bounds
.insert(debug_selector.clone(), bounds);
.record_debug_bounds(debug_selector.clone(), bounds);
}
self.paint_hover_group_handler(window, cx);
+23
View File
@@ -991,6 +991,8 @@ pub(crate) struct Frame {
pub(crate) cursor_styles: Vec<CursorStyleRequest>,
#[cfg(any(test, feature = "test-support"))]
pub(crate) debug_bounds: FxHashMap<String, Bounds<Pixels>>,
#[cfg(any(test, feature = "test-support"))]
debug_bounds_records: Vec<(String, Bounds<Pixels>)>,
#[cfg(any(feature = "inspector", debug_assertions))]
pub(crate) next_inspector_instance_ids: FxHashMap<Rc<crate::InspectorElementPath>, usize>,
#[cfg(any(feature = "inspector", debug_assertions))]
@@ -1011,6 +1013,8 @@ pub(crate) struct PrepaintStateIndex {
#[derive(Clone, Default)]
pub(crate) struct PaintIndex {
scene_index: usize,
#[cfg(any(test, feature = "test-support"))]
debug_bounds_index: usize,
mouse_listeners_index: usize,
input_handlers_index: usize,
cursor_styles_index: usize,
@@ -1020,6 +1024,12 @@ pub(crate) struct PaintIndex {
}
impl Frame {
#[cfg(any(test, feature = "test-support"))]
pub(crate) fn record_debug_bounds(&mut self, selector: String, bounds: Bounds<Pixels>) {
self.debug_bounds.insert(selector.clone(), bounds);
self.debug_bounds_records.push((selector, bounds));
}
pub(crate) fn new(dispatch_tree: DispatchTree) -> Self {
Frame {
focus: None,
@@ -1038,6 +1048,8 @@ impl Frame {
#[cfg(any(test, feature = "test-support"))]
debug_bounds: FxHashMap::default(),
#[cfg(any(test, feature = "test-support"))]
debug_bounds_records: Vec::new(),
#[cfg(any(feature = "inspector", debug_assertions))]
next_inspector_instance_ids: FxHashMap::default(),
@@ -1066,6 +1078,7 @@ impl Frame {
#[cfg(any(test, feature = "test-support"))]
{
self.debug_bounds.clear();
self.debug_bounds_records.clear();
}
#[cfg(any(feature = "inspector", debug_assertions))]
@@ -3860,6 +3873,8 @@ impl Window {
pub(crate) fn paint_index(&self) -> PaintIndex {
PaintIndex {
scene_index: self.next_frame.scene.len(),
#[cfg(any(test, feature = "test-support"))]
debug_bounds_index: self.next_frame.debug_bounds_records.len(),
mouse_listeners_index: self.next_frame.mouse_listeners.len(),
input_handlers_index: self.next_frame.input_handlers.len(),
cursor_styles_index: self.next_frame.cursor_styles.len(),
@@ -3870,6 +3885,14 @@ impl Window {
}
pub(crate) fn reuse_paint(&mut self, range: Range<PaintIndex>) {
// Cached elements still exist in the frame even when their paint methods don't run.
#[cfg(any(test, feature = "test-support"))]
for (selector, bounds) in &self.rendered_frame.debug_bounds_records
[range.start.debug_bounds_index..range.end.debug_bounds_index]
{
self.next_frame
.record_debug_bounds(selector.clone(), *bounds);
}
self.next_frame.cursor_styles.extend(
self.rendered_frame.cursor_styles
[range.start.cursor_styles_index..range.end.cursor_styles_index]