pub(crate) struct TextRun {
pub base_fragment_info: BaseFragmentInfo,
pub run_data: Arc<SharedTextRunData>,
pub parent_box: Option<WeakLayoutBox>,
pub text_range: Range<usize>,
pub items: Vec<TextRunItem>,
}Expand description
A single TextRun for the box tree. These are all descendants of
super::InlineBox or the root of the super::InlineFormattingContext. During
box tree construction, text is split into TextRuns based on their font, script,
etc. When these are created text is already shaped.
Fields§
§base_fragment_info: BaseFragmentInfoThe BaseFragmentInfo for this TextRun. Usually this comes from the
original text node in the DOM for the text.
run_data: Arc<SharedTextRunData>Data to be used by all [TextFragment]s spawned by this TextRun to avoid
having to clone the data into each fragment.
parent_box: Option<WeakLayoutBox>A weak reference to the parent of this layout box. This becomes valid as soon as the parent of this box is added to the tree.
text_range: Range<usize>The range of text in super::InlineFormattingContext::text_content of the
super::InlineFormattingContext that owns this TextRun. These are UTF-8 offsets.
items: Vec<TextRunItem>The TextRunItems of this text run. This is produced by segmenting the incoming text
by things such as font and script as well as separating out hard line breaks.
segments, and shaped.
Implementations§
Source§impl TextRun
impl TextRun
pub(crate) fn new( base_fragment_info: BaseFragmentInfo, run_data: Arc<SharedTextRunData>, text_range: Range<usize>, old_text_run: Option<ArcRefCell<TextRun>>, ) -> Self
pub(super) fn inline_styles(&self) -> &SharedInlineStyles
pub(super) fn segment( &mut self, self_arc_ref_cell: ArcRefCell<TextRun>, formatting_context_text: &str, layout_context: &LayoutContext<'_>, bidi_levels: &BidiLevels<'_>, ) -> SmallVec<[ShapingQueueEntry; 1]> ⓘ
Sourcefn segment_text_by_font(
&mut self,
layout_context: &LayoutContext<'_>,
formatting_context_text: &str,
bidi_levels: &BidiLevels<'_>,
parent_style: &ServoArc<ComputedValues>,
) -> Vec<TextRunItem>
fn segment_text_by_font( &mut self, layout_context: &LayoutContext<'_>, formatting_context_text: &str, bidi_levels: &BidiLevels<'_>, parent_style: &ServoArc<ComputedValues>, ) -> Vec<TextRunItem>
Take the TextRun’s text and turn it into TextRunSegments. Each segment has a matched
font and script. Fonts may differ when glyphs are found in fallback fonts.
super::InlineFormattingContext.
pub(super) fn layout_into_line_items( &self, ifc: &mut InlineFormattingContextLayout<'_>, )
fn process_preserved_tab( &self, ifc_layout: &mut InlineFormattingContextLayout<'_>, bidi_level: Level, )
Trait Implementations§
Source§impl MallocSizeOf for TextRun
impl MallocSizeOf for TextRun
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for TextRun
impl !RefUnwindSafe for TextRun
impl Send for TextRun
impl Sync for TextRun
impl Unpin for TextRun
impl UnsafeUnpin for TextRun
impl !UnwindSafe for TextRun
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> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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