Struct layout_2013::fragment::Fragment

source ·
pub struct Fragment {
Show 14 fields pub node: OpaqueNode, pub style: Arc<ComputedValues>, pub selected_style: Arc<ComputedValues>, pub border_box: LogicalRect<Au>, pub border_padding: LogicalMargin<Au>, pub margin: LogicalMargin<Au>, pub specific: SpecificFragmentInfo, pub inline_context: Option<InlineFragmentContext>, pub restyle_damage: RestyleDamage, pub pseudo: PseudoElementType, pub flags: FragmentFlags, debug_id: DebugId, pub stacking_context_id: StackingContextId, pub established_reference_frame: Option<ClipScrollNodeIndex>,
}
Expand description

Fragments (struct Fragment) are the leaves of the layout tree. They cannot position themselves. In general, fragments do not have a simple correspondence with CSS fragments in the specification:

  • Several fragments may correspond to the same CSS box or DOM node. For example, a CSS text box broken across two lines is represented by two fragments.

  • Some CSS fragments are not created at all, such as some anonymous block fragments induced by inline fragments with block-level sibling fragments. In that case, Servo uses an InlineFlow with BlockFlow siblings; the InlineFlow is block-level, but not a block container. It is positioned as if it were a block fragment, but its children are positioned according to inline flow.

A SpecificFragmentInfo::Generic is an empty fragment that contributes only borders, margins, padding, and backgrounds. It is analogous to a CSS nonreplaced content box.

A fragment’s type influences how its styles are interpreted during layout. For example, replaced content such as images are resized differently from tables, text, or other content. Different types of fragments may also contain custom data; for example, text fragments contain text.

Do not add fields to this structure unless they’re really really mega necessary! Fragments get moved around a lot and thus their size impacts performance of layout quite a bit.

FIXME(#2260, pcwalton): This can be slimmed down some by (at least) moving inline_context to be on InlineFlow only.

Fields§

§node: OpaqueNode

An opaque reference to the DOM node that this Fragment originates from.

§style: Arc<ComputedValues>

The CSS style of this fragment.

§selected_style: Arc<ComputedValues>

The CSS style of this fragment when it’s selected

§border_box: LogicalRect<Au>

The position of this fragment relative to its owning flow. The size includes padding and border, but not margin.

NB: This does not account for relative positioning. NB: Collapsed borders are not included in this.

§border_padding: LogicalMargin<Au>

The sum of border and padding; i.e. the distance from the edge of the border box to the content edge of the fragment.

§margin: LogicalMargin<Au>

The margin of the content box.

§specific: SpecificFragmentInfo

Info specific to the kind of fragment. Keep this enum small.

§inline_context: Option<InlineFragmentContext>

Holds the style context information for fragments that are part of an inline formatting context.

§restyle_damage: RestyleDamage

How damaged this fragment is since last reflow.

§pseudo: PseudoElementType

The pseudo-element that this fragment represents.

§flags: FragmentFlags

Various flags for this fragment.

§debug_id: DebugId

A debug ID that is consistent for the life of this fragment (via transform etc). This ID should not be considered stable across multiple layouts or fragment manipulations.

§stacking_context_id: StackingContextId

The ID of the StackingContext that contains this fragment. This is initialized to 0, but it assigned during the collect_stacking_contexts phase of display list construction.

§established_reference_frame: Option<ClipScrollNodeIndex>

The indices of this Fragment’s ClipScrollNode. If this fragment doesn’t have a established_reference_frame assigned, it will use the clipping_and_scrolling of the parent block.

Implementations§

source§

impl Fragment

source

pub fn collect_stacking_contexts_for_blocklike_fragment( &mut self, state: &mut StackingContextCollectionState, ) -> bool

source

pub fn create_stacking_context_for_inline_block( &mut self, base: &BaseFlow, state: &mut StackingContextCollectionState, ) -> bool

source

fn build_display_list_for_background_if_applicable( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, display_list_section: DisplayListSection, absolute_bounds: Rect<Au>, )

Adds the display items necessary to paint the background of this fragment to the display list if necessary.

source

fn build_display_list_for_background_if_applicable_with_background( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, background: &Background, background_color: AbsoluteColor, display_list_section: DisplayListSection, absolute_bounds: Rect<Au>, )

Same as build_display_list_for_background_if_applicable, but lets you override the actual background used

source

fn build_display_list_for_webrender_image( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, display_list_section: DisplayListSection, absolute_bounds: Rect<Au>, webrender_image: WebRenderImageInfo, index: usize, )

Adds the display items necessary to paint a webrender image of this fragment to the appropriate section of the display list.

source

fn get_webrender_image_for_paint_worklet( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, paint_worklet: &PaintWorklet, size_in_au: Size2D<Au>, ) -> Option<WebRenderImageInfo>

Calculates the webrender image for a paint worklet. Returns None if the worklet is not registered. If the worklet has missing image URLs, it passes them to the image cache for loading.

source

fn build_display_list_for_background_gradient( &self, state: &mut DisplayListBuildState<'_>, display_list_section: DisplayListSection, absolute_bounds: Rect<Au>, gradient: &Gradient, style: &ComputedValues, index: usize, )

Adds the display items necessary to paint the background linear gradient of this fragment to the appropriate section of the display list.

source

fn build_display_list_for_box_shadow_if_applicable( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, display_list_section: DisplayListSection, absolute_bounds: Rect<Au>, clip: Rect<Au>, )

Adds the display items necessary to paint the box shadow of this fragment to the display list if necessary.

source

fn build_display_list_for_borders_if_applicable( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, inline_info: Option<InlineNodeBorderInfo>, border_painting_mode: BorderPaintingMode<'_>, bounds: Rect<Au>, display_list_section: DisplayListSection, clip: Rect<Au>, )

Adds the display items necessary to paint the borders of this fragment to a display list if necessary.

source

fn build_display_list_for_border_image( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, base: BaseDisplayItem, bounds: Rect<Au>, image: &Image, border_width: UntypedSideOffsets2D<Au>, ) -> Option<()>

Add display item for image border.

Returns Some if the addition was successful.

source

fn build_display_list_for_outline_if_applicable( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, bounds: Rect<Au>, clip: Rect<Au>, )

Adds the display items necessary to paint the outline of this fragment to the display list if necessary.

source

fn build_debug_borders_around_text_fragments( &self, state: &mut DisplayListBuildState<'_>, style: &ComputedValues, stacking_relative_border_box: Rect<Au>, stacking_relative_content_box: Rect<Au>, text_fragment: &ScannedTextFragmentInfo, clip: Rect<Au>, )

Adds display items necessary to draw debug boxes around a scanned text fragment.

source

fn build_debug_borders_around_fragment( &self, state: &mut DisplayListBuildState<'_>, stacking_relative_border_box: Rect<Au>, clip: Rect<Au>, )

Adds display items necessary to draw debug boxes around this fragment.

source

fn build_display_items_for_selection_if_necessary( &self, state: &mut DisplayListBuildState<'_>, stacking_relative_border_box: Rect<Au>, display_list_section: DisplayListSection, )

Builds the display items necessary to paint the selection and/or caret for this fragment, if any.

source

pub fn build_display_list( &mut self, state: &mut DisplayListBuildState<'_>, stacking_relative_border_box: Rect<Au>, border_painting_mode: BorderPaintingMode<'_>, display_list_section: DisplayListSection, clip: Rect<Au>, overflow_content_size: Option<Size2D<Au>>, )

Adds the display items for this fragment to the given display list.

Arguments:

  • state: The display building state, including the display list currently under construction and other metadata useful for constructing it.
  • dirty: The dirty rectangle in the coordinate system of the owning flow.
  • clip: The region to clip the display items to.
  • overflow_content_size: The size of content associated with this fragment that must have overflow handling applied to it. For a scrollable block flow, it is expected that this is the size of the child boxes.
source

fn build_display_list_no_damage( &self, state: &mut DisplayListBuildState<'_>, stacking_relative_border_box: Rect<Au>, border_painting_mode: BorderPaintingMode<'_>, display_list_section: DisplayListSection, clip: Rect<Au>, overflow_content_size: Option<Size2D<Au>>, )

build_display_list, but don’t update the restyle damage

Must be paired with a self.restyle_damage.remove(REPAINT) somewhere

source

fn build_fragment_type_specific_display_items( &self, state: &mut DisplayListBuildState<'_>, stacking_relative_border_box: Rect<Au>, clip: Rect<Au>, )

A helper method that build_display_list calls to create per-fragment-type display items.

source

fn create_stacking_context( &self, id: StackingContextId, base_flow: &BaseFlow, context_type: StackingContextType, established_reference_frame: Option<ClipScrollNodeIndex>, parent_clipping_and_scrolling: ClippingAndScrolling, ) -> StackingContext

Creates a stacking context for associated fragment.

source

fn build_display_list_for_text_fragment( &self, state: &mut DisplayListBuildState<'_>, text_fragment: &ScannedTextFragmentInfo, stacking_relative_content_box: Rect<Au>, text_shadows: &[SimpleShadow], clip: Rect<Au>, )

Creates the text display item for one text fragment. This can be called multiple times for one fragment if there are text shadows.

text_shadow will be Some if this is rendering a shadow.

source

fn build_display_list_for_text_decoration( &self, state: &mut DisplayListBuildState<'_>, color: &AbsoluteColor, stacking_relative_box: &LogicalRect<Au>, clip: Rect<Au>, )

Creates the display item for a text decoration: underline, overline, or line-through.

source

fn unique_id(&self) -> u64

source

fn fragment_type(&self) -> FragmentType

source§

impl Fragment

source

pub fn new<'dom>( node: &impl ThreadSafeLayoutNode<'dom>, specific: SpecificFragmentInfo, ctx: &LayoutContext<'_>, ) -> Fragment

Constructs a new Fragment instance.

source

pub fn from_opaque_node_and_style( node: OpaqueNode, pseudo: PseudoElementType, style: ServoArc<ComputedValues>, selected_style: ServoArc<ComputedValues>, restyle_damage: RestyleDamage, specific: SpecificFragmentInfo, ) -> Fragment

Constructs a new Fragment instance from an opaque node.

source

pub fn create_similar_anonymous_fragment( &self, style: ServoArc<ComputedValues>, specific: SpecificFragmentInfo, ) -> Fragment

Creates an anonymous fragment just like this one but with the given style and fragment type. For the new anonymous fragment, layout-related values (border box, etc.) are reset to initial values.

source

pub fn transform( &self, size: LogicalSize<Au>, info: SpecificFragmentInfo, ) -> Fragment

Transforms this fragment into another fragment of the given type, with the given size, preserving all the other data.

source

pub fn transform_with_split_info( &self, split: &SplitInfo, text_run: Arc<TextRun>, first: bool, ) -> Fragment

Transforms this fragment using the given SplitInfo, preserving all the other data.

If this is the first half of a split, first is true

source

pub fn transform_into_ellipsis( &self, layout_context: &LayoutContext<'_>, text_overflow_string: String, ) -> Fragment

Transforms this fragment into an ellipsis fragment, preserving all the other data.

source

pub fn restyle_damage(&self) -> RestyleDamage

source

pub fn contains_node(&self, node_address: OpaqueNode) -> bool

source

pub fn add_inline_context_style(&mut self, node_info: InlineFragmentNodeInfo)

Adds a style to the inline context for this fragment. If the inline context doesn’t exist yet, it will be created.

source

fn quantities_included_in_intrinsic_inline_size( &self, ) -> QuantitiesIncludedInIntrinsicInlineSizes

Determines which quantities (border/padding/margin/specified) should be included in the intrinsic inline size of this fragment.

source

pub fn surrounding_intrinsic_inline_size(&self) -> (Au, Au)

Returns the portion of the intrinsic inline-size that consists of borders/padding and margins, respectively.

FIXME(#2261, pcwalton): This won’t work well for inlines: is this OK?

source

pub fn style_specified_intrinsic_inline_size( &self, ) -> IntrinsicISizesContribution

Uses the style only to estimate the intrinsic inline-sizes. These may be modified for text or replaced elements.

source

pub fn intrinsic_width(&self) -> Au

intrinsic width of this replaced element.

source

pub fn intrinsic_height(&self) -> Au

intrinsic width of this replaced element.

source

pub fn has_intrinsic_ratio(&self) -> bool

Whether this replace element has intrinsic aspect ratio.

source

pub fn calculate_replaced_sizes( &self, containing_inline_size: Option<Au>, containing_block_size: Option<Au>, ) -> (Au, Au)

CSS 2.1 § 10.3.2 & 10.6.2 Calculate the used width and height of a replaced element. When a parameter is None it means the specified size in certain direction is unconstrained. The inline containing size can also be None since this method is also used for calculating intrinsic inline size contribution.

source

pub fn size_constraint( &self, containing_size: Option<Au>, direction: Direction, ) -> SizeConstraint

Return a size constraint that can be used the clamp size in given direction. To take box-sizing: border-box into account, the border_padding field must be initialized first.

TODO(stshine): Maybe there is a more convenient way.

source

pub fn guess_inline_content_edge_offsets( &self, ) -> SpeculatedInlineContentEdgeOffsets

Returns a guess as to the distances from the margin edge of this fragment to its content in the inline direction. This will generally be correct unless percentages are involved.

This is used for the float placement speculation logic.

source

pub fn border_width(&self) -> LogicalMargin<Au>

Returns the sum of the inline-sizes of all the borders of this fragment. Note that this can be expensive to compute, so if possible use the border_padding field instead.

source

pub fn box_sizing_boundary(&self, direction: Direction) -> Au

Returns the border width in given direction if this fragment has property ‘box-sizing: border-box’. The border_padding field must have been initialized.

source

pub fn compute_inline_direction_margins( &mut self, containing_block_inline_size: Au, )

Computes the margins in the inline direction from the containing block inline-size and the style. After this call, the inline direction of the margin field will be correct.

Do not use this method if the inline direction margins are to be computed some other way (for example, via constraint solving for blocks).

source

pub fn compute_block_direction_margins( &mut self, containing_block_inline_size: Au, )

Computes the margins in the block direction from the containing block inline-size and the style. After this call, the block direction of the margin field will be correct.

Do not use this method if the block direction margins are to be computed some other way (for example, via constraint solving for absolutely-positioned flows).

source

pub fn compute_border_and_padding(&mut self, containing_block_inline_size: Au)

Computes the border and padding in both inline and block directions from the containing block inline-size and the style. After this call, the border_padding field will be correct.

source

pub fn relative_position( &self, containing_block_size: &LogicalSize<Au>, ) -> LogicalSize<Au>

source

pub fn clear(&self) -> Option<ClearType>

Always inline for SCCP.

FIXME(pcwalton): Just replace with the clear type from the style module for speed?

source

pub fn style(&self) -> &ComputedValues

source

pub fn selected_style(&self) -> &ComputedValues

source

pub fn white_space_collapse(&self) -> WhiteSpaceCollapse

source

pub fn text_wrap_mode(&self) -> TextWrapMode

source

pub fn color(&self) -> Color

source

pub fn text_decoration_line(&self) -> TextDecorationLine

Returns the text decoration line of this fragment, according to the style of the nearest ancestor element.

NB: This may not be the actual text decoration line, because of the override rules specified in CSS 2.1 § 16.3.1. Unfortunately, computing this properly doesn’t really fit into Servo’s model. Therefore, this is a best lower bound approximation, but the end result may actually have the various decoration flags turned on afterward.

source

pub fn inline_start_offset(&self) -> Au

Returns the inline-start offset from margin edge to content edge.

FIXME(#2262, pcwalton): I think this method is pretty bogus, because it won’t work for inlines.

source

pub fn column_span(&self) -> u32

If this is a Column fragment, get the col span

Panics for non-column fragments

source

pub fn can_split(&self) -> bool

Returns true if this element can be split. This is true for text fragments, unless white-space: pre or white-space: nowrap is set.

source

pub fn is_unscanned_generated_content(&self) -> bool

Returns true if and only if this fragment is a generated content fragment.

source

pub fn is_scanned_text_fragment(&self) -> bool

Returns true if and only if this is a scanned text fragment.

source

pub fn suppress_line_break_before(&self) -> bool

source

pub fn compute_intrinsic_inline_sizes(&mut self) -> IntrinsicISizesContribution

Computes the intrinsic inline-sizes of this fragment.

source

pub fn minimum_splittable_inline_size(&self) -> Au

Returns the narrowest inline-size that the first splittable part of this fragment could possibly be split to. (In most cases, this returns the inline-size of the first word in this fragment.)

source

pub fn content_box(&self) -> LogicalRect<Au>

Returns the dimensions of the content box.

This is marked #[inline] because it is frequently called when only one or two of the values are needed and that will save computation.

source

pub fn calculate_split_position( &self, max_inline_size: Au, starts_line: bool, ) -> Option<SplitResult>

Attempts to find the split positions of a text fragment so that its inline-size is no more than max_inline_size.

A return value of None indicates that the fragment could not be split. Otherwise the information pertaining to the split is returned. The inline-start and inline-end split information are both optional due to the possibility of them being whitespace.

source

pub fn is_on_glyph_run_boundary(&self) -> bool

Does this fragment start on a glyph run boundary?

source

pub fn truncate_to_inline_size(self, max_inline_size: Au) -> Fragment

Truncates this fragment to the given max_inline_size, using a character-based breaking strategy. The resulting fragment will have SpecificFragmentInfo::TruncatedFragment, preserving the original fragment for use in incremental reflow.

This function will panic if self is already truncated.

source

fn calculate_truncate_to_inline_size( &self, max_inline_size: Au, ) -> Option<TruncationResult>

Truncates this fragment to the given max_inline_size, using a character-based breaking strategy. If no characters could fit, returns None.

source

fn calculate_split_position_using_breaking_strategy<'a, I>( &self, slice_iterator: I, max_inline_size: Au, flags: SplitOptions, ) -> Option<SplitResult>
where I: Iterator<Item = TextRunSlice<'a>>,

A helper method that uses the breaking strategy described by slice_iterator (at present, either natural word breaking or character breaking) to split this fragment.

source

pub fn merge_with(&mut self, next_fragment: Fragment)

The opposite of calculate_split_position_using_breaking_strategy: merges this fragment with the next one.

source

pub fn reset_text_range_and_inline_size(&mut self)

Restore any whitespace that was stripped from a text fragment, and recompute inline metrics if necessary.

source

pub fn assign_replaced_inline_size_if_necessary( &mut self, container_inline_size: Au, container_block_size: Option<Au>, )

Assigns replaced inline-size, padding, and margins for this fragment only if it is replaced content per CSS 2.1 § 10.3.2.

source

pub fn assign_replaced_block_size_if_necessary(&mut self)

Assign block-size for this fragment if it is replaced content. The inline-size must have been assigned first.

Ideally, this should follow CSS 2.1 § 10.6.2.

source

pub fn is_replaced(&self) -> bool

Returns true if this fragment is replaced content.

source

pub fn is_replaced_or_inline_block(&self) -> bool

Returns true if this fragment is replaced content or an inline-block or false otherwise.

source

fn content_inline_metrics( &self, layout_context: &LayoutContext<'_>, ) -> InlineMetrics

Calculates block-size above baseline, depth below baseline, and ascent for this fragment when used in an inline formatting context. See CSS 2.1 § 10.8.1.

This does not take vertical-align into account. For that, use aligned_inline_metrics().

source

fn vertical_alignment_offset( &self, layout_context: &LayoutContext<'_>, content_inline_metrics: &InlineMetrics, minimum_line_metrics: &LineMetrics, actual_line_metrics: Option<&LineMetrics>, ) -> Au

Calculates the offset from the baseline that applies to this fragment due to vertical-align. Positive values represent downward displacement.

If actual_line_metrics is supplied, then these metrics are used to determine the displacement of the fragment when top or bottom vertical-align values are encountered. If this is not supplied, then top and bottom values are ignored.

source

pub fn aligned_inline_metrics( &self, layout_context: &LayoutContext<'_>, minimum_line_metrics: &LineMetrics, actual_line_metrics: Option<&LineMetrics>, ) -> InlineMetrics

Calculates block-size above baseline, depth below baseline, and ascent for this fragment when used in an inline formatting context, taking vertical-align (other than top or bottom) into account. See CSS 2.1 § 10.8.1.

If actual_line_metrics is supplied, then these metrics are used to determine the displacement of the fragment when top or bottom vertical-align values are encountered. If this is not supplied, then top and bottom values are ignored.

source

pub fn is_hypothetical(&self) -> bool

Returns true if this fragment is a hypothetical box. See CSS 2.1 § 10.3.7.

source

pub fn can_merge_with_fragment(&self, other: &Fragment) -> bool

Returns true if this fragment can merge with another immediately-following fragment or false otherwise.

source

pub fn is_primary_fragment(&self) -> bool

Returns true if and only if this is the primary fragment for the fragment’s style object (conceptually, though style sharing makes this not really true, of course). The primary fragment is the one that draws backgrounds, borders, etc., and takes borders, padding and margins into account. Every style object has at most one primary fragment.

At present, all fragments are primary fragments except for inline-block and table wrapper fragments. Inline-block fragments are not primary fragments because the corresponding block flow is the primary fragment, while table wrapper fragments are not primary fragments because the corresponding table flow is the primary fragment.

source

pub fn update_late_computed_replaced_inline_size_if_necessary(&mut self)

Determines the inline sizes of inline-block fragments. These cannot be fully computed until inline size assignment has run for the child flow: thus it is computed “late”, during block size assignment.

source

pub fn update_late_computed_inline_position_if_necessary(&mut self)

source

pub fn update_late_computed_block_position_if_necessary(&mut self)

source

pub fn repair_style(&mut self, new_style: &ServoArc<ComputedValues>)

source

pub fn stacking_relative_border_box( &self, stacking_relative_flow_origin: &Vector2D<Au>, relative_containing_block_size: &LogicalSize<Au>, relative_containing_block_mode: WritingMode, coordinate_system: CoordinateSystem, ) -> Rect<Au>

Given the stacking-context-relative position of the containing flow, returns the border box of this fragment relative to the parent stacking context. This takes position: relative into account.

If coordinate_system is Parent, this returns the border box in the parent stacking context’s coordinate system. Otherwise, if coordinate_system is Own and this fragment establishes a stacking context itself, this returns a border box anchored at (0, 0). (If this fragment does not establish a stacking context, then it always belongs to its parent stacking context and thus coordinate_system is ignored.)

This is the method you should use for display list construction as well as getBoundingClientRect() and so forth.

source

pub fn stacking_relative_content_box( &self, stacking_relative_border_box: Rect<Au>, ) -> Rect<Au>

Given the stacking-context-relative border box, returns the stacking-context-relative content box.

source

pub fn can_establish_reference_frame(&self) -> bool

Returns true if this fragment may establish a reference frame.

source

pub fn has_filter_transform_or_perspective(&self) -> bool

Returns true if this fragment has a filter, transform, or perspective property set.

source

pub fn has_non_invertible_transform_or_zero_scale(&self) -> bool

Returns true if this fragment has a transform applied that causes it to take up no space.

source

pub fn establishes_stacking_context(&self) -> bool

Returns true if this fragment establishes a new stacking context and false otherwise.

source

pub fn effective_z_index(&self) -> i32

source

pub fn compute_overflow( &self, flow_size: &Size2D<Au>, relative_containing_block_size: &LogicalSize<Au>, ) -> Overflow

Computes the overflow rect of this fragment relative to the start of the flow.

source

pub fn requires_line_break_afterward_if_wrapping_on_newlines(&self) -> bool

source

pub fn strip_leading_whitespace_if_necessary( &mut self, ) -> WhitespaceStrippingResult

source

pub fn strip_trailing_whitespace_if_necessary( &mut self, ) -> WhitespaceStrippingResult

Returns true if the entire fragment was stripped.

source

pub fn inline_styles(&self) -> InlineStyleIterator<'_>

source

pub fn margin_box_inline_size(&self) -> Au

Returns the inline-size of this fragment’s margin box.

source

pub fn is_positioned(&self) -> bool

Returns true if this node or any of the nodes within its inline fragment context have non-static position.

source

pub fn is_absolutely_positioned(&self) -> bool

Returns true if this node is absolutely positioned.

source

pub fn is_inline_absolute(&self) -> bool

source

pub fn meld_with_next_inline_fragment(&mut self, next_fragment: &Fragment)

source

pub fn meld_with_prev_inline_fragment(&mut self, prev_fragment: &Fragment)

source

pub fn is_vertically_aligned_to_top_or_bottom(&self) -> bool

Returns true if any of the inline styles associated with this fragment have vertical-align set to top or bottom.

source

pub fn is_text_or_replaced(&self) -> bool

source

pub fn transform_matrix( &self, stacking_relative_border_box: &Rect<Au>, ) -> Option<LayoutTransform>

Returns the 4D matrix representing this fragment’s transform.

source

pub fn perspective_matrix( &self, stacking_relative_border_box: &Rect<Au>, ) -> Option<LayoutTransform>

Returns the 4D matrix representing this fragment’s perspective.

Trait Implementations§

source§

impl Clone for Fragment

source§

fn clone(&self) -> Fragment

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Fragment

source§

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

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

impl Serialize for Fragment

source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

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> 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for 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,