diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/surface/clip.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/surface/clip.dart index 46529c65a30..71a6cf3afb1 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/surface/clip.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/surface/clip.dart @@ -325,16 +325,18 @@ class PersistedPhysicalShape extends PersistedContainerSurface } if (oldSurface.path != path) { oldSurface._clipElement?.remove(); - // Reset style on prior element since we may have switched between - // rect/rrect and arbitrary path. - final html.CssStyleDeclaration style = rootElement.style; - style.transform = ''; - style.left = ''; - style.top = ''; - style.borderRadius = ''; domRenderer.setElementStyle(rootElement, 'clip-path', ''); domRenderer.setElementStyle(rootElement, '-webkit-clip-path', ''); _applyShape(); + // This null check is in update since we don't want to unnecessarily + // clear style in apply on first build. + if (path == null) { + // Reset style on prior element when path becomes null. + final html.CssStyleDeclaration style = rootElement.style; + style.left = ''; + style.top = ''; + style.borderRadius = ''; + } } else { _clipElement = oldSurface._clipElement; }