Move views_to_notify_if_ancestors_change to Window

This commit is contained in:
Nathan Sobo
2023-08-29 21:58:44 -06:00
parent 2e7356a53e
commit 48d3e2d9b9
6 changed files with 20 additions and 47 deletions
+1 -5
View File
@@ -38,10 +38,8 @@ use crate::{
ViewContext, WeakViewHandle, WindowContext,
};
use anyhow::{anyhow, Result};
use collections::HashMap;
use core::panic;
use json::ToJson;
use smallvec::SmallVec;
use std::{
any::{type_name, Any},
borrow::Cow,
@@ -649,7 +647,6 @@ pub trait AnyRootElement {
fn layout(
&mut self,
constraint: SizeConstraint,
views_to_notify_if_ancestors_change: &mut HashMap<usize, SmallVec<[usize; 2]>>,
refreshing: bool,
cx: &mut WindowContext,
) -> Result<Vector2F>;
@@ -673,7 +670,6 @@ impl<V: View> AnyRootElement for RootElement<V> {
fn layout(
&mut self,
constraint: SizeConstraint,
views_to_notify_if_ancestors_change: &mut HashMap<usize, SmallVec<[usize; 2]>>,
refreshing: bool,
cx: &mut WindowContext,
) -> Result<Vector2F> {
@@ -682,7 +678,7 @@ impl<V: View> AnyRootElement for RootElement<V> {
.upgrade(cx)
.ok_or_else(|| anyhow!("layout called on a root element for a dropped view"))?;
view.update(cx, |view, cx| {
let mut cx = LayoutContext::new(cx, views_to_notify_if_ancestors_change, refreshing);
let mut cx = LayoutContext::new(cx, refreshing);
Ok(self.element.layout(constraint, view, &mut cx))
})
}