pub struct UnifiedConstraints {Show 36 fields
pub shape_boundaries: Vec<ShapeBoundary>,
pub shape_exclusions: Vec<ShapeBoundary>,
pub available_width: AvailableSpace,
pub available_height: Option<f32>,
pub writing_mode: Option<WritingMode>,
pub direction: Option<BidiDirection>,
pub text_orientation: TextOrientation,
pub text_align: TextAlign,
pub text_justify: JustifyContent,
pub line_height: LineHeight,
pub vertical_align: VerticalAlign,
pub strut_ascent: f32,
pub strut_descent: f32,
pub strut_x_height: f32,
pub ch_width: f32,
pub overflow: OverflowBehavior,
pub segment_alignment: SegmentAlignment,
pub text_combine_upright: Option<TextCombineUpright>,
pub exclusion_margin: f32,
pub hyphenation: Hyphens,
pub hyphenation_language: Option<Language>,
pub text_indent: f32,
pub text_indent_each_line: bool,
pub text_indent_hanging: bool,
pub initial_letter: Option<InitialLetter>,
pub line_clamp: Option<NonZeroUsize>,
pub text_wrap: TextWrap,
pub columns: u32,
pub column_gap: f32,
pub hanging_punctuation: bool,
pub overflow_wrap: OverflowWrap,
pub text_align_last: TextAlign,
pub word_break: WordBreak,
pub white_space_mode: WhiteSpaceMode,
pub line_break: LineBreakStrictness,
pub unicode_bidi: UnicodeBidi,
}Expand description
Unified constraints combining all layout features
§CSS Inline Layout Module Level 3: Constraint Mapping
This structure maps CSS properties to layout constraints:
§\u00a7 2.1 Layout of Line Boxes
available_width: \u26a0\ufe0f CRITICAL - Should equal containing block’s inner width- Currently defaults to 0.0 which causes immediate line breaking
- Per spec: “logical width of a line box is equal to the inner logical width of its containing block”
available_height: For block-axis constraints (max-height)
§\u00a7 2.2 Layout Within Line Boxes
text_align: \u2705 Horizontal alignment (start, end, center, justify)vertical_align: \u26a0\ufe0f PARTIAL - Only baseline supported, missing:- top, bottom, middle, text-top, text-bottom
, values - sub, super positions
line_height: \u2705 Distance between baselines
§\u00a7 3 Baselines and Alignment Metrics
text_orientation: \u2705 For vertical writing (sideways, upright)writing_mode: \u2705 horizontal-tb, vertical-rl, vertical-lrdirection: \u2705 ltr, rtl for BiDi
§\u00a7 4 Baseline Alignment (vertical-align property)
\u26a0\ufe0f INCOMPLETE: Only basic baseline alignment implemented
§\u00a7 5 Line Spacing (line-height property)
line_height: \u2705 Implemented- \u274c MISSING: line-fit-edge for controlling which edges contribute to line height +spec:box-model:51342f - inline box margins/borders/padding do not affect line box height (default leading mode) +spec:font-metrics:618776 - line-fit-edge (cap, ex, ideographic, alphabetic edge selection) not yet implemented
§\u00a7 6 Trimming Leading (text-box-trim)
- \u274c NOT IMPLEMENTED: text-box-trim property
- \u274c NOT IMPLEMENTED: text-box-edge property +spec:box-model:c09331 - text-box-trim trims block container first/last line to font metrics // +spec:overflow:dc2196 - text-box-trim overflow handled as normal overflow (no special handling needed)
§CSS Text Module Level 3
text_indent: \u2705 First line indentationtext_justify: \u2705 Justification algorithm (auto, inter-word, inter-character)hyphenation: \u2705 Hyphens property (none / manual / auto)hanging_punctuation: \u2705 Hanging punctuation at line edges
§CSS Text Level 4
text_wrap: \u2705 balance, pretty, stableline_clamp: \u2705 Max number of lines
§CSS Writing Modes Level 4
text_combine_upright: \u2705 Tate-chu-yoko for vertical text
§CSS Shapes Module
shape_boundaries: \u2705 Custom line box shapesshape_exclusions: \u2705 Exclusion areas (float-like behavior)exclusion_margin: \u2705 Margin around exclusions
§Multi-column Layout
columns: \u2705 Number of columnscolumn_gap: \u2705 Gap between columns
§Known Issues:
- [ISSUE] available_width defaults to Definite(0.0) instead of containing block width
- [ISSUE] vertical_align only supports baseline
- [TODO] initial-letter (drop caps) not implemented +spec:positioning:fb233a - initial letter block-axis: if size < sink, use over alignment
Fields§
§shape_boundaries: Vec<ShapeBoundary>§shape_exclusions: Vec<ShapeBoundary>§available_width: AvailableSpace§available_height: Option<f32>§writing_mode: Option<WritingMode>§direction: Option<BidiDirection>§text_orientation: TextOrientation§text_align: TextAlign§text_justify: JustifyContent§line_height: LineHeight§vertical_align: VerticalAlign§strut_ascent: f32§strut_descent: f32§strut_x_height: f32§ch_width: f32§overflow: OverflowBehavior§segment_alignment: SegmentAlignment§text_combine_upright: Option<TextCombineUpright>§exclusion_margin: f32§hyphenation: Hyphens§hyphenation_language: Option<Language>§text_indent: f32§text_indent_each_line: bool§text_indent_hanging: bool§initial_letter: Option<InitialLetter>§line_clamp: Option<NonZeroUsize>§text_wrap: TextWrap§columns: u32§column_gap: f32§hanging_punctuation: bool§overflow_wrap: OverflowWrap§text_align_last: TextAlign§word_break: WordBreak§white_space_mode: WhiteSpaceMode§line_break: LineBreakStrictness§unicode_bidi: UnicodeBidiImplementations§
Source§impl UnifiedConstraints
impl UnifiedConstraints
Sourcepub fn resolved_line_height(&self) -> f32
pub fn resolved_line_height(&self) -> f32
Resolve line_height to a pixel value using the strut metrics as a font-size proxy.
strut_ascent + strut_descent approximates font_size (the block container’s font).
Trait Implementations§
Source§impl Clone for UnifiedConstraints
impl Clone for UnifiedConstraints
Source§fn clone(&self) -> UnifiedConstraints
fn clone(&self) -> UnifiedConstraints
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UnifiedConstraints
impl Debug for UnifiedConstraints
Source§impl Default for UnifiedConstraints
impl Default for UnifiedConstraints
Source§impl Hash for UnifiedConstraints
impl Hash for UnifiedConstraints
Source§impl PartialEq for UnifiedConstraints
impl PartialEq for UnifiedConstraints
impl Eq for UnifiedConstraints
Auto Trait Implementations§
impl Freeze for UnifiedConstraints
impl RefUnwindSafe for UnifiedConstraints
impl Send for UnifiedConstraints
impl Sync for UnifiedConstraints
impl Unpin for UnifiedConstraints
impl UnsafeUnpin for UnifiedConstraints
impl UnwindSafe for UnifiedConstraints
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more