diff options
author | Artur Signell <artur@vaadin.com> | 2015-07-16 00:20:26 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-08-04 18:02:24 +0300 |
commit | f6d075df5207e02b3e96a35943c022c2c2f29bc1 (patch) | |
tree | 362417b7a63831d794fac8c81addbf178d386227 /client | |
parent | 50e13188aa372b0ad50c7279bcb3f18706897c23 (diff) | |
download | vaadin-framework-f6d075df5207e02b3e96a35943c022c2c2f29bc1.tar.gz vaadin-framework-f6d075df5207e02b3e96a35943c022c2c2f29bc1.zip |
Take margin/border/padding into account when measuring TabSheet (#18471)
Change-Id: Id6fed9155128ed9134b3d4949b80fc605e5ae62f
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ComputedStyle.java | 51 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VTabsheet.java | 10 |
2 files changed, 59 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ComputedStyle.java b/client/src/com/vaadin/client/ComputedStyle.java index b11ba4b26a..1391a84bfe 100644 --- a/client/src/com/vaadin/client/ComputedStyle.java +++ b/client/src/com/vaadin/client/ComputedStyle.java @@ -280,4 +280,55 @@ public class ComputedStyle { return parseFloat(value); }-*/; + /** + * Returns the sum of the top and bottom border width + * + * @since + * @return the sum of the top and bottom border + */ + public double getBorderHeight() { + double borderHeight = getDoubleProperty("borderTopWidth"); + borderHeight += getDoubleProperty("borderBottomWidth"); + + return borderHeight; + } + + /** + * Returns the sum of the left and right border width + * + * @since + * @return the sum of the left and right border + */ + public double getBorderWidth() { + double borderWidth = getDoubleProperty("borderLeftWidth"); + borderWidth += getDoubleProperty("borderRightWidth"); + + return borderWidth; + } + + /** + * Returns the sum of the top and bottom padding + * + * @since + * @return the sum of the top and bottom padding + */ + public double getPaddingHeight() { + double paddingHeight = getDoubleProperty("paddingTop"); + paddingHeight += getDoubleProperty("paddingBottom"); + + return paddingHeight; + } + + /** + * Returns the sum of the top and bottom padding + * + * @since + * @return the sum of the left and right padding + */ + public double getPaddingWidth() { + double paddingWidth = getDoubleProperty("paddingLeft"); + paddingWidth += getDoubleProperty("paddingRight"); + + return paddingWidth; + } } diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index ded9977f5e..e196870348 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -61,11 +61,12 @@ import com.google.gwt.user.client.ui.impl.FocusImpl; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ComputedStyle; import com.vaadin.client.Focusable; import com.vaadin.client.TooltipInfo; -import com.vaadin.client.WidgetUtil; import com.vaadin.client.VCaption; import com.vaadin.client.VTooltip; +import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.ComponentConstants; @@ -1227,8 +1228,13 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware public void updateContentNodeHeight() { if (!isDynamicHeight()) { int contentHeight = getOffsetHeight(); - contentHeight -= DOM.getElementPropertyInt(deco, "offsetHeight"); + contentHeight -= deco.getOffsetHeight(); contentHeight -= tb.getOffsetHeight(); + + ComputedStyle cs = new ComputedStyle(contentNode); + contentHeight -= Math.ceil(cs.getPaddingHeight()); + contentHeight -= Math.ceil(cs.getBorderHeight()); + if (contentHeight < 0) { contentHeight = 0; } |