summaryrefslogtreecommitdiff
path: root/src/model/styles.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-09-20 13:05:55 +0200
committerLaurenz <laurmaedje@gmail.com>2022-09-20 16:37:15 +0200
commit757a701c1aa2a6fb80033c7e75666661818da6f9 (patch)
tree0415fec94d3856f4ebc97a1744cf2ba75fe8e7aa /src/model/styles.rs
parente29f55bb294cc298daad97accf6d8a76976b409c (diff)
A New World
Diffstat (limited to 'src/model/styles.rs')
-rw-r--r--src/model/styles.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/model/styles.rs b/src/model/styles.rs
index eab33402..53ef926c 100644
--- a/src/model/styles.rs
+++ b/src/model/styles.rs
@@ -8,7 +8,7 @@ use crate::diag::TypResult;
use crate::frame::Role;
use crate::library::text::{FontFamily, TextNode};
use crate::util::ReadableTypeId;
-use crate::Context;
+use crate::World;
/// A map of style properties.
#[derive(Default, Clone, PartialEq, Hash)]
@@ -277,7 +277,7 @@ impl<'a> StyleChain<'a> {
}
/// Apply show recipes in this style chain to a target.
- pub fn apply(self, ctx: &mut Context, target: Target) -> TypResult<Option<Content>> {
+ pub fn apply(self, world: &dyn World, target: Target) -> TypResult<Option<Content>> {
// Find out how many recipes there any and whether any of their patterns
// match.
let mut n = 0;
@@ -296,7 +296,9 @@ impl<'a> StyleChain<'a> {
let sel = Selector::Nth(n);
if self.guarded(sel) {
guarded = true;
- } else if let Some(content) = recipe.apply(ctx, self, sel, target)? {
+ } else if let Some(content) =
+ recipe.apply(world, self, sel, target)?
+ {
realized = Some(content);
break;
}
@@ -312,7 +314,7 @@ impl<'a> StyleChain<'a> {
if self.guarded(sel) {
guarded = true;
} else {
- let content = node.unguard(sel).realize(ctx, self)?;
+ let content = node.unguard(sel).realize(world, self)?;
realized = Some(content.styled_with_entry(StyleEntry::Guard(sel)));
}
}
@@ -320,7 +322,7 @@ impl<'a> StyleChain<'a> {
// Finalize only if guarding didn't stop any recipe.
if !guarded {
if let Some(content) = realized {
- realized = Some(node.finalize(ctx, self, content)?);
+ realized = Some(node.finalize(world, self, content)?);
}
}
}