pub struct BoxModel {
pub margin: Edges,
pub border: Edges,
pub padding: Edges,
}Expand description
Resolved box model dimensions for a layout box.
Fields§
§margin: Edges§border: Edges§padding: EdgesImplementations§
Source§impl BoxModel
impl BoxModel
Sourcepub fn resolve_border(style: &ComputedStyle) -> Edges
pub fn resolve_border(style: &ComputedStyle) -> Edges
Compute the border edges from a computed style.
Sourcepub fn resolve_padding(
style: &ComputedStyle,
containing_block_width: f32,
) -> Edges
pub fn resolve_padding( style: &ComputedStyle, containing_block_width: f32, ) -> Edges
Compute padding edges, resolving percentages against containing block width.
Sourcepub fn resolve_margin(
style: &ComputedStyle,
containing_block_width: f32,
) -> Edges
pub fn resolve_margin( style: &ComputedStyle, containing_block_width: f32, ) -> Edges
Compute margin edges, resolving percentages against containing block width. Auto margins return 0.0 here — auto margin resolution happens during layout.
Sourcepub fn resolve(style: &ComputedStyle, containing_block_width: f32) -> Self
pub fn resolve(style: &ComputedStyle, containing_block_width: f32) -> Self
Resolve all box model dimensions.
Sourcepub fn horizontal_total(&self) -> f32
pub fn horizontal_total(&self) -> f32
Total horizontal space consumed by margin + border + padding.
Sourcepub fn vertical_total(&self) -> f32
pub fn vertical_total(&self) -> f32
Total vertical space consumed by margin + border + padding.
Sourcepub fn horizontal_border_padding(&self) -> f32
pub fn horizontal_border_padding(&self) -> f32
Horizontal space consumed by border + padding (no margin).
Sourcepub fn vertical_border_padding(&self) -> f32
pub fn vertical_border_padding(&self) -> f32
Vertical space consumed by border + padding (no margin).
Trait Implementations§
impl Copy for BoxModel
impl StructuralPartialEq for BoxModel
Auto Trait Implementations§
impl Freeze for BoxModel
impl RefUnwindSafe for BoxModel
impl Send for BoxModel
impl Sync for BoxModel
impl Unpin for BoxModel
impl UnwindSafe for BoxModel
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