Struct layout_2013::fragment::ScannedTextFragmentInfo
source · pub struct ScannedTextFragmentInfo {
pub run: Arc<TextRun>,
pub content_size: LogicalSize<Au>,
pub insertion_point: Option<ByteIndex>,
pub range: Range<ByteIndex>,
pub range_end_including_stripped_whitespace: ByteIndex,
pub flags: ScannedTextFlags,
}
Expand description
A scanned text fragment represents a single run of text with a distinct style. A TextFragment
may be split into two or more fragments across line breaks. Several TextFragment
s may
correspond to a single DOM text node. Split text fragments are implemented by referring to
subsets of a single TextRun
object.
Fields§
§run: Arc<TextRun>
The text run that this represents.
content_size: LogicalSize<Au>
The intrinsic size of the text fragment.
insertion_point: Option<ByteIndex>
The byte offset of the insertion point, if any.
range: Range<ByteIndex>
The range within the above text run that this represents.
range_end_including_stripped_whitespace: ByteIndex
The endpoint of the above range, including whitespace that was stripped out. This exists so that we can restore the range to its original value (before line breaking occurred) when performing incremental reflow.
flags: ScannedTextFlags
Implementations§
source§impl ScannedTextFragmentInfo
impl ScannedTextFragmentInfo
sourcepub fn new(
run: Arc<TextRun>,
range: Range<ByteIndex>,
content_size: LogicalSize<Au>,
insertion_point: Option<ByteIndex>,
flags: ScannedTextFlags,
) -> ScannedTextFragmentInfo
pub fn new( run: Arc<TextRun>, range: Range<ByteIndex>, content_size: LogicalSize<Au>, insertion_point: Option<ByteIndex>, flags: ScannedTextFlags, ) -> ScannedTextFragmentInfo
Creates the information specific to a scanned text fragment from a range and a text run.
pub fn text(&self) -> &str
pub fn requires_line_break_afterward_if_wrapping_on_newlines(&self) -> bool
pub fn selected(&self) -> bool
Trait Implementations§
source§impl Clone for ScannedTextFragmentInfo
impl Clone for ScannedTextFragmentInfo
source§fn clone(&self) -> ScannedTextFragmentInfo
fn clone(&self) -> ScannedTextFragmentInfo
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ScannedTextFragmentInfo
impl RefUnwindSafe for ScannedTextFragmentInfo
impl Send for ScannedTextFragmentInfo
impl Sync for ScannedTextFragmentInfo
impl Unpin for ScannedTextFragmentInfo
impl UnwindSafe for ScannedTextFragmentInfo
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> 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