summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 7803c747..5e4e020e 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -13,10 +13,11 @@ pub use tree::*;
use crate::geom::{Insets, Point, Rect, RectExt, Sides, Size, SizeExt};
+use crate::diag::Diag;
use crate::eval::{PageState, State, TextState};
use crate::font::SharedFontLoader;
use crate::shaping::Shaped;
-use crate::syntax::SynTree;
+use crate::syntax::{Deco, Spanned, SynTree};
use crate::{Feedback, Pass};
/// Layout a syntax tree and return the produced layout.
@@ -98,6 +99,18 @@ pub struct LayoutContext {
pub f: Feedback,
}
+impl LayoutContext {
+ /// Add a diagnostic to the feedback.
+ pub fn diag(&mut self, diag: Spanned<Diag>) {
+ self.f.diags.push(diag);
+ }
+
+ /// Add a decoration to the feedback.
+ pub fn deco(&mut self, deco: Spanned<Deco>) {
+ self.f.decos.push(deco);
+ }
+}
+
/// The constraints for layouting a single node.
#[derive(Debug, Clone)]
pub struct LayoutConstraints {