From 6c022dea386fb30752cbe116d0264146f07bb4ba Mon Sep 17 00:00:00 2001 From: Ferhat Date: Mon, 4 May 2020 08:46:21 -0700 Subject: [PATCH] [web] Remove left/top/transform reset since all code paths now set ltwh (flutter/engine#17867) * [web] Remove left/top/transform reset since all code paths now set ltwh * Remove unused style var * Handle path=null , address review comments * Added comment for reset code --- .../lib/web_ui/lib/src/engine/surface/clip.dart | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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; }