aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2020-03-09 16:54:13 +0200
committerGitHub <noreply@github.com>2020-03-09 16:54:13 +0200
commit932bc470aee35fd80afd5bb9054b4392948dccb3 (patch)
treeb2e39498f0420c280f04334cd2397b249dc16bb2 /client
parent3397e396dcebb797006f1c4ae8186ea0d422a5f7 (diff)
downloadvaadin-framework-932bc470aee35fd80afd5bb9054b4392948dccb3.tar.gz
vaadin-framework-932bc470aee35fd80afd5bb9054b4392948dccb3.zip
Trigger re-measure after updating ElementResizeListeners. (#11912)
Removing ElementResizeListeners from an element makes it unmeasurable and clears any saved measured values. Adding the listeners back makes the element measurable again but doesn't add it to measuring queue. Measuring needs to happen or any updates to expanded components within a layout (without changes that would trigger full re-measuring of the layout itself) lead to broken expand size calculations with any fixed size elements assumed to have no size. Fixes #10734
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
index 5fd8c766b6..20073c468e 100644
--- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
@@ -570,11 +570,13 @@ public abstract class AbstractOrderedLayoutConnector
}
// Add all necessary listeners
+ boolean listenersAdded = false;
if (needsFixedHeight()) {
slot.setWidgetResizeListener(childComponentResizeListener);
if (slot.hasCaption()) {
slot.setCaptionResizeListener(slotCaptionResizeListener);
}
+ listenersAdded = true;
} else if ((hasChildrenWithRelativeHeight
|| hasChildrenWithRelativeWidth) && slot.hasCaption()) {
/*
@@ -586,6 +588,7 @@ public abstract class AbstractOrderedLayoutConnector
* as the relative size?
*/
slot.setCaptionResizeListener(slotCaptionResizeListener);
+ listenersAdded = true;
}
if (needsExpand()) {
@@ -594,6 +597,13 @@ public abstract class AbstractOrderedLayoutConnector
if (slot.hasSpacing()) {
slot.setSpacingResizeListener(spacingResizeListener);
}
+ listenersAdded = true;
+ }
+
+ if (listenersAdded) {
+ // removing these listeners makes widget unmeasurable and resets the
+ // measured height, measure again if listeners got added back
+ getLayoutManager().setNeedsMeasure(child);
}
}