pub struct ComputedStyle {Show 56 fields
pub font_id: u16,
pub font_family: Vec<Family>,
pub font_size: f32,
pub font_style: FontStyle,
pub font_weight: u16,
pub color: Color,
pub line_height: f32,
pub letter_spacing: f32,
pub font_variant_caps: FontVariantCaps,
pub font_feature_settings: Vec<FeatureSetting>,
pub font_variant_ligatures: FontVariantLigatures,
pub font_variant_numeric: FontVariantNumeric,
pub font_variant_alternates: FontVariantAlternates,
pub text_transform: TextTransform,
pub text_decoration_line: DecorationLine,
pub text_decoration_color: Option<Color>,
pub text_decoration_style: DecorationStyle,
pub text_decoration_thickness: Option<f32>,
pub text_align: TextAlign,
pub text_justify: TextJustify,
pub hanging_punctuation: HangingPunctuation,
pub text_indent: f32,
pub hyphens: Hyphens,
pub orphans: u16,
pub widows: u16,
pub page: Option<String>,
pub content: Content,
pub string_set: Vec<StringSet>,
pub counter_reset: Option<u32>,
pub note_reset: Option<u32>,
pub initial_letter: u16,
pub position: Position,
pub inset: Edges<Inset>,
pub z_index: i32,
pub opacity: f32,
pub wrap_flow: WrapFlow,
pub shape_outside: ShapeOutside,
pub shape_margin: f32,
pub margin: Edges,
pub padding: Edges,
pub border: Edges<Border>,
pub border_radius: BorderRadius,
pub background: Background,
pub box_decoration_break: BoxDecorationBreak,
pub width: Width,
pub height: Width,
pub min_height: Width,
pub max_width: Width,
pub max_height: Width,
pub border_collapse: BorderCollapse,
pub list_style_type: ListStyleType,
pub break_before: Break,
pub break_after: Break,
pub break_inside: Break,
pub column_span: ColumnSpan,
pub custom: BTreeMap<String, String>,
}Expand description
One node’s resolved style: what every downstream pass reads.
Fields§
§font_id: u16The face this style shapes with, resolved against the registry. Family, slope and weight chose it; layout only needs the answer.
font_family: Vec<Family>The families asked for, in order, kept for diagnostics and for the snapshot the style tree is reviewed through.
font_size: f32Font size in points.
font_style: FontStyleUpright or italic.
font_weight: u16Weight on the CSS 1–1000 scale.
color: ColorWhat text and rules are painted in.
line_height: f32Line height as a unitless multiple of the font size.
letter_spacing: f32Extra advance after every glyph, in points, from
letter-spacing.
font_variant_caps: FontVariantCapsWhich capitals the run is drawn with.
font_feature_settings: Vec<FeatureSetting>The features the sheet asked the face for, from
font-feature-settings. They are asked for after the ones the
font-variant longhands name, so a tag in both is set here.
font_variant_ligatures: FontVariantLigaturesWhich ligatures the run is set with.
font_variant_numeric: FontVariantNumericWhich figures the run is set with.
font_variant_alternates: FontVariantAlternatesWhich alternate glyphs the run is set with.
text_transform: TextTransformWhat the run’s letters are transformed to before shaping.
text_decoration_line: DecorationLineWhich rules are drawn across the run, from
text-decoration-line.
text_decoration_color: Option<Color>What those rules are painted in, from
text-decoration-color. None is the colour of the text.
text_decoration_style: DecorationStyleHow each rule is drawn, from text-decoration-style.
text_decoration_thickness: Option<f32>How thick each rule is, in points, from
text-decoration-thickness. None is the thickness the face
declares.
text_align: TextAlignHow lines fill the measure.
text_justify: TextJustifyWhat justification opens up to fill it.
hanging_punctuation: HangingPunctuationWhich marks may hang past the measure.
text_indent: f32First-line indent in points.
hyphens: HyphensWhether words may break at syllable boundaries.
orphans: u16Lines that must be left at the bottom of a fragment.
widows: u16Lines that must be moved to the top of the next one.
page: Option<String>The named page this element’s pages take, from page.
content: ContentWhat the element paints in place of children it has none of: the ornament a thematic break is set with.
string_set: Vec<StringSet>The named strings this element sets when the flow reaches it,
from string-set. This is where a running head’s text comes
from.
counter_reset: Option<u32>The folio the page this element opens takes, from
counter-reset: page.
note_reset: Option<u32>The number the first note under this element takes, from
counter-reset: note. On the footnote area it restarts the
numbering on every page.
initial_letter: u16Lines an initial letter is sunk over, from initial-letter.
Fewer than two is no drop cap.
position: PositionWhether the element sits in the flow or against the page.
inset: Edges<Inset>What the insets say, for an element that is against the page.
z_index: i32Which layer the block paints in, from z-index. Higher paints
later, and auto is layer 0.
opacity: f32How much of what the block paints shows, from opacity: 1 is
all of it and 0 is none. The blocks inside it show that much
of their own.
wrap_flow: WrapFlowWhich side of this element the prose sets on, from wrap-flow.
shape_outside: ShapeOutsideThe contour the prose sets around, from shape-outside.
shape_margin: f32How far the prose keeps off that contour, in points, from
shape-margin.
margin: EdgesMargins in points.
padding: EdgesPadding in points, between the border and the content.
border: Edges<Border>The four border edges.
border_radius: BorderRadiusHow far each corner of the border box is rounded, from
border-radius. The background and the border follow the
corners.
background: BackgroundWhat is painted behind the block: a tint, and an image over it.
box_decoration_break: BoxDecorationBreakWhat the decoration does where a page break splits the block.
width: WidthThe width the box is asked to take, from width. A table reads
it off the cells of its first row to size its columns.
height: WidthThe height the content box is asked to take, from height.
min_height: WidthThe least height the content box takes, from min-height.
max_width: WidthThe most width an image takes, from max-width. Auto is
none.
max_height: WidthThe most height an image takes, from max-height. Auto is
none.
border_collapse: BorderCollapseWhether a table’s cells share their borders, from
border-collapse.
list_style_type: ListStyleTypeThe marker a list item is set with, from list-style-type.
break_before: BreakWhere a page break falls before this element.
break_after: BreakWhere one falls after it.
break_inside: BreakWhether this element may be split across pages.
column_span: ColumnSpanWhether this element is set across every column of a divided
page, from column-span.
custom: BTreeMap<String, String>The custom properties in force, by name, each with every
var() in its value already replaced. A child inherits them.
Implementations§
Source§impl ComputedStyle
impl ComputedStyle
Sourcepub fn initial() -> ComputedStyle
pub fn initial() -> ComputedStyle
The initial value of every property: what the root computes to before any rule matches it.
Sourcepub fn inherit(&self) -> ComputedStyle
pub fn inherit(&self) -> ComputedStyle
A child’s starting point: inherited properties as they stand, the rest back at their initial values.
Sourcepub fn apply(
&mut self,
declaration: &Declaration,
parent_size: f32,
root_size: f32,
)
pub fn apply( &mut self, declaration: &Declaration, parent_size: f32, root_size: f32, )
Applies one declaration. parent_size is what em and
percentages in font-size measure against; root_size is
what rem does.
Sourcepub fn first_line_over(&self, element: &ComputedStyle) -> FirstLine
pub fn first_line_over(&self, element: &ComputedStyle) -> FirstLine
What this style, computed for ::first-line, changes about
the element it was computed beside.
Sourcepub fn border_box(&self, x: f32, measure: f32) -> (f32, f32)
pub fn border_box(&self, x: f32, measure: f32) -> (f32, f32)
This block’s border box inside measure, laid out at x from
the enclosing content box’s leading edge: (leading edge, width), with only the margins taken off.
Sourcepub fn excludes(&self) -> bool
pub fn excludes(&self) -> bool
Whether prose is set around this element rather than over it: the sheet has taken it out of the flow, and it excludes a side.
This is the one place a contour is read, so it is also what decides whether one is traced. An element still in the flow takes a band of its own and nothing sets beside it, so a contour on it would answer a question nobody asks.
Sourcepub fn content_box(&self, x: f32, measure: f32) -> (f32, f32)
pub fn content_box(&self, x: f32, measure: f32) -> (f32, f32)
This block’s content box inside measure: (leading edge, the measure its lines break to). Margin, border and padding come
off both edges, and the leading edge moves in by what they
take on the left.
Sourcepub fn inline_box(&self) -> Option<InlineBox>
pub fn inline_box(&self) -> Option<InlineBox>
The box this style paints around the runs of an inline
element, and None where it paints none and takes no width.
Padding counts even where nothing is painted over it: it is width, and the line breaks against it.
Sourcepub fn paragraph(&self) -> ParagraphStyle
pub fn paragraph(&self) -> ParagraphStyle
Everything line layout needs from a style.
Sourcepub fn features(&self) -> Vec<FeatureSetting>
pub fn features(&self) -> Vec<FeatureSetting>
Every feature this style asks the face for, in the order the
shaper reads them: what the font-variant longhands name,
then what font-feature-settings spells out. A tag in both
takes the value written last, which is the one the sheet
spelled.
Sourcepub fn decoration(&self) -> TextDecoration
pub fn decoration(&self) -> TextDecoration
What is drawn across this style’s runs, the four longhands gathered into one value.
Trait Implementations§
Source§impl Clone for ComputedStyle
impl Clone for ComputedStyle
Source§fn clone(&self) -> ComputedStyle
fn clone(&self) -> ComputedStyle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComputedStyle
impl Debug for ComputedStyle
Source§impl PartialEq for ComputedStyle
impl PartialEq for ComputedStyle
Source§impl Serialize for ComputedStyle
impl Serialize for ComputedStyle
impl StructuralPartialEq for ComputedStyle
Auto Trait Implementations§
impl Freeze for ComputedStyle
impl RefUnwindSafe for ComputedStyle
impl Send for ComputedStyle
impl Sync for ComputedStyle
impl Unpin for ComputedStyle
impl UnsafeUnpin for ComputedStyle
impl UnwindSafe for ComputedStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.