summaryrefslogtreecommitdiff
path: root/library/src/layout
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/layout')
-rw-r--r--library/src/layout/align.rs1
-rw-r--r--library/src/layout/columns.rs1
-rw-r--r--library/src/layout/container.rs2
-rw-r--r--library/src/layout/enum.rs1
-rw-r--r--library/src/layout/flow.rs5
-rw-r--r--library/src/layout/grid.rs2
-rw-r--r--library/src/layout/hide.rs1
-rw-r--r--library/src/layout/list.rs1
-rw-r--r--library/src/layout/mod.rs13
-rw-r--r--library/src/layout/pad.rs1
-rw-r--r--library/src/layout/page.rs15
-rw-r--r--library/src/layout/par.rs1
-rw-r--r--library/src/layout/place.rs1
-rw-r--r--library/src/layout/repeat.rs1
-rw-r--r--library/src/layout/stack.rs3
-rw-r--r--library/src/layout/table.rs1
-rw-r--r--library/src/layout/terms.rs1
-rw-r--r--library/src/layout/transform.rs3
18 files changed, 52 insertions, 2 deletions
diff --git a/library/src/layout/align.rs b/library/src/layout/align.rs
index c2f8262e..b8f7a086 100644
--- a/library/src/layout/align.rs
+++ b/library/src/layout/align.rs
@@ -58,6 +58,7 @@ pub struct AlignElem {
}
impl Show for AlignElem {
+ #[tracing::instrument(name = "AlignElem::show", skip_all)]
fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> {
Ok(self
.body()
diff --git a/library/src/layout/columns.rs b/library/src/layout/columns.rs
index 3a1b012a..2a587907 100644
--- a/library/src/layout/columns.rs
+++ b/library/src/layout/columns.rs
@@ -50,6 +50,7 @@ pub struct ColumnsElem {
}
impl Layout for ColumnsElem {
+ #[tracing::instrument(name = "ColumnsElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs
index 9bf1bf87..ae6a094c 100644
--- a/library/src/layout/container.rs
+++ b/library/src/layout/container.rs
@@ -99,6 +99,7 @@ pub struct BoxElem {
}
impl Layout for BoxElem {
+ #[tracing::instrument(name = "BoxElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -326,6 +327,7 @@ pub struct BlockElem {
}
impl Layout for BlockElem {
+ #[tracing::instrument(name = "BlockElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/enum.rs b/library/src/layout/enum.rs
index ce65b14c..76942c27 100644
--- a/library/src/layout/enum.rs
+++ b/library/src/layout/enum.rs
@@ -154,6 +154,7 @@ pub struct EnumElem {
}
impl Layout for EnumElem {
+ #[tracing::instrument(name = "EnumElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/flow.rs b/library/src/layout/flow.rs
index b45c39c2..64d1d509 100644
--- a/library/src/layout/flow.rs
+++ b/library/src/layout/flow.rs
@@ -19,6 +19,7 @@ pub struct FlowElem {
}
impl Layout for FlowElem {
+ #[tracing::instrument(name = "FlowElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -122,6 +123,7 @@ impl<'a> FlowLayouter<'a> {
}
/// Layout vertical spacing.
+ #[tracing::instrument(name = "FlowLayouter::layout_spacing", skip_all)]
fn layout_spacing(&mut self, v: &VElem, styles: StyleChain) {
self.layout_item(match v.amount() {
Spacing::Rel(rel) => FlowItem::Absolute(
@@ -133,6 +135,7 @@ impl<'a> FlowLayouter<'a> {
}
/// Layout a paragraph.
+ #[tracing::instrument(name = "FlowLayouter::layout_par", skip_all)]
fn layout_par(
&mut self,
vt: &mut Vt,
@@ -179,6 +182,7 @@ impl<'a> FlowLayouter<'a> {
}
/// Layout into a single region.
+ #[tracing::instrument(name = "FlowLayouter::layout_single", skip_all)]
fn layout_single(
&mut self,
vt: &mut Vt,
@@ -237,6 +241,7 @@ impl<'a> FlowLayouter<'a> {
}
/// Layout a finished frame.
+ #[tracing::instrument(name = "FlowLayouter::layout_item", skip_all)]
fn layout_item(&mut self, item: FlowItem) {
match item {
FlowItem::Absolute(v, _) => self.regions.size.y -= v,
diff --git a/library/src/layout/grid.rs b/library/src/layout/grid.rs
index 01bf7e30..63183e1d 100644
--- a/library/src/layout/grid.rs
+++ b/library/src/layout/grid.rs
@@ -102,6 +102,7 @@ pub struct GridElem {
}
impl Layout for GridElem {
+ #[tracing::instrument(name = "GridElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -289,6 +290,7 @@ impl<'a, 'v> GridLayouter<'a, 'v> {
}
/// Determines the columns sizes and then layouts the grid row-by-row.
+ #[tracing::instrument(name = "grid layout", skip(self))]
pub fn layout(mut self) -> SourceResult<GridLayout> {
self.measure_columns()?;
diff --git a/library/src/layout/hide.rs b/library/src/layout/hide.rs
index d9bee317..a65616a0 100644
--- a/library/src/layout/hide.rs
+++ b/library/src/layout/hide.rs
@@ -23,6 +23,7 @@ pub struct HideElem {
}
impl Show for HideElem {
+ #[tracing::instrument(name = "HideElem::show", skip(self))]
fn show(&self, _: &mut Vt, _: StyleChain) -> SourceResult<Content> {
Ok(self.body().styled(MetaElem::set_data(vec![Meta::Hide])))
}
diff --git a/library/src/layout/list.rs b/library/src/layout/list.rs
index 6cb1bc7e..c8aeaa06 100644
--- a/library/src/layout/list.rs
+++ b/library/src/layout/list.rs
@@ -112,6 +112,7 @@ pub struct ListElem {
}
impl Layout for ListElem {
+ #[tracing::instrument(name = "ListElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs
index e84e35fc..25014498 100644
--- a/library/src/layout/mod.rs
+++ b/library/src/layout/mod.rs
@@ -68,6 +68,7 @@ pub trait LayoutRoot {
}
impl LayoutRoot for Content {
+ #[tracing::instrument(name = "Content::layout_root", skip_all)]
fn layout_root(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Document> {
#[comemo::memoize]
fn cached(
@@ -87,6 +88,8 @@ impl LayoutRoot for Content {
.layout_root(&mut vt, styles)
}
+ tracing::info!("Starting layout");
+
cached(
self,
vt.world,
@@ -126,6 +129,7 @@ pub trait Layout {
}
impl Layout for Content {
+ #[tracing::instrument(name = "Content::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -151,6 +155,8 @@ impl Layout for Content {
.layout(&mut vt, styles, regions)
}
+ tracing::info!("Layouting `Content`");
+
cached(
self,
vt.world,
@@ -164,6 +170,7 @@ impl Layout for Content {
}
/// Realize into an element that is capable of root-level layout.
+#[tracing::instrument(skip_all)]
fn realize_root<'a>(
vt: &mut Vt,
scratch: &'a Scratch<'a>,
@@ -245,6 +252,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
}
}
+ #[tracing::instrument(skip_all)]
fn accept(
&mut self,
mut content: &'a Content,
@@ -310,6 +318,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
}
}
+ #[tracing::instrument(skip_all)]
fn styled(
&mut self,
elem: &'a Content,
@@ -324,6 +333,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip(self, local, outer))]
fn interrupt_style(
&mut self,
local: &Styles,
@@ -358,6 +368,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip(self))]
fn interrupt_list(&mut self) -> SourceResult<()> {
if !self.list.items.is_empty() {
let staged = mem::take(&mut self.list.staged);
@@ -371,6 +382,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip(self))]
fn interrupt_par(&mut self) -> SourceResult<()> {
self.interrupt_list()?;
if !self.par.0.is_empty() {
@@ -382,6 +394,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip_all)]
fn interrupt_page(&mut self, styles: Option<StyleChain<'a>>) -> SourceResult<()> {
self.interrupt_par()?;
let Some(doc) = &mut self.doc else { return Ok(()) };
diff --git a/library/src/layout/pad.rs b/library/src/layout/pad.rs
index 441aa211..a4e79e36 100644
--- a/library/src/layout/pad.rs
+++ b/library/src/layout/pad.rs
@@ -60,6 +60,7 @@ pub struct PadElem {
}
impl Layout for PadElem {
+ #[tracing::instrument(name = "PadElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/page.rs b/library/src/layout/page.rs
index 0c70282d..7fa0bc5e 100644
--- a/library/src/layout/page.rs
+++ b/library/src/layout/page.rs
@@ -272,7 +272,10 @@ pub struct PageElem {
impl PageElem {
/// Layout the page run into a sequence of frames, one per page.
+ #[tracing::instrument(skip_all)]
pub fn layout(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Fragment> {
+ tracing::info!("Page layout");
+
// When one of the lengths is infinite the page fits its content along
// that axis.
let width = self.width(styles).unwrap_or(Abs::inf());
@@ -330,12 +333,20 @@ impl PageElem {
);
// Realize overlays.
- for frame in &mut fragment {
+ for (i, frame) in fragment.iter_mut().enumerate() {
+ tracing::info!("Layouting page #{i}");
frame.prepend(Point::zero(), numbering_meta.clone());
let size = frame.size();
let pad = padding.resolve(styles).relative_to(size);
let pw = size.x - pad.left - pad.right;
- for marginal in [&header, &footer, &background, &foreground] {
+ for (name, marginal) in [
+ ("header", &header),
+ ("footer", &footer),
+ ("background", &background),
+ ("foreground", &foreground),
+ ] {
+ tracing::info!("Layouting {name}");
+
let Some(content) = marginal else { continue };
let (pos, area, align);
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs
index 8bede473..b186bb19 100644
--- a/library/src/layout/par.rs
+++ b/library/src/layout/par.rs
@@ -126,6 +126,7 @@ impl Construct for ParElem {
impl ParElem {
/// Layout the paragraph into a collection of lines.
+ #[tracing::instrument(name = "ParElement::layout", skip_all)]
pub fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/place.rs b/library/src/layout/place.rs
index 057278df..2a671628 100644
--- a/library/src/layout/place.rs
+++ b/library/src/layout/place.rs
@@ -54,6 +54,7 @@ pub struct PlaceElem {
}
impl Layout for PlaceElem {
+ #[tracing::instrument(name = "PlaceElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/repeat.rs b/library/src/layout/repeat.rs
index 4a05500e..384995a4 100644
--- a/library/src/layout/repeat.rs
+++ b/library/src/layout/repeat.rs
@@ -34,6 +34,7 @@ pub struct RepeatElem {
}
impl Layout for RepeatElem {
+ #[tracing::instrument(name = "RepeatElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/stack.rs b/library/src/layout/stack.rs
index b1f7f59d..80145567 100644
--- a/library/src/layout/stack.rs
+++ b/library/src/layout/stack.rs
@@ -38,6 +38,7 @@ pub struct StackElem {
}
impl Layout for StackElem {
+ #[tracing::instrument(name = "StackElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -161,6 +162,7 @@ impl<'a> StackLayouter<'a> {
}
/// Add spacing along the spacing direction.
+ #[tracing::instrument(name = "StackLayouter::layout_spacing", skip_all)]
fn layout_spacing(&mut self, spacing: Spacing) {
match spacing {
Spacing::Rel(v) => {
@@ -184,6 +186,7 @@ impl<'a> StackLayouter<'a> {
}
/// Layout an arbitrary block.
+ #[tracing::instrument(name = "StackLayouter::layout_block", skip_all)]
fn layout_block(
&mut self,
vt: &mut Vt,
diff --git a/library/src/layout/table.rs b/library/src/layout/table.rs
index acababb8..9ca6a137 100644
--- a/library/src/layout/table.rs
+++ b/library/src/layout/table.rs
@@ -122,6 +122,7 @@ pub struct TableElem {
}
impl Layout for TableElem {
+ #[tracing::instrument(name = "TableElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/terms.rs b/library/src/layout/terms.rs
index 45ba82b5..ecda7668 100644
--- a/library/src/layout/terms.rs
+++ b/library/src/layout/terms.rs
@@ -92,6 +92,7 @@ pub struct TermsElem {
}
impl Layout for TermsElem {
+ #[tracing::instrument(name = "TermsElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
diff --git a/library/src/layout/transform.rs b/library/src/layout/transform.rs
index b57ca41e..2fb9c191 100644
--- a/library/src/layout/transform.rs
+++ b/library/src/layout/transform.rs
@@ -37,6 +37,7 @@ pub struct MoveElem {
}
impl Layout for MoveElem {
+ #[tracing::instrument(name = "MoveElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -105,6 +106,7 @@ pub struct RotateElem {
}
impl Layout for RotateElem {
+ #[tracing::instrument(name = "RotateElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -173,6 +175,7 @@ pub struct ScaleElem {
}
impl Layout for ScaleElem {
+ #[tracing::instrument(name = "ScaleElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,