[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
This commit is contained in:
Ferhat 2020-05-04 08:46:21 -07:00 committed by GitHub
parent a28b4235ee
commit 6c022dea38

View File

@ -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;
}