1 //! Style types for Block layout 2 use crate::{CoreStyle, Style}; 3 4 /// The set of styles required for a Block layout container 5 pub trait BlockContainerStyle: CoreStyle { 6 /// Defines which row in the grid the item should start and end at 7 #[inline(always)] text_align(&self) -> TextAlign8 fn text_align(&self) -> TextAlign { 9 Style::DEFAULT.text_align 10 } 11 } 12 13 /// The set of styles required for a Block layout item (child of a Block container) 14 pub trait BlockItemStyle: CoreStyle { 15 /// Whether the item is a table. Table children are handled specially in block layout. 16 #[inline(always)] is_table(&self) -> bool17 fn is_table(&self) -> bool { 18 false 19 } 20 } 21 22 /// Used by block layout to implement the legacy behaviour of `<center>` and `<div align="left | right | center">` 23 #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] 24 #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] 25 pub enum TextAlign { 26 /// No special legacy text align behaviour. 27 #[default] 28 Auto, 29 /// Corresponds to `-webkit-left` or `-moz-left` in browsers 30 LegacyLeft, 31 /// Corresponds to `-webkit-right` or `-moz-right` in browsers 32 LegacyRight, 33 /// Corresponds to `-webkit-center` or `-moz-center` in browsers 34 LegacyCenter, 35 } 36