From 657a25178d9d76862b5931cff05ebacedaf07f15 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 5 Oct 2023 17:00:37 +0200 Subject: [PATCH] Checkpoint --- crates/gpui3/src/style.rs | 7 +-- crates/gpui3/src/style_helpers.rs | 81 ++++++++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/crates/gpui3/src/style.rs b/crates/gpui3/src/style.rs index 299743e695..6ec12bbbd5 100644 --- a/crates/gpui3/src/style.rs +++ b/crates/gpui3/src/style.rs @@ -5,6 +5,7 @@ use crate::{ SharedString, Size, SizeRefinement, ViewContext, WindowContext, }; use refineable::Refineable; +use smallvec::SmallVec; pub use taffy::style::{ AlignContent, AlignItems, AlignSelf, Display, FlexDirection, FlexWrap, JustifyContent, Overflow, Position, @@ -90,7 +91,7 @@ pub struct Style { pub corner_radii: Corners, /// Box Shadow of the element - pub box_shadow: Option, + pub box_shadow: SmallVec<[BoxShadow; 2]>, /// TEXT pub text: TextStyleRefinement, @@ -244,7 +245,7 @@ impl Style { let rem_size = cx.rem_size(); let scale = cx.scale_factor(); - if let Some(shadow) = self.box_shadow.as_ref() { + for shadow in &self.box_shadow { let layer_id = cx.current_layer_id(); let content_mask = cx.content_mask(); let mut shadow_bounds = bounds; @@ -328,7 +329,7 @@ impl Default for Style { fill: None, border_color: None, corner_radii: Corners::default(), - box_shadow: None, + box_shadow: Default::default(), text: TextStyleRefinement::default(), } } diff --git a/crates/gpui3/src/style_helpers.rs b/crates/gpui3/src/style_helpers.rs index a763e95d1f..6bcbc69df0 100644 --- a/crates/gpui3/src/style_helpers.rs +++ b/crates/gpui3/src/style_helpers.rs @@ -3,6 +3,7 @@ use crate::{ FlexDirection, Hsla, JustifyContent, Length, Position, SharedString, Style, StyleRefinement, Styled, TextStyleRefinement, }; +use smallvec::smallvec; pub trait StyleHelpers: Styled