Allow notifying views when the ancestry of another view is outdated

This commit is contained in:
Antonio Scandurra 2023-05-03 19:25:00 +02:00
parent 7250754f8e
commit 040cc4d4c3
3 changed files with 27 additions and 6 deletions

View file

@ -37,9 +37,10 @@ use crate::{
WindowContext,
};
use anyhow::{anyhow, Result};
use collections::{HashMap, HashSet};
use collections::HashMap;
use core::panic;
use json::ToJson;
use smallvec::SmallVec;
use std::{
any::Any,
borrow::Cow,
@ -648,7 +649,7 @@ pub trait AnyRootElement {
&mut self,
constraint: SizeConstraint,
new_parents: &mut HashMap<usize, usize>,
views_to_notify_if_ancestors_change: &mut HashSet<usize>,
views_to_notify_if_ancestors_change: &mut HashMap<usize, SmallVec<[usize; 2]>>,
refreshing: bool,
cx: &mut WindowContext,
) -> Result<Vector2F>;
@ -673,7 +674,7 @@ impl<V: View> AnyRootElement for RootElement<V> {
&mut self,
constraint: SizeConstraint,
new_parents: &mut HashMap<usize, usize>,
views_to_notify_if_ancestors_change: &mut HashSet<usize>,
views_to_notify_if_ancestors_change: &mut HashMap<usize, SmallVec<[usize; 2]>>,
refreshing: bool,
cx: &mut WindowContext,
) -> Result<Vector2F> {