summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-05-20 20:59:55 +0300
committerVaadin Code Review <review@vaadin.com>2015-06-11 14:59:38 +0000
commit21427ab2a60da967c489d6cc86bf9d89eb02412a (patch)
tree267d24d80f3337d2b493f085ffc670b8cdda1cc0 /server
parent40bfdbf83d2e622aa826c8b66f3e2ad7d29ddb6b (diff)
downloadvaadin-framework-21427ab2a60da967c489d6cc86bf9d89eb02412a.tar.gz
vaadin-framework-21427ab2a60da967c489d6cc86bf9d89eb02412a.zip
Render nested invalid layouts correctly (#17598)
Change-Id: I959d62091f79c171a8c9f2c9b4ed2c7a67c65c39
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/ComponentSizeValidator.java41
1 files changed, 36 insertions, 5 deletions
diff --git a/server/src/com/vaadin/server/ComponentSizeValidator.java b/server/src/com/vaadin/server/ComponentSizeValidator.java
index 2d88ae3b53..1fbd840932 100644
--- a/server/src/com/vaadin/server/ComponentSizeValidator.java
+++ b/server/src/com/vaadin/server/ComponentSizeValidator.java
@@ -415,7 +415,7 @@ public class ComponentSizeValidator implements Serializable {
// main window, valid situation
return true;
}
- if (parent.getHeight() < 0) {
+ if (isEffectiveUndefinedHeight(component)) {
// Undefined height
if (parent instanceof Window) {
// Sub window with undefined size has a min-height
@@ -513,10 +513,7 @@ public class ComponentSizeValidator implements Serializable {
// Sub window with undefined size has a min-width
return true;
}
-
- if (parent.getWidth() < 0) {
- // Undefined width
-
+ if (isEffectiveUndefinedWidth(parent)) {
if (parent instanceof AbstractOrderedLayout) {
AbstractOrderedLayout ol = (AbstractOrderedLayout) parent;
boolean horizontal = true;
@@ -591,6 +588,40 @@ public class ComponentSizeValidator implements Serializable {
}
+ /**
+ * Checks if this component will be rendered with undefined width, either
+ * because it has been set to undefined wide or because the parent forces it
+ * to be (100% inside undefined)
+ *
+ */
+ private static boolean isEffectiveUndefinedWidth(Component parent) {
+ if (parent == null) {
+ return false;
+ } else if (parent.getWidth() < 0) {
+ return true;
+ } else if (parent.getWidthUnits() == Unit.PERCENTAGE) {
+ return isEffectiveUndefinedWidth(parent.getParent());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if this component will be rendered with undefined Height, either
+ * because it has been set to undefined wide or because the parent forces it
+ * to be (100% inside undefined)
+ *
+ */
+ private static boolean isEffectiveUndefinedHeight(Component parent) {
+ if (parent == null) {
+ return false;
+ } else if (parent.getHeight() < 0) {
+ return true;
+ } else if (parent.getHeightUnits() == Unit.PERCENTAGE) {
+ return isEffectiveUndefinedHeight(parent.getParent());
+ }
+ return false;
+ }
+
private static boolean hasNonRelativeWidthComponent(Form form) {
Layout layout = form.getLayout();
Layout footer = form.getFooter();