diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-02 15:25:43 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-02-02 15:25:43 +0100 |
| commit | 0a1916c1e4259aff1306b26c06d4edcf0f190a3b (patch) | |
| tree | 8ab81f034dd8b392b368691a2d55349f5c798d85 /src/layout/mod.rs | |
| parent | bdb1c008f2cee7c3929b671d9407d2b578182199 (diff) | |
Remove width from backlog and last region
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 147e8c9d..ebdfba0e 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -200,6 +200,7 @@ impl PackedNode { } impl Layout for PackedNode { + #[track_caller] fn layout( &self, ctx: &mut LayoutContext, @@ -219,8 +220,12 @@ impl Layout for PackedNode { state.finish() }; + // This is not written with `unwrap_or_else`, because then the + // #[track_caller] annotation doesn't work. #[cfg(feature = "layout-cache")] - ctx.layout_cache.get(hash, regions).unwrap_or_else(|| { + if let Some(frames) = ctx.layout_cache.get(hash, regions) { + frames + } else { ctx.level += 1; let frames = self.node.layout(ctx, regions, styles); ctx.level -= 1; @@ -240,7 +245,7 @@ impl Layout for PackedNode { ctx.layout_cache.insert(hash, entry); frames - }) + } } fn pack(self) -> PackedNode { |
