From f2f473a81fde9c09e0f361f1b85fb5c14337f360 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 23 Feb 2022 16:46:44 +0100 Subject: [PATCH] Query cache --- src/eval/layout.rs | 6 ++-- src/eval/show.rs | 5 ++- src/export/render.rs | 24 +++++++++------ src/lib.rs | 73 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 13 deletions(-) diff --git a/src/eval/layout.rs b/src/eval/layout.rs index 1090aafc9..38ad39771 100644 --- a/src/eval/layout.rs +++ b/src/eval/layout.rs @@ -221,8 +221,10 @@ impl Layout for LayoutNode { regions: &Regions, styles: StyleChain, ) -> TypResult>> { - // TODO(query) - self.0.layout(ctx, regions, styles.barred(self.id())) + ctx.query((self, regions, styles), |ctx, (node, regions, styles)| { + node.0.layout(ctx, regions, styles.barred(node.id())) + }) + .clone() } fn pack(self) -> LayoutNode { diff --git a/src/eval/show.rs b/src/eval/show.rs index b0fb8172e..a85c70e27 100644 --- a/src/eval/show.rs +++ b/src/eval/show.rs @@ -43,7 +43,10 @@ impl ShowNode { impl Show for ShowNode { fn show(&self, ctx: &mut Context, styles: StyleChain) -> TypResult