diff --git a/render-wasm/src/shapes/modifiers.rs b/render-wasm/src/shapes/modifiers.rs index d0db679cf7..123bbd9336 100644 --- a/render-wasm/src/shapes/modifiers.rs +++ b/render-wasm/src/shapes/modifiers.rs @@ -379,8 +379,22 @@ pub fn propagate_modifiers( modifiers: &[TransformEntry], pixel_precision: bool, ) -> Vec { + // Ids of all shapes that have an entry in the incoming modifiers list. + let modifier_ids: HashSet = modifiers.iter().map(|e| e.id).collect(); let mut entries: VecDeque<_> = modifiers .iter() + .filter(|entry| { + // Skip child shapes whose parent is also in the modifiers list. + // Those children will get their transform when the parent's transform + // is propagated via propagate_children; including them here would + // cause the transform to be applied twice (once here, once from parent). + let should_skip = state + .shapes + .get(&entry.id) + .and_then(|s| s.parent_id.map(|pid| modifier_ids.contains(&pid))) + .unwrap_or(false); + !should_skip + }) .map(|entry| { // If we receibe a identity matrix we force a reflow if math::identitish(&entry.transform) { @@ -423,7 +437,6 @@ pub fn propagate_modifiers( ), } } - for id in layout_reflows.iter() { if reflown.contains(id) { continue;