Share packed native lists across copied boxes and shipouts
This commit is contained in:
1 parent
ca3730338e
commit
da48cf9cad
16 files changed
+157
-67
No files matched your search
@@ -791,9 +791,9 @@ fn empty_alignment_box(width: i64, horizontal: bool, span: Span) -> NativeBox {
|
||||
depth: 0,
|
||||
shift: 0,
|
||||
content: if horizontal {
|
||||
BoxContent::Horizontal(Vec::new())
|
||||
BoxContent::Horizontal(Default::default())
|
||||
} else {
|
||||
BoxContent::Vertical(Vec::new())
|
||||
BoxContent::Vertical(Default::default())
|
||||
},
|
||||
diagnostic: Default::default(),
|
||||
setting: GlueSetting::default(),
|
||||
@@ -857,7 +857,7 @@ fn set_alignment_cell(
|
||||
};
|
||||
match &cell.content {
|
||||
BoxContent::Horizontal(v) => {
|
||||
for n in v {
|
||||
for n in v.iter() {
|
||||
if let TextNode::Glue(g) | TextNode::FontSpace(g, _, _)
|
||||
| TextNode::NamedGlue(g, _)
|
||||
| TextNode::Leaders(LeaderGlue { glue: g, .. }) = n
|
||||
@@ -867,7 +867,7 @@ fn set_alignment_cell(
|
||||
}
|
||||
}
|
||||
BoxContent::Vertical(v) => {
|
||||
for n in v {
|
||||
for n in v.iter() {
|
||||
if let NativeVerticalNode::Glue(g)
|
||||
| NativeVerticalNode::NamedGlue(g, _)
|
||||
| NativeVerticalNode::Leaders(LeaderGlue { glue: g, .. }) = n
|
||||
@@ -937,16 +937,16 @@ fn set_alignment_row(
|
||||
} else {
|
||||
BoxKind::Vertical
|
||||
};
|
||||
let old = std::mem::replace(&mut row.content, BoxContent::Horizontal(Vec::new()));
|
||||
let old = std::mem::replace(&mut row.content, BoxContent::Horizontal(Default::default()));
|
||||
let mut cells: VecDeque<NativeBox> = match old {
|
||||
BoxContent::Horizontal(v) => v
|
||||
BoxContent::Horizontal(v) => std::sync::Arc::unwrap_or_clone(v)
|
||||
.into_iter()
|
||||
.filter_map(|n| match n {
|
||||
TextNode::Box(b) => b.native_box.map(|b| *b),
|
||||
_ => None,
|
||||
})
|
||||
.collect(),
|
||||
BoxContent::Vertical(v) => v
|
||||
BoxContent::Vertical(v) => std::sync::Arc::unwrap_or_clone(v)
|
||||
.into_iter()
|
||||
.filter_map(|n| match n {
|
||||
NativeVerticalNode::Box(b) => Some(*b),
|
||||
@@ -1014,10 +1014,10 @@ fn set_alignment_row(
|
||||
if horizontal {
|
||||
row.width = prototype.width;
|
||||
row.diagnostic = super::super::diagnostics::text_nodes(&h).into();
|
||||
row.content = BoxContent::Horizontal(h);
|
||||
row.content = BoxContent::Horizontal(h.into());
|
||||
} else {
|
||||
row.height = prototype.height;
|
||||
row.content = BoxContent::Vertical(v);
|
||||
row.content = BoxContent::Vertical(v.into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ fn mark_unset(b: &mut NativeBox, span: u8) -> Result<(), String> {
|
||||
};
|
||||
match &b.content {
|
||||
BoxContent::Horizontal(v) => {
|
||||
for n in v {
|
||||
for n in v.iter() {
|
||||
if let TextNode::Glue(g) | TextNode::FontSpace(g, _, _)
|
||||
| TextNode::NamedGlue(g, _)
|
||||
| TextNode::Leaders(LeaderGlue { glue: g, .. }) = n
|
||||
@@ -1041,7 +1041,7 @@ fn mark_unset(b: &mut NativeBox, span: u8) -> Result<(), String> {
|
||||
}
|
||||
}
|
||||
BoxContent::Vertical(v) => {
|
||||
for n in v {
|
||||
for n in v.iter() {
|
||||
if let NativeVerticalNode::Glue(g)
|
||||
| NativeVerticalNode::NamedGlue(g, _)
|
||||
| NativeVerticalNode::Leaders(LeaderGlue { glue: g, .. }) = n
|
||||
|
||||
Reference in new issue
Block a user