Reuse equivalent native page layouts after execution

This commit is contained in:
gloamxun committed 2026-11-29 04:24:15 +08:00
1 parent f09bb04a32
commit 79bfee5ab1
4 files changed
+45 -20

No files matched your search

+5 -12
View File
@@ -66,19 +66,12 @@ fn pdf_resource_entries_empty(entries: &Arc<[u8]>) -> bool {
}
impl NativeShipout {
/// The checkpoint and its resumed execution share actual TeX lists.
/// Check that identity first, then compare the rest of the shipout snapshot.
/// Match the complete inputs to local layout, including source locations
/// and device resources. Re-execution can produce an equal packed box
/// even when its nodes no longer share storage with the prior revision.
pub fn shares_local_layout_with(&self, prior: &Self) -> bool {
let shared = match (&self.box_node.content, &prior.box_node.content) {
(BoxContent::Horizontal(current), BoxContent::Horizontal(previous)) => {
Arc::ptr_eq(current, previous)
}
(BoxContent::Vertical(current), BoxContent::Vertical(previous)) => {
Arc::ptr_eq(current, previous)
}
_ => false,
};
shared && self == prior
std::ptr::eq(self, prior)
|| (self.box_node.span == prior.box_node.span && self == prior)
}
pub fn display_list(&self) -> Result<crate::render::DisplayList, String> {