Share packed native lists across copied boxes and shipouts

This commit is contained in:
gloamxun committed 2026-11-28 08:01:14 +08:00
1 parent ca3730338e
commit da48cf9cad
16 files changed
+157 -67

No files matched your search

@@ -43,8 +43,8 @@ pub struct GlueSetting {
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub enum BoxContent {
Horizontal(Vec<TextNode>),
Vertical(Vec<NativeVerticalNode>),
Horizontal(Arc<Vec<TextNode>>),
Vertical(Arc<Vec<NativeVerticalNode>>),
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct NativeBox {
@@ -264,7 +264,7 @@ impl NativeBox {
}
}
BoxContent::Vertical(nodes) => {
for n in nodes {
for n in nodes.iter() {
match n {
NativeVerticalNode::Output(o) => out.push(o),
NativeVerticalNode::Leaders(_) => *leaders = true,
@@ -662,7 +662,7 @@ pub(super) fn vpack(
height,
depth,
shift: 0,
content: BoxContent::Vertical(nodes),
content: BoxContent::Vertical(nodes.into()),
diagnostic: Arc::default(),
setting: set,
interword_runs: Vec::new(),
@@ -775,7 +775,7 @@ pub(super) fn hpack_with_direction_report(
height,
depth,
shift: 0,
content: BoxContent::Horizontal(nodes),
content: BoxContent::Horizontal(nodes.into()),
diagnostic,
setting: set,
interword_runs: Vec::new(),
@@ -1001,7 +1001,7 @@ impl NativeBox {
};
let mut cursor = y - self.height;
let (mut cumulative, mut previous) = (0, 0);
for node in nodes {
for node in nodes.iter() {
budget.inside_leader(1)?;
match node {
NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b) => {