summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-24 18:32:51 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-24 18:32:51 +0200
commitacdde6d3266d4158241c2e62aa88a1185a3016fd (patch)
treeb9a6759a8ac8bba71bed39bc260370f23a4769a7 /src/model
parent18511686f3fffdae8f4ce15074416ea7d28a3273 (diff)
Remove `unscoped` hack
Diffstat (limited to 'src/model')
-rw-r--r--src/model/content.rs13
-rw-r--r--src/model/styles.rs15
2 files changed, 9 insertions, 19 deletions
diff --git a/src/model/content.rs b/src/model/content.rs
index ff10de5d..8b76c795 100644
--- a/src/model/content.rs
+++ b/src/model/content.rs
@@ -7,8 +7,8 @@ use std::ops::{Add, AddAssign};
use typed_arena::Arena;
use super::{
- CollapsingBuilder, Interruption, Key, Layout, LayoutNode, Property, Show, ShowNode,
- StyleEntry, StyleMap, StyleVecBuilder, Target,
+ Barrier, CollapsingBuilder, Interruption, Key, Layout, LayoutNode, Property, Show,
+ ShowNode, StyleEntry, StyleMap, StyleVecBuilder, Target,
};
use crate::diag::StrResult;
use crate::library::layout::{FlowChild, FlowNode, PageNode, PlaceNode, Spacing};
@@ -424,9 +424,14 @@ impl<'a, 'ctx> Builder<'a, 'ctx> {
}
fn show(&mut self, node: &ShowNode, styles: StyleChain<'a>) -> TypResult<()> {
- if let Some(realized) = styles.apply(self.ctx, Target::Node(node))? {
+ if let Some(mut realized) = styles.apply(self.ctx, Target::Node(node))? {
+ let mut map = StyleMap::new();
+ let barrier = Barrier::new(node.id());
+ map.push(StyleEntry::Barrier(barrier));
+ map.push(StyleEntry::Barrier(barrier));
+ realized = realized.styled_with_map(map);
let stored = self.scratch.templates.alloc(realized);
- self.accept(stored, styles.unscoped(node.id()))?;
+ self.accept(stored, styles)?;
}
Ok(())
}
diff --git a/src/model/styles.rs b/src/model/styles.rs
index 5c36861a..82194792 100644
--- a/src/model/styles.rs
+++ b/src/model/styles.rs
@@ -263,21 +263,6 @@ impl<'a> StyleChain<'a> {
Self { head: &root.0, tail: None }
}
- /// Return the chain, but without trailing scoped properties for the given
- /// `node`.
- pub fn unscoped(mut self, node: NodeId) -> Self {
- while self
- .head
- .last()
- .and_then(StyleEntry::property)
- .map_or(false, |p| p.scoped && p.node == node)
- {
- let len = self.head.len();
- self.head = &self.head[.. len - 1]
- }
- self
- }
-
/// Get the output value of a style property.
///
/// Returns the property's default value if no map in the chain contains an