mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +00:00
Remove unnecessary Element
impl for RootElement
This commit is contained in:
parent
f62ba2eec7
commit
4c1cba6def
1 changed files with 0 additions and 58 deletions
|
@ -45,7 +45,6 @@ use std::{
|
||||||
mem,
|
mem,
|
||||||
ops::{Deref, DerefMut, Range},
|
ops::{Deref, DerefMut, Range},
|
||||||
};
|
};
|
||||||
use util::ResultExt;
|
|
||||||
|
|
||||||
pub trait Element<V: View>: 'static {
|
pub trait Element<V: View>: 'static {
|
||||||
type LayoutState;
|
type LayoutState;
|
||||||
|
@ -717,63 +716,6 @@ impl<V: View> AnyRootElement for RootElement<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: View, R: View> Element<V> for RootElement<R> {
|
|
||||||
type LayoutState = ();
|
|
||||||
type PaintState = ();
|
|
||||||
|
|
||||||
fn layout(
|
|
||||||
&mut self,
|
|
||||||
constraint: SizeConstraint,
|
|
||||||
_view: &mut V,
|
|
||||||
cx: &mut ViewContext<V>,
|
|
||||||
) -> (Vector2F, ()) {
|
|
||||||
let size = AnyRootElement::layout(self, constraint, cx)
|
|
||||||
.log_err()
|
|
||||||
.unwrap_or_else(|| Vector2F::zero());
|
|
||||||
(size, ())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn paint(
|
|
||||||
&mut self,
|
|
||||||
scene: &mut SceneBuilder,
|
|
||||||
bounds: RectF,
|
|
||||||
visible_bounds: RectF,
|
|
||||||
_layout: &mut Self::LayoutState,
|
|
||||||
_view: &mut V,
|
|
||||||
cx: &mut ViewContext<V>,
|
|
||||||
) {
|
|
||||||
AnyRootElement::paint(self, scene, bounds.origin(), visible_bounds, cx).log_err();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn rect_for_text_range(
|
|
||||||
&self,
|
|
||||||
range_utf16: Range<usize>,
|
|
||||||
_bounds: RectF,
|
|
||||||
_visible_bounds: RectF,
|
|
||||||
_layout: &Self::LayoutState,
|
|
||||||
_paint: &Self::PaintState,
|
|
||||||
_view: &V,
|
|
||||||
cx: &ViewContext<V>,
|
|
||||||
) -> Option<RectF> {
|
|
||||||
AnyRootElement::rect_for_text_range(self, range_utf16, cx)
|
|
||||||
.log_err()
|
|
||||||
.flatten()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn debug(
|
|
||||||
&self,
|
|
||||||
_bounds: RectF,
|
|
||||||
_layout: &Self::LayoutState,
|
|
||||||
_paint: &Self::PaintState,
|
|
||||||
_view: &V,
|
|
||||||
cx: &ViewContext<V>,
|
|
||||||
) -> serde_json::Value {
|
|
||||||
AnyRootElement::debug(self, cx)
|
|
||||||
.log_err()
|
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait ParentElement<'a, V: View>: Extend<AnyElement<V>> + Sized {
|
pub trait ParentElement<'a, V: View>: Extend<AnyElement<V>> + Sized {
|
||||||
fn add_children<E: Element<V>>(&mut self, children: impl IntoIterator<Item = E>) {
|
fn add_children<E: Element<V>>(&mut self, children: impl IntoIterator<Item = E>) {
|
||||||
self.extend(children.into_iter().map(|child| child.into_any()));
|
self.extend(children.into_iter().map(|child| child.into_any()));
|
||||||
|
|
Loading…
Reference in a new issue