From fda03d4f0d8e8143e36b97b4affd79794c0dfe10 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Mon, 5 Aug 2024 11:07:27 +1200 Subject: [PATCH] Module rename / reorganisation --- taffy_stylo/src/arc.rs | 106 +++++++++++++------------ taffy_stylo/src/borrowed.rs | 106 +++++++++++++------------ taffy_stylo/src/{t2s.rs => convert.rs} | 38 ++++++++- taffy_stylo/src/lib.rs | 41 +--------- 4 files changed, 148 insertions(+), 143 deletions(-) rename taffy_stylo/src/{t2s.rs => convert.rs} (81%) diff --git a/taffy_stylo/src/arc.rs b/taffy_stylo/src/arc.rs index f015b22ac..50f12cece 100644 --- a/taffy_stylo/src/arc.rs +++ b/taffy_stylo/src/arc.rs @@ -1,10 +1,11 @@ -use crate::{stylo, t2s}; +use crate::convert; use servo_arc::Arc; +use style::properties::generated::ComputedValues; -pub struct TaffyStyloStyle(pub Arc); +pub struct TaffyStyloStyle(pub Arc); -impl From> for TaffyStyloStyle { - fn from(value: Arc) -> Self { +impl From> for TaffyStyloStyle { + fn from(value: Arc) -> Self { Self(Arc::clone(&value)) } } @@ -12,23 +13,23 @@ impl From> for TaffyStyloStyle { impl taffy::CoreStyle for TaffyStyloStyle { #[inline] fn box_generation_mode(&self) -> taffy::BoxGenerationMode { - t2s::box_generation_mode(self.0.get_box().display) + convert::box_generation_mode(self.0.get_box().display) } #[inline] fn is_block(&self) -> bool { - t2s::is_block(self.0.get_box().display) + convert::is_block(self.0.get_box().display) } #[inline] fn box_sizing(&self) -> taffy::BoxSizing { - t2s::box_sizing(self.0.get_position().box_sizing) + convert::box_sizing(self.0.get_position().box_sizing) } #[inline] fn overflow(&self) -> taffy::Point { let box_styles = self.0.get_box(); - taffy::Point { x: t2s::overflow(box_styles.overflow_x), y: t2s::overflow(box_styles.overflow_y) } + taffy::Point { x: convert::overflow(box_styles.overflow_x), y: convert::overflow(box_styles.overflow_y) } } #[inline] @@ -38,32 +39,35 @@ impl taffy::CoreStyle for TaffyStyloStyle { #[inline] fn position(&self) -> taffy::Position { - t2s::position(self.0.get_box().position) + convert::position(self.0.get_box().position) } #[inline] fn inset(&self) -> taffy::Rect { let position_styles = self.0.get_position(); taffy::Rect { - left: t2s::length_percentage_auto(&position_styles.left), - right: t2s::length_percentage_auto(&position_styles.right), - top: t2s::length_percentage_auto(&position_styles.top), - bottom: t2s::length_percentage_auto(&position_styles.bottom), + left: convert::length_percentage_auto(&position_styles.left), + right: convert::length_percentage_auto(&position_styles.right), + top: convert::length_percentage_auto(&position_styles.top), + bottom: convert::length_percentage_auto(&position_styles.bottom), } } #[inline] fn size(&self) -> taffy::Size { let position_styles = self.0.get_position(); - taffy::Size { width: t2s::dimension(&position_styles.width), height: t2s::dimension(&position_styles.height) } + taffy::Size { + width: convert::dimension(&position_styles.width), + height: convert::dimension(&position_styles.height), + } } #[inline] fn min_size(&self) -> taffy::Size { let position_styles = self.0.get_position(); taffy::Size { - width: t2s::dimension(&position_styles.min_width), - height: t2s::dimension(&position_styles.min_height), + width: convert::dimension(&position_styles.min_width), + height: convert::dimension(&position_styles.min_height), } } @@ -71,24 +75,24 @@ impl taffy::CoreStyle for TaffyStyloStyle { fn max_size(&self) -> taffy::Size { let position_styles = self.0.get_position(); taffy::Size { - width: t2s::max_size_dimension(&position_styles.max_width), - height: t2s::max_size_dimension(&position_styles.max_height), + width: convert::max_size_dimension(&position_styles.max_width), + height: convert::max_size_dimension(&position_styles.max_height), } } #[inline] fn aspect_ratio(&self) -> Option { - t2s::aspect_ratio(self.0.get_position().aspect_ratio) + convert::aspect_ratio(self.0.get_position().aspect_ratio) } #[inline] fn margin(&self) -> taffy::Rect { let margin_styles = self.0.get_margin(); taffy::Rect { - left: t2s::length_percentage_auto(&margin_styles.margin_left), - right: t2s::length_percentage_auto(&margin_styles.margin_right), - top: t2s::length_percentage_auto(&margin_styles.margin_top), - bottom: t2s::length_percentage_auto(&margin_styles.margin_bottom), + left: convert::length_percentage_auto(&margin_styles.margin_left), + right: convert::length_percentage_auto(&margin_styles.margin_right), + top: convert::length_percentage_auto(&margin_styles.margin_top), + bottom: convert::length_percentage_auto(&margin_styles.margin_bottom), } } @@ -96,10 +100,10 @@ impl taffy::CoreStyle for TaffyStyloStyle { fn padding(&self) -> taffy::Rect { let padding_styles = self.0.get_padding(); taffy::Rect { - left: t2s::length_percentage(&padding_styles.padding_left.0), - right: t2s::length_percentage(&padding_styles.padding_right.0), - top: t2s::length_percentage(&padding_styles.padding_top.0), - bottom: t2s::length_percentage(&padding_styles.padding_bottom.0), + left: convert::length_percentage(&padding_styles.padding_left.0), + right: convert::length_percentage(&padding_styles.padding_right.0), + top: convert::length_percentage(&padding_styles.padding_top.0), + bottom: convert::length_percentage(&padding_styles.padding_bottom.0), } } @@ -118,40 +122,40 @@ impl taffy::CoreStyle for TaffyStyloStyle { impl taffy::FlexboxContainerStyle for TaffyStyloStyle { #[inline] fn flex_direction(&self) -> taffy::FlexDirection { - t2s::flex_direction(self.0.get_position().flex_direction) + convert::flex_direction(self.0.get_position().flex_direction) } #[inline] fn flex_wrap(&self) -> taffy::FlexWrap { - t2s::flex_wrap(self.0.get_position().flex_wrap) + convert::flex_wrap(self.0.get_position().flex_wrap) } #[inline] fn gap(&self) -> taffy::Size { let position_styles = self.0.get_position(); - taffy::Size { width: t2s::gap(&position_styles.column_gap), height: t2s::gap(&position_styles.row_gap) } + taffy::Size { width: convert::gap(&position_styles.column_gap), height: convert::gap(&position_styles.row_gap) } } #[inline] fn align_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().align_content.0) + convert::content_alignment(self.0.get_position().align_content.0) } #[inline] fn align_items(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_items.0) + convert::item_alignment(self.0.get_position().align_items.0) } #[inline] fn justify_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().justify_content.0) + convert::content_alignment(self.0.get_position().justify_content.0) } } impl taffy::FlexboxItemStyle for TaffyStyloStyle { #[inline] fn flex_basis(&self) -> taffy::Dimension { - t2s::flex_basis(&self.0.get_position().flex_basis) + convert::flex_basis(&self.0.get_position().flex_basis) } #[inline] @@ -166,7 +170,7 @@ impl taffy::FlexboxItemStyle for TaffyStyloStyle { #[inline] fn align_self(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_self.0 .0) + convert::item_alignment(self.0.get_position().align_self.0 .0) } } @@ -176,53 +180,53 @@ impl taffy::GridContainerStyle for TaffyStyloStyle { #[inline] fn grid_template_rows(&self) -> Self::TemplateTrackList<'_> { - t2s::grid_template_tracks(&self.0.get_position().grid_template_rows) + convert::grid_template_tracks(&self.0.get_position().grid_template_rows) } #[inline] fn grid_template_columns(&self) -> Self::TemplateTrackList<'_> { - t2s::grid_template_tracks(&self.0.get_position().grid_template_columns) + convert::grid_template_tracks(&self.0.get_position().grid_template_columns) } #[inline] fn grid_auto_rows(&self) -> Self::AutoTrackList<'_> { - t2s::grid_auto_tracks(&self.0.get_position().grid_auto_rows) + convert::grid_auto_tracks(&self.0.get_position().grid_auto_rows) } #[inline] fn grid_auto_columns(&self) -> Self::AutoTrackList<'_> { - t2s::grid_auto_tracks(&self.0.get_position().grid_auto_columns) + convert::grid_auto_tracks(&self.0.get_position().grid_auto_columns) } #[inline] fn grid_auto_flow(&self) -> taffy::GridAutoFlow { - t2s::grid_auto_flow(self.0.get_position().grid_auto_flow) + convert::grid_auto_flow(self.0.get_position().grid_auto_flow) } #[inline] fn gap(&self) -> taffy::Size { let position_styles = self.0.get_position(); - taffy::Size { width: t2s::gap(&position_styles.column_gap), height: t2s::gap(&position_styles.row_gap) } + taffy::Size { width: convert::gap(&position_styles.column_gap), height: convert::gap(&position_styles.row_gap) } } #[inline] fn align_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().align_content.0) + convert::content_alignment(self.0.get_position().align_content.0) } #[inline] fn justify_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().justify_content.0) + convert::content_alignment(self.0.get_position().justify_content.0) } #[inline] fn align_items(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_items.0) + convert::item_alignment(self.0.get_position().align_items.0) } #[inline] fn justify_items(&self) -> Option { - t2s::item_alignment(self.0.get_position().justify_items.computed.0) + convert::item_alignment(self.0.get_position().justify_items.computed.0) } } @@ -231,8 +235,8 @@ impl taffy::GridItemStyle for TaffyStyloStyle { fn grid_row(&self) -> taffy::Line { let position_styles = self.0.get_position(); taffy::Line { - start: t2s::grid_line(&position_styles.grid_row_start), - end: t2s::grid_line(&position_styles.grid_row_end), + start: convert::grid_line(&position_styles.grid_row_start), + end: convert::grid_line(&position_styles.grid_row_end), } } @@ -240,18 +244,18 @@ impl taffy::GridItemStyle for TaffyStyloStyle { fn grid_column(&self) -> taffy::Line { let position_styles = self.0.get_position(); taffy::Line { - start: t2s::grid_line(&position_styles.grid_column_start), - end: t2s::grid_line(&position_styles.grid_column_end), + start: convert::grid_line(&position_styles.grid_column_start), + end: convert::grid_line(&position_styles.grid_column_end), } } #[inline] fn align_self(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_self.0 .0) + convert::item_alignment(self.0.get_position().align_self.0 .0) } #[inline] fn justify_self(&self) -> Option { - t2s::item_alignment(self.0.get_position().justify_self.0 .0) + convert::item_alignment(self.0.get_position().justify_self.0 .0) } } diff --git a/taffy_stylo/src/borrowed.rs b/taffy_stylo/src/borrowed.rs index 2f0003459..d67753fe7 100644 --- a/taffy_stylo/src/borrowed.rs +++ b/taffy_stylo/src/borrowed.rs @@ -1,9 +1,10 @@ -use crate::{stylo, t2s}; +use crate::convert; +use style::properties::generated::ComputedValues; -pub struct TaffyStyloStyleRef<'a>(pub &'a stylo::ComputedValues); +pub struct TaffyStyloStyleRef<'a>(pub &'a ComputedValues); -impl<'a> From<&'a stylo::ComputedValues> for TaffyStyloStyleRef<'a> { - fn from(value: &'a stylo::ComputedValues) -> Self { +impl<'a> From<&'a ComputedValues> for TaffyStyloStyleRef<'a> { + fn from(value: &'a ComputedValues) -> Self { Self(value) } } @@ -11,23 +12,23 @@ impl<'a> From<&'a stylo::ComputedValues> for TaffyStyloStyleRef<'a> { impl taffy::CoreStyle for TaffyStyloStyleRef<'_> { #[inline] fn box_generation_mode(&self) -> taffy::BoxGenerationMode { - t2s::box_generation_mode(self.0.get_box().display) + convert::box_generation_mode(self.0.get_box().display) } #[inline] fn is_block(&self) -> bool { - t2s::is_block(self.0.get_box().display) + convert::is_block(self.0.get_box().display) } #[inline] fn box_sizing(&self) -> taffy::BoxSizing { - t2s::box_sizing(self.0.get_position().box_sizing) + convert::box_sizing(self.0.get_position().box_sizing) } #[inline] fn overflow(&self) -> taffy::Point { let box_styles = self.0.get_box(); - taffy::Point { x: t2s::overflow(box_styles.overflow_x), y: t2s::overflow(box_styles.overflow_y) } + taffy::Point { x: convert::overflow(box_styles.overflow_x), y: convert::overflow(box_styles.overflow_y) } } #[inline] @@ -37,32 +38,35 @@ impl taffy::CoreStyle for TaffyStyloStyleRef<'_> { #[inline] fn position(&self) -> taffy::Position { - t2s::position(self.0.get_box().position) + convert::position(self.0.get_box().position) } #[inline] fn inset(&self) -> taffy::Rect { let position_styles = self.0.get_position(); taffy::Rect { - left: t2s::length_percentage_auto(&position_styles.left), - right: t2s::length_percentage_auto(&position_styles.right), - top: t2s::length_percentage_auto(&position_styles.top), - bottom: t2s::length_percentage_auto(&position_styles.bottom), + left: convert::length_percentage_auto(&position_styles.left), + right: convert::length_percentage_auto(&position_styles.right), + top: convert::length_percentage_auto(&position_styles.top), + bottom: convert::length_percentage_auto(&position_styles.bottom), } } #[inline] fn size(&self) -> taffy::Size { let position_styles = self.0.get_position(); - taffy::Size { width: t2s::dimension(&position_styles.width), height: t2s::dimension(&position_styles.height) } + taffy::Size { + width: convert::dimension(&position_styles.width), + height: convert::dimension(&position_styles.height), + } } #[inline] fn min_size(&self) -> taffy::Size { let position_styles = self.0.get_position(); taffy::Size { - width: t2s::dimension(&position_styles.min_width), - height: t2s::dimension(&position_styles.min_height), + width: convert::dimension(&position_styles.min_width), + height: convert::dimension(&position_styles.min_height), } } @@ -70,24 +74,24 @@ impl taffy::CoreStyle for TaffyStyloStyleRef<'_> { fn max_size(&self) -> taffy::Size { let position_styles = self.0.get_position(); taffy::Size { - width: t2s::max_size_dimension(&position_styles.max_width), - height: t2s::max_size_dimension(&position_styles.max_height), + width: convert::max_size_dimension(&position_styles.max_width), + height: convert::max_size_dimension(&position_styles.max_height), } } #[inline] fn aspect_ratio(&self) -> Option { - t2s::aspect_ratio(self.0.get_position().aspect_ratio) + convert::aspect_ratio(self.0.get_position().aspect_ratio) } #[inline] fn margin(&self) -> taffy::Rect { let margin_styles = self.0.get_margin(); taffy::Rect { - left: t2s::length_percentage_auto(&margin_styles.margin_left), - right: t2s::length_percentage_auto(&margin_styles.margin_right), - top: t2s::length_percentage_auto(&margin_styles.margin_top), - bottom: t2s::length_percentage_auto(&margin_styles.margin_bottom), + left: convert::length_percentage_auto(&margin_styles.margin_left), + right: convert::length_percentage_auto(&margin_styles.margin_right), + top: convert::length_percentage_auto(&margin_styles.margin_top), + bottom: convert::length_percentage_auto(&margin_styles.margin_bottom), } } @@ -95,10 +99,10 @@ impl taffy::CoreStyle for TaffyStyloStyleRef<'_> { fn padding(&self) -> taffy::Rect { let padding_styles = self.0.get_padding(); taffy::Rect { - left: t2s::length_percentage(&padding_styles.padding_left.0), - right: t2s::length_percentage(&padding_styles.padding_right.0), - top: t2s::length_percentage(&padding_styles.padding_top.0), - bottom: t2s::length_percentage(&padding_styles.padding_bottom.0), + left: convert::length_percentage(&padding_styles.padding_left.0), + right: convert::length_percentage(&padding_styles.padding_right.0), + top: convert::length_percentage(&padding_styles.padding_top.0), + bottom: convert::length_percentage(&padding_styles.padding_bottom.0), } } @@ -117,40 +121,40 @@ impl taffy::CoreStyle for TaffyStyloStyleRef<'_> { impl taffy::FlexboxContainerStyle for TaffyStyloStyleRef<'_> { #[inline] fn flex_direction(&self) -> taffy::FlexDirection { - t2s::flex_direction(self.0.get_position().flex_direction) + convert::flex_direction(self.0.get_position().flex_direction) } #[inline] fn flex_wrap(&self) -> taffy::FlexWrap { - t2s::flex_wrap(self.0.get_position().flex_wrap) + convert::flex_wrap(self.0.get_position().flex_wrap) } #[inline] fn gap(&self) -> taffy::Size { let position_styles = self.0.get_position(); - taffy::Size { width: t2s::gap(&position_styles.column_gap), height: t2s::gap(&position_styles.row_gap) } + taffy::Size { width: convert::gap(&position_styles.column_gap), height: convert::gap(&position_styles.row_gap) } } #[inline] fn align_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().align_content.0) + convert::content_alignment(self.0.get_position().align_content.0) } #[inline] fn align_items(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_items.0) + convert::item_alignment(self.0.get_position().align_items.0) } #[inline] fn justify_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().justify_content.0) + convert::content_alignment(self.0.get_position().justify_content.0) } } impl taffy::FlexboxItemStyle for TaffyStyloStyleRef<'_> { #[inline] fn flex_basis(&self) -> taffy::Dimension { - t2s::flex_basis(&self.0.get_position().flex_basis) + convert::flex_basis(&self.0.get_position().flex_basis) } #[inline] @@ -165,7 +169,7 @@ impl taffy::FlexboxItemStyle for TaffyStyloStyleRef<'_> { #[inline] fn align_self(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_self.0 .0) + convert::item_alignment(self.0.get_position().align_self.0 .0) } } @@ -175,53 +179,53 @@ impl taffy::GridContainerStyle for TaffyStyloStyleRef<'_> { #[inline] fn grid_template_rows(&self) -> Self::TemplateTrackList<'_> { - t2s::grid_template_tracks(&self.0.get_position().grid_template_rows) + convert::grid_template_tracks(&self.0.get_position().grid_template_rows) } #[inline] fn grid_template_columns(&self) -> Self::TemplateTrackList<'_> { - t2s::grid_template_tracks(&self.0.get_position().grid_template_columns) + convert::grid_template_tracks(&self.0.get_position().grid_template_columns) } #[inline] fn grid_auto_rows(&self) -> Self::AutoTrackList<'_> { - t2s::grid_auto_tracks(&self.0.get_position().grid_auto_rows) + convert::grid_auto_tracks(&self.0.get_position().grid_auto_rows) } #[inline] fn grid_auto_columns(&self) -> Self::AutoTrackList<'_> { - t2s::grid_auto_tracks(&self.0.get_position().grid_auto_columns) + convert::grid_auto_tracks(&self.0.get_position().grid_auto_columns) } #[inline] fn grid_auto_flow(&self) -> taffy::GridAutoFlow { - t2s::grid_auto_flow(self.0.get_position().grid_auto_flow) + convert::grid_auto_flow(self.0.get_position().grid_auto_flow) } #[inline] fn gap(&self) -> taffy::Size { let position_styles = self.0.get_position(); - taffy::Size { width: t2s::gap(&position_styles.column_gap), height: t2s::gap(&position_styles.row_gap) } + taffy::Size { width: convert::gap(&position_styles.column_gap), height: convert::gap(&position_styles.row_gap) } } #[inline] fn align_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().align_content.0) + convert::content_alignment(self.0.get_position().align_content.0) } #[inline] fn justify_content(&self) -> Option { - t2s::content_alignment(self.0.get_position().justify_content.0) + convert::content_alignment(self.0.get_position().justify_content.0) } #[inline] fn align_items(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_items.0) + convert::item_alignment(self.0.get_position().align_items.0) } #[inline] fn justify_items(&self) -> Option { - t2s::item_alignment(self.0.get_position().justify_items.computed.0) + convert::item_alignment(self.0.get_position().justify_items.computed.0) } } @@ -230,8 +234,8 @@ impl taffy::GridItemStyle for TaffyStyloStyleRef<'_> { fn grid_row(&self) -> taffy::Line { let position_styles = self.0.get_position(); taffy::Line { - start: t2s::grid_line(&position_styles.grid_row_start), - end: t2s::grid_line(&position_styles.grid_row_end), + start: convert::grid_line(&position_styles.grid_row_start), + end: convert::grid_line(&position_styles.grid_row_end), } } @@ -239,18 +243,18 @@ impl taffy::GridItemStyle for TaffyStyloStyleRef<'_> { fn grid_column(&self) -> taffy::Line { let position_styles = self.0.get_position(); taffy::Line { - start: t2s::grid_line(&position_styles.grid_column_start), - end: t2s::grid_line(&position_styles.grid_column_end), + start: convert::grid_line(&position_styles.grid_column_start), + end: convert::grid_line(&position_styles.grid_column_end), } } #[inline] fn align_self(&self) -> Option { - t2s::item_alignment(self.0.get_position().align_self.0 .0) + convert::item_alignment(self.0.get_position().align_self.0 .0) } #[inline] fn justify_self(&self) -> Option { - t2s::item_alignment(self.0.get_position().justify_self.0 .0) + convert::item_alignment(self.0.get_position().justify_self.0 .0) } } diff --git a/taffy_stylo/src/t2s.rs b/taffy_stylo/src/convert.rs similarity index 81% rename from taffy_stylo/src/t2s.rs rename to taffy_stylo/src/convert.rs index 754d4cfb9..66a7c6a03 100644 --- a/taffy_stylo/src/t2s.rs +++ b/taffy_stylo/src/convert.rs @@ -1,4 +1,40 @@ -use super::stylo; +// Module of type aliases so we can refer to stylo types with nicer names +mod stylo { + pub(crate) use style::computed_values::flex_direction::T as FlexDirection; + pub(crate) use style::computed_values::flex_wrap::T as FlexWrap; + pub(crate) use style::computed_values::grid_auto_flow::T as GridAutoFlow; + pub(crate) use style::properties::generated::longhands::box_sizing::computed_value::T as BoxSizing; + pub(crate) use style::properties::longhands::aspect_ratio::computed_value::T as AspectRatio; + pub(crate) use style::properties::longhands::position::computed_value::T as Position; + pub(crate) use style::values::specified::align::AlignFlags; + pub(crate) use style::values::specified::align::ContentDistribution; + // pub(crate) use style::properties::style_structs::{Margin, Padding}; + pub(crate) use style::values::computed::GridLine; + pub(crate) use style::values::computed::GridTemplateComponent; + pub(crate) use style::values::computed::ImplicitGridTracks; + pub(crate) use style::values::computed::LengthPercentage; + pub(crate) use style::values::generics::flex::GenericFlexBasis; + pub(crate) use style::values::generics::grid::RepeatCount; + pub(crate) use style::values::generics::grid::TrackBreadth; + pub(crate) use style::values::generics::grid::TrackListValue; + pub(crate) use style::values::generics::grid::TrackSize; + pub(crate) use style::values::generics::length::GenericLengthPercentageOrAuto; + pub(crate) use style::values::generics::length::GenericLengthPercentageOrNormal; + pub(crate) use style::values::generics::length::GenericMaxSize; + pub(crate) use style::values::generics::length::GenericSize; + pub(crate) use style::values::generics::position::PreferredRatio; + pub(crate) use style::values::generics::NonNegative; + pub(crate) use style::values::specified::box_::Display; + pub(crate) use style::values::specified::box_::DisplayInside; + pub(crate) use style::values::specified::box_::DisplayOutside; + pub(crate) use style::values::specified::box_::Overflow; + pub(crate) use style::values::specified::GenericGridTemplateComponent; + pub(crate) type LengthPercentageAuto = GenericLengthPercentageOrAuto; + pub(crate) type Size = GenericSize>; + pub(crate) type MaxSize = GenericMaxSize>; + pub(crate) type FlexBasis = GenericFlexBasis; + pub(crate) type Gap = GenericLengthPercentageOrNormal>; +} #[inline] pub(crate) fn length_percentage(val: &stylo::LengthPercentage) -> taffy::LengthPercentage { diff --git a/taffy_stylo/src/lib.rs b/taffy_stylo/src/lib.rs index 1a8330548..c85bb7472 100644 --- a/taffy_stylo/src/lib.rs +++ b/taffy_stylo/src/lib.rs @@ -2,46 +2,7 @@ pub(crate) mod arc; pub(crate) mod borrowed; -pub(crate) mod t2s; - -// Module of type aliases so we can refer to stylo types with nicer names -mod stylo { - pub(crate) use style::computed_values::flex_direction::T as FlexDirection; - pub(crate) use style::computed_values::flex_wrap::T as FlexWrap; - pub(crate) use style::computed_values::grid_auto_flow::T as GridAutoFlow; - pub(crate) use style::properties::generated::longhands::box_sizing::computed_value::T as BoxSizing; - pub(crate) use style::properties::longhands::aspect_ratio::computed_value::T as AspectRatio; - pub(crate) use style::properties::longhands::position::computed_value::T as Position; - pub(crate) use style::values::specified::align::AlignFlags; - pub(crate) use style::values::specified::align::ContentDistribution; - // pub(crate) use style::properties::style_structs::{Margin, Padding}; - pub(crate) use style::values::computed::GridLine; - pub(crate) use style::values::computed::GridTemplateComponent; - pub(crate) use style::values::computed::ImplicitGridTracks; - pub(crate) use style::values::computed::LengthPercentage; - pub(crate) use style::values::generics::flex::GenericFlexBasis; - pub(crate) use style::values::generics::grid::RepeatCount; - pub(crate) use style::values::generics::grid::TrackBreadth; - pub(crate) use style::values::generics::grid::TrackListValue; - pub(crate) use style::values::generics::grid::TrackSize; - pub(crate) use style::values::generics::length::GenericLengthPercentageOrAuto; - pub(crate) use style::values::generics::length::GenericLengthPercentageOrNormal; - pub(crate) use style::values::generics::length::GenericMaxSize; - pub(crate) use style::values::generics::length::GenericSize; - pub(crate) use style::values::generics::position::PreferredRatio; - pub(crate) use style::values::generics::NonNegative; - pub(crate) use style::values::specified::box_::Display; - pub(crate) use style::values::specified::box_::DisplayInside; - pub(crate) use style::values::specified::box_::DisplayOutside; - pub(crate) use style::values::specified::box_::Overflow; - pub(crate) use style::values::specified::GenericGridTemplateComponent; - pub(crate) type LengthPercentageAuto = GenericLengthPercentageOrAuto; - pub(crate) type Size = GenericSize>; - pub(crate) type MaxSize = GenericMaxSize>; - pub(crate) type FlexBasis = GenericFlexBasis; - pub(crate) type Gap = GenericLengthPercentageOrNormal>; - pub(crate) use style::properties::generated::ComputedValues; -} +pub(crate) mod convert; pub use arc::TaffyStyloStyle; pub use borrowed::TaffyStyloStyleRef;