diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-16 10:41:30 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-16 10:41:30 +0100 |
| commit | 0e0f340502beada1cd9ee23857f48b91a0d11a90 (patch) | |
| tree | e4e4087260720adf4bab57edeac6a3d3cb5f14cf /src/library/document.rs | |
| parent | bc118634aca5de415d211cab38c4eaa3d3cca25f (diff) | |
Revert page and inline levels
Diffstat (limited to 'src/library/document.rs')
| -rw-r--r-- | src/library/document.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/library/document.rs b/src/library/document.rs new file mode 100644 index 00000000..fe01d2df --- /dev/null +++ b/src/library/document.rs @@ -0,0 +1,16 @@ +use super::prelude::*; +use super::PageNode; + +/// The root layout node, a document consisting of top-level page runs. +#[derive(Debug, Hash)] +pub struct DocumentNode { + /// The page runs. + pub pages: Vec<PageNode>, +} + +impl DocumentNode { + /// Layout the document into a sequence of frames, one per page. + pub fn layout(&self, ctx: &mut LayoutContext) -> Vec<Rc<Frame>> { + self.pages.iter().flat_map(|node| node.layout(ctx)).collect() + } +} |
