aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-07-16 00:20:26 +0300
committerpatrik <patrik@vaadin.com>2015-08-05 12:27:54 +0300
commit4f3533115bae0acd251405a1c70feb8c62756c2f (patch)
treedd4b839c3ac603425604a24885d28dc819d7c675 /client
parentb23eea7f24fed638386c919f591b8455e2e775c3 (diff)
downloadvaadin-framework-4f3533115bae0acd251405a1c70feb8c62756c2f.tar.gz
vaadin-framework-4f3533115bae0acd251405a1c70feb8c62756c2f.zip
Take margin/border/padding into account when measuring TabSheet (#18471)
Change-Id: Id9aba32d5f2564961f167261a4fac2a3621e3583
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ComputedStyle.java51
-rw-r--r--client/src/com/vaadin/client/ui/VTabsheet.java10
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;
}