From c44cad36ff48991ca7b09df61308ecaa8a39d427 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Tue, 20 Mar 2012 15:16:43 +0200 Subject: [PATCH] Take negative margin into account when calculating footer height (#8540) --- .../terminal/gwt/client/LayoutManager.java | 18 +++++++++++++++++- .../terminal/gwt/client/ui/FormConnector.java | 6 ++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/LayoutManager.java b/src/com/vaadin/terminal/gwt/client/LayoutManager.java index 891f145efb..a593754c17 100644 --- a/src/com/vaadin/terminal/gwt/client/LayoutManager.java +++ b/src/com/vaadin/terminal/gwt/client/LayoutManager.java @@ -358,6 +358,22 @@ public class LayoutManager { } public int getPaddingRight(Element element) { - return getMeasuredSize(element, null).getPaddingRight(); + return getMeasuredSize(element, nullSize).getPaddingRight(); + } + + public int getMarginTop(Element element) { + return getMeasuredSize(element, nullSize).getMarginTop(); + } + + public int getMarginRight(Element element) { + return getMeasuredSize(element, nullSize).getMarginRight(); + } + + public int getMarginBottom(Element element) { + return getMeasuredSize(element, nullSize).getMarginBottom(); + } + + public int getMarginLeft(Element element) { + return getMeasuredSize(element, nullSize).getMarginLeft(); } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java b/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java index 05db22e6ae..ff3950f37d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java @@ -12,6 +12,7 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.ComponentState; import com.vaadin.terminal.gwt.client.ConnectorMap; +import com.vaadin.terminal.gwt.client.LayoutManager; import com.vaadin.terminal.gwt.client.UIDL; public class FormConnector extends AbstractComponentContainerConnector @@ -171,8 +172,9 @@ public class FormConnector extends AbstractComponentContainerConnector public void layout() { VForm form = getWidget(); - int footerHeight = getLayoutManager().getOuterHeight( - form.footerContainer); + LayoutManager lm = getLayoutManager(); + int footerHeight = lm.getOuterHeight(form.footerContainer) + - lm.getMarginTop(form.footerContainer); form.fieldContainer.getStyle().setPaddingBottom(footerHeight, Unit.PX); form.footerContainer.getStyle().setMarginTop(-footerHeight, Unit.PX); -- 2.39.5