pub struct ParagraphStore { /* private fields */ }Expand description
Compact flat store of all compiled paragraphs for a surface.
Shared by TaffyStoreLayout, YogaLayoutEngine, SkiaBackend, and nativeview-runtime.
Implementations§
Source§impl ParagraphStore
impl ParagraphStore
Sourcepub fn sync_changes(
&mut self,
store: &NodeStore,
changes: &ChangeSet,
inherited: InheritedText<'_>,
interaction: Option<&InteractionTracker>,
defer_compile: bool,
)
pub fn sync_changes( &mut self, store: &NodeStore, changes: &ChangeSet, inherited: InheritedText<'_>, interaction: Option<&InteractionTracker>, defer_compile: bool, )
Synchronizes paragraph spans for one committed ChangeSet.
Sourcepub fn sync_inherited_paragraph(
&mut self,
store: &NodeStore,
pid: NodeId,
parent_text: ResolvedTextStyle,
parent_rtl: bool,
interaction: Option<&InteractionTracker>,
responsive: Option<ResponsiveTextEnv<'_>>,
) -> (bool, bool)
pub fn sync_inherited_paragraph( &mut self, store: &NodeStore, pid: NodeId, parent_text: ResolvedTextStyle, parent_rtl: bool, interaction: Option<&InteractionTracker>, responsive: Option<ResponsiveTextEnv<'_>>, ) -> (bool, bool)
Compiles or updates paragraph root pid during a box-tree inheritance walk (parent_text,
parent_rtl are the resolved inherited values of pid’s parent box). Returns
(layout_changed, paint_changed).
Sourcepub fn recompile_paragraph(
&mut self,
store: &NodeStore,
pid: NodeId,
parent_text: ResolvedTextStyle,
parent_rtl: bool,
interaction: Option<&InteractionTracker>,
responsive: Option<ResponsiveTextEnv<'_>>,
) -> (bool, bool)
pub fn recompile_paragraph( &mut self, store: &NodeStore, pid: NodeId, parent_text: ResolvedTextStyle, parent_rtl: bool, interaction: Option<&InteractionTracker>, responsive: Option<ResponsiveTextEnv<'_>>, ) -> (bool, bool)
Unconditionally recompiles paragraph root pid (e.g. after its responsive environment
changed). Returns (layout_changed, paint_changed).
Sourcepub fn sync_interaction_dirty(
&mut self,
store: &NodeStore,
interaction: &InteractionTracker,
dirty_nodes: &[NodeId],
responsive: Option<ResponsiveTextEnv<'_>>,
) -> (&[NodeId], &[NodeId])
pub fn sync_interaction_dirty( &mut self, store: &NodeStore, interaction: &InteractionTracker, dirty_nodes: &[NodeId], responsive: Option<ResponsiveTextEnv<'_>>, ) -> (&[NodeId], &[NodeId])
Recompiles only the paragraphs affected by interactive pseudo-state changes (:hover,
:active, :focus, :disabled) in O(dirty * runs) with 0 tree walks and 0 allocations.
Source§impl ParagraphStore
impl ParagraphStore
pub fn new() -> Self
pub fn reset(&mut self)
pub fn ensure_capacity(&mut self, cap: usize)
pub fn node_to_paragraph_slice(&self) -> &[u32]
pub fn spans(&self) -> &[NvParagraphSpan]
pub fn runs_slab(&self) -> &[NvTextRun]
pub fn text_slab(&self) -> &[u8] ⓘ
Sourcepub fn paragraph_slot(&self, id: NodeId) -> Option<u32>
pub fn paragraph_slot(&self, id: NodeId) -> Option<u32>
O(1) indexed lookup returning the compact paragraph slot for paragraph root id.
Sourcepub fn paragraph_of(&self, id: NodeId) -> Option<&NvParagraphSpan>
pub fn paragraph_of(&self, id: NodeId) -> Option<&NvParagraphSpan>
O(1) indexed lookup returning the compact NvParagraphSpan for paragraph root id.
Sourcepub fn owner_paragraph(&self, id: NodeId) -> Option<NodeId>
pub fn owner_paragraph(&self, id: NodeId) -> Option<NodeId>
O(1) lift from any inline descendant id (at arbitrary nesting depth) to its owning
paragraph root NodeId (None for box nodes).
pub fn layout_hash(&self, id: NodeId) -> Option<u64>
pub fn paint_hash(&self, id: NodeId) -> Option<u64>
pub fn paragraph_runs_slice(&self, id: NodeId) -> &[NvTextRun]
Sourcepub fn paragraph_text_str<'a>(
&'a self,
store: &'a NodeStore,
id: NodeId,
) -> Option<&'a str>
pub fn paragraph_text_str<'a>( &'a self, store: &'a NodeStore, id: NodeId, ) -> Option<&'a str>
Resolves the contiguous UTF-8 text of paragraph root id (zero-copy from either
store.text_slab() for 1-run paragraphs or self.text for multi-run paragraphs).
Sourcepub fn paragraph_view<'a>(
&'a self,
store: &'a NodeStore,
id: NodeId,
) -> Option<NvTextParagraphView>
pub fn paragraph_view<'a>( &'a self, store: &'a NodeStore, id: NodeId, ) -> Option<NvTextParagraphView>
Builds a zero-copy NvTextParagraphView for paragraph root id.
Sourcepub fn paragraph_view_by_slot<'a>(
&'a self,
store: &'a NodeStore,
slot: u32,
) -> Option<NvTextParagraphView>
pub fn paragraph_view_by_slot<'a>( &'a self, store: &'a NodeStore, slot: u32, ) -> Option<NvTextParagraphView>
Builds a zero-copy NvTextParagraphView directly from compact slot.