From 19ab32dd0d8820c1fc8907690347ddef6d621227 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 18 Jul 2025 13:21:45 +0200 Subject: [PATCH] Revert "Minimal tag work" This reverts commit 88c234eb447769772a0c67d6a84d5a6659ecdefd. --- crates/typst-realize/src/lib.rs | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/crates/typst-realize/src/lib.rs b/crates/typst-realize/src/lib.rs index 0ffaa699a..b7a21e789 100644 --- a/crates/typst-realize/src/lib.rs +++ b/crates/typst-realize/src/lib.rs @@ -336,21 +336,6 @@ fn visit_kind_rules<'a>( Ok(false) } -fn visit_with_tags_minimal<'a>( - s: &mut State<'a, '_, '_, '_>, - content: &'a Content, - styles: StyleChain<'a>, -) -> SourceResult<()> { - let mut elem = content.clone(); - let key = typst_utils::hash128(&elem); - let loc = s.locator.next_location(s.engine.introspector, key); - elem.set_location(loc); - visit(s, s.store(TagElem::packed(Tag::Start(elem.clone()))), styles)?; - elem.mark_prepared(); - visit(s, s.store(TagElem::packed(Tag::End(loc, key))), styles)?; - visit(s, s.store(elem), styles) -} - /// Tries to apply show rules to or prepare content. Returns `true` if the /// element was handled. fn visit_show_rules<'a>( @@ -361,12 +346,7 @@ fn visit_show_rules<'a>( // Determines whether and how to proceed with show rule application. let Some(Verdict { prepared, mut map, step }) = verdict(s.engine, content, styles) else { - if !content.is_prepared() && locatable(content) { - visit_with_tags_minimal(s, content, styles)?; - return Ok(true); - } else { - return Ok(false); - } + return Ok(false); }; // Create a fresh copy that we can mutate. @@ -526,7 +506,7 @@ fn verdict<'a>( elem.label().is_none() && elem.location().is_none() && !elem.can::() - && !elem.can::() + && !locatable(elem) && !elem.can::() }) { @@ -555,9 +535,7 @@ fn prepare( // The element could already have a location even if it is not prepared // when it stems from a query. let key = typst_utils::hash128(&elem); - if elem.location().is_none() - && (elem.can::() || elem.label().is_some()) - { + if elem.location().is_none() && (locatable(elem) || elem.label().is_some()) { let loc = locator.next_location(engine.introspector, key); elem.set_location(loc); }