From c8e04dc5b30f8967c58df928872ca2e5e2be5c5b Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Fri, 18 Dec 2020 13:16:26 +0200 Subject: Fix to LayoutManager size calculations during transform. (#12138) * Fix to LayoutManager size calculations during transform. - ComputedStyle is slower but more reliable than using getBoundingClientRect, which does not work as expected if a transform has been applied to the element or one of its parents. This is a problem e.g. with PopupView, where getBoundingClientRect will return too small size (or even zero size) for all the popup contents while the opening animation is active. ComputedStyle ignores the transform and returns the expected value. - The presence of the element in DOM must be checked before the size is requested from ComputedStyle, if the element has disappeared from DOM without a warning and calculation is attempted anyway, the browser gets stuck. - Possibility to configure LayoutManager to use the less reliable calculations for applications where the slight performance difference is more important than layout issues within elements that have transform animations. - Manual test, problem isn't reproducible by TestBench. Fixes: #11187 --- shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'shared/src') diff --git a/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java b/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java index 90269a8b09..3b8f1d0a46 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java @@ -85,13 +85,22 @@ public class UIState extends AbstractSingleComponentContainerState { // Default is 1 for legacy reasons tabIndex = 1; } - /** * Enable Mobile HTML5 DnD support. * * @since 8.1 */ public boolean enableMobileHTML5DnD = false; + /** + * Should the more thorough size check be in use in LayoutManager + * calculations. If this value is changed to {@code false}, the size + * calculations can result in incorrect values if they are triggered while a + * transform animation is ongoing. This can happen e.g. when a PopupView is + * opened. + * + * @since + */ + public boolean thoroughSizeCheck = true; public static class LoadingIndicatorConfigurationState implements Serializable { -- cgit v1.2.3