Skip to main content

ComputedStyle

Struct ComputedStyle 

Source
pub struct ComputedStyle {
Show 103 fields pub display: Display, pub position: Position, pub float: Float, pub clear: Clear, pub box_sizing: BoxSizing, pub content_visibility: ContentVisibility, pub contain: Containment, pub contain_intrinsic_width: Option<Dimension>, pub contain_intrinsic_height: Option<Dimension>, pub width: Dimension, pub height: Dimension, pub min_width: Dimension, pub max_width: Dimension, pub min_height: Dimension, pub max_height: Dimension, pub margin: EdgeInsets, pub margin_auto_top: bool, pub margin_auto_right: bool, pub margin_auto_bottom: bool, pub margin_auto_left: bool, pub padding: EdgeInsets, pub insets: EdgeInsets<Dimension>, pub z_index: Option<i32>, pub flex_direction: FlexDirection, pub flex_wrap: FlexWrap, pub justify_content: JustifyContent, pub align_items: AlignItems, pub align_self: AlignSelf, pub flex_grow: f32, pub flex_shrink: f32, pub flex_basis: Dimension, pub gap: f32, pub gap_row: f32, pub gap_col: f32, pub grid_template_columns: Vec<GridTrack>, pub grid_template_rows: Vec<GridTrack>, pub grid_template_areas: Vec<Vec<String>>, pub grid_auto_flow: GridAutoFlow, pub grid_area: Option<String>, pub grid_column_start: Option<i32>, pub grid_column_end: Option<i32>, pub grid_column_span: Option<u32>, pub grid_row_start: Option<i32>, pub grid_row_end: Option<i32>, pub grid_row_span: Option<u32>, pub table_layout: TableLayout, pub border_collapse: BorderCollapse, pub border_spacing: (f32, f32), pub caption_side: CaptionSide, pub colspan: u32, pub rowspan: u32, pub background_color: Option<Rgba>, pub background_gradient: Option<Gradient>, pub border_color: Option<Rgba>, pub border_width: EdgeInsets, pub border_radius: BorderRadius, pub opacity: f32, pub box_shadow: Vec<BoxShadow>, pub overflow_x: Overflow, pub overflow_y: Overflow, pub color: Rgba, pub font_family: AtomId, pub font_size: f32, pub root_font_size: f32, pub font_weight: FontWeight, pub font_style: FontStyle, pub text_align: TextAlign, pub line_height: f32, pub letter_spacing: f32, pub text_decoration: TextDecoration, pub text_transform: TextTransform, pub text_overflow: TextOverflow, pub white_space: WhiteSpace, pub vertical_align: VerticalAlign, pub cursor: Cursor, pub user_select: UserSelect, pub pointer_events: PointerEvents, pub visibility: Visibility, pub caret_color: Option<Rgba>, pub border_style: BorderStyle, pub outline_width: f32, pub outline_style: BorderStyle, pub outline_color: Option<Rgba>, pub outline_offset: f32, pub aspect_ratio: Option<f32>, pub backdrop_filter: Option<BackdropFilter>, pub filter: Option<BackdropFilter>, pub clip_path: Option<ClipPath>, pub mix_blend_mode: BlendMode, pub isolation: Isolation, pub transitions: Vec<TransitionSpec>, pub animations: Vec<AnimationSpec>, pub transform: Vec<TransformOp>, pub transform_origin: TransformOrigin, pub transform_style: TransformStyle, pub perspective: Option<f32>, pub perspective_origin: (Dimension, Dimension), pub backface_visibility: BackfaceVisibility, pub custom_properties: Option<Arc<Vec<(AtomId, AtomId)>>>, pub starting_style: Option<Box<ComputedStyle>>, pub view_transition_name: Option<String>, pub animation_timeline: AnimationTimeline, pub animation_range: AnimationRange,
}
Expand description

Fully computed and resolved styles for an element node.

Fields§

§display: Display§position: Position§float: Float§clear: Clear§box_sizing: BoxSizing§content_visibility: ContentVisibility§contain: Containment§contain_intrinsic_width: Option<Dimension>§contain_intrinsic_height: Option<Dimension>§width: Dimension§height: Dimension§min_width: Dimension§max_width: Dimension§min_height: Dimension§max_height: Dimension§margin: EdgeInsets§margin_auto_top: bool§margin_auto_right: bool§margin_auto_bottom: bool§margin_auto_left: bool§padding: EdgeInsets§insets: EdgeInsets<Dimension>§z_index: Option<i32>§flex_direction: FlexDirection§flex_wrap: FlexWrap§justify_content: JustifyContent§align_items: AlignItems§align_self: AlignSelf§flex_grow: f32§flex_shrink: f32§flex_basis: Dimension§gap: f32§gap_row: f32§gap_col: f32§grid_template_columns: Vec<GridTrack>§grid_template_rows: Vec<GridTrack>§grid_template_areas: Vec<Vec<String>>§grid_auto_flow: GridAutoFlow§grid_area: Option<String>§grid_column_start: Option<i32>§grid_column_end: Option<i32>§grid_column_span: Option<u32>§grid_row_start: Option<i32>§grid_row_end: Option<i32>§grid_row_span: Option<u32>§table_layout: TableLayout§border_collapse: BorderCollapse§border_spacing: (f32, f32)§caption_side: CaptionSide§colspan: u32§rowspan: u32§background_color: Option<Rgba>§background_gradient: Option<Gradient>§border_color: Option<Rgba>§border_width: EdgeInsets§border_radius: BorderRadius§opacity: f32§box_shadow: Vec<BoxShadow>§overflow_x: Overflow§overflow_y: Overflow§color: Rgba§font_family: AtomId§font_size: f32§root_font_size: f32§font_weight: FontWeight§font_style: FontStyle§text_align: TextAlign§line_height: f32§letter_spacing: f32§text_decoration: TextDecoration§text_transform: TextTransform§text_overflow: TextOverflow§white_space: WhiteSpace§vertical_align: VerticalAlign§cursor: Cursor§user_select: UserSelect§pointer_events: PointerEvents§visibility: Visibility§caret_color: Option<Rgba>§border_style: BorderStyle§outline_width: f32§outline_style: BorderStyle§outline_color: Option<Rgba>§outline_offset: f32§aspect_ratio: Option<f32>§backdrop_filter: Option<BackdropFilter>§filter: Option<BackdropFilter>§clip_path: Option<ClipPath>§mix_blend_mode: BlendMode§isolation: Isolation§transitions: Vec<TransitionSpec>§animations: Vec<AnimationSpec>§transform: Vec<TransformOp>§transform_origin: TransformOrigin§transform_style: TransformStyle§perspective: Option<f32>§perspective_origin: (Dimension, Dimension)§backface_visibility: BackfaceVisibility§custom_properties: Option<Arc<Vec<(AtomId, AtomId)>>>§starting_style: Option<Box<ComputedStyle>>§view_transition_name: Option<String>§animation_timeline: AnimationTimeline§animation_range: AnimationRange

Implementations§

Source§

impl ComputedStyle

Source

pub fn has_animations(&self) -> bool

Returns true if this style defines any animations.

Source

pub fn has_transform(&self) -> bool

Returns true if this style defines any 2D or 3D transform operations.

Source

pub fn has_visual_effects(&self) -> bool

Returns true if this style defines any visual filters, backdrop filters, clip-paths, or blend modes.

Source

pub fn compute_transform_matrix(&self, width: f32, height: f32) -> Matrix4x4

Computes the composite 4x4 matrix for this element’s transform given layout width and height.

Source

pub fn establishes_fixed_containing_block(&self) -> bool

Evaluates if this element establishes a containing block for position: fixed (and position: absolute) descendants per CSS Transforms Level 1 §2 and Filter Effects Level 1 §5.

Source

pub fn establishes_stacking_context_in( &self, parent_display: Option<Display>, is_root: bool, ) -> bool

Evaluates if this element establishes an isolated stacking context per W3C CSS 2.1 Appendix E, CSS Flexbox §4.3, CSS Grid §5.4, CSS Positioned Layout Level 3 §3.1, and CSS Compositing Level 1.

Note: Per CSS 2.1 Appendix E / CSS Overflow Level 3, overflow != Visible clips scrollable content without establishing an atomic stacking context.

Source

pub fn establishes_stacking_context(&self) -> bool

Evaluates if this element establishes an isolated stacking context without parent display context.

Source

pub fn inherit_from(parent: &ComputedStyle) -> ComputedStyle

Constructs an unstyled node inheriting inheritable properties from parent with zero heap allocations.

Source

pub fn get_custom_property(&self, key: AtomId) -> Option<AtomId>

Looks up a CSS custom property by AtomId.

Source

pub fn set_custom_property(&mut self, key: AtomId, value: AtomId)

Sets or overrides a CSS custom property using Copy-On-Write semantics.

Trait Implementations§

Source§

impl Clone for ComputedStyle

Source§

fn clone(&self) -> ComputedStyle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ComputedStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ComputedStyle

Source§

fn default() -> ComputedStyle

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ComputedStyle

Source§

fn eq(&self, other: &ComputedStyle) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ComputedStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoInitialState<T> for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,