diff options
7 files changed, 160 insertions, 8 deletions
diff --git a/WebContent/VAADIN/themes/base/layout/layout.scss b/WebContent/VAADIN/themes/base/layout/layout.scss index e085abcc60..d49b2ad0dd 100644 --- a/WebContent/VAADIN/themes/base/layout/layout.scss +++ b/WebContent/VAADIN/themes/base/layout/layout.scss @@ -37,6 +37,7 @@ TODO .v-verticallayout, .v-horizontallayout { font-size: 0; + line-height: normal; } .v-gridlayout.v-layout-margin-bottom { diff --git a/WebContent/VAADIN/themes/reindeer/accordion/accordion.scss b/WebContent/VAADIN/themes/reindeer/accordion/accordion.scss index 77fe1c0b9a..8f032f34aa 100644 --- a/WebContent/VAADIN/themes/reindeer/accordion/accordion.scss +++ b/WebContent/VAADIN/themes/reindeer/accordion/accordion.scss @@ -10,7 +10,7 @@ background-color: #fff; } .#{$primaryStyleName}-item-caption { - height: 19px; + height: 20px; background: #e4e4e4 repeat-x; background-image: url(../tabsheet/img/tabbar-bg.png); /** sprite-ref: verticals; sprite-alignment: repeat */ font-size: 11px; @@ -28,6 +28,7 @@ .#{$primaryStyleName}-item-first .#{$primaryStyleName}-item-caption { border-top: none; + height: 21px; } .#{$primaryStyleName}-item-caption .v-caption { padding: 3px 0 3px 10px; diff --git a/WebContent/VAADIN/themes/runo/tabsheet/tabsheet.scss b/WebContent/VAADIN/themes/runo/tabsheet/tabsheet.scss index cb32136086..3b8773e9e6 100644 --- a/WebContent/VAADIN/themes/runo/tabsheet/tabsheet.scss +++ b/WebContent/VAADIN/themes/runo/tabsheet/tabsheet.scss @@ -117,7 +117,7 @@ } .#{$primaryStyleName}-deco:before { display: block; - + content: ""; width: 9px; height: 9px; margin-left: -9px; diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index e0389c260d..6947b14d9d 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -561,7 +561,58 @@ public class Util { notifyParentOfSizeChange(widget, false); } - public static native int getRequiredWidth( + /** + * Gets the border-box width for the given element, i.e. element width + + * border + padding. Always rounds up to nearest integer. + * + * @param element + * The element to check + * @return The border-box width for the element + */ + public static int getRequiredWidth(com.google.gwt.dom.client.Element element) { + int reqWidth = getRequiredWidthBoundingClientRect(element); + if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) { + int csSize = getRequiredWidthComputedStyle(element); + if (csSize == reqWidth + 1) { + // If computed style reports one pixel larger than requiredWidth + // we would be rounding in the wrong direction in IE9. Round up + // instead. + // We do not always use csSize as it e.g. for 100% wide Labels + // in GridLayouts produces senseless values (see e.g. + // ThemeTestUI with Runo). + return csSize; + } + } + return reqWidth; + } + + /** + * Gets the border-box height for the given element, i.e. element height + + * border + padding. Always rounds up to nearest integer. + * + * @param element + * The element to check + * @return The border-box height for the element + */ + public static int getRequiredHeight( + com.google.gwt.dom.client.Element element) { + int reqHeight = getRequiredHeightBoundingClientRect(element); + if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) { + int csSize = getRequiredHeightComputedStyle(element); + if (csSize == reqHeight + 1) { + // If computed style reports one pixel larger than + // requiredHeight we would be rounding in the wrong direction in + // IE9. Round up instead. + // We do not always use csSize as it e.g. for 100% wide Labels + // in GridLayouts produces senseless values (see e.g. + // ThemeTestUI with Runo). + return csSize; + } + } + return reqHeight; + } + + public static native int getRequiredWidthBoundingClientRect( com.google.gwt.dom.client.Element element) /*-{ if (element.getBoundingClientRect) { @@ -572,7 +623,39 @@ public class Util { } }-*/; - public static native int getRequiredHeight( + public static native int getRequiredHeightComputedStyle( + com.google.gwt.dom.client.Element element) + /*-{ + var cs = element.ownerDocument.defaultView.getComputedStyle(element); + var heightPx = cs.height; + var borderTopPx = cs.borderTop; + var borderBottomPx = cs.borderBottom; + var paddingTopPx = cs.paddingTop; + var paddingBottomPx = cs.paddingBottom; + + var height = heightPx.substring(0,heightPx.length-2); + var border = borderTopPx.substring(0,borderTopPx.length-2)+borderBottomPx.substring(0,borderBottomPx.length-2); + var padding = paddingTopPx.substring(0,paddingTopPx.length-2)+paddingBottomPx.substring(0,paddingBottomPx.length-2); + return Math.ceil(height+border+padding); + }-*/; + + public static native int getRequiredWidthComputedStyle( + com.google.gwt.dom.client.Element element) + /*-{ + var cs = element.ownerDocument.defaultView.getComputedStyle(element); + var widthPx = cs.width; + var borderLeftPx = cs.borderLeft; + var borderRightPx = cs.borderRight; + var paddingLeftPx = cs.paddingLeft; + var paddingRightPx = cs.paddingRight; + + var width = widthPx.substring(0,widthPx.length-2); + var border = borderLeftPx.substring(0,borderLeftPx.length-2)+borderRightPx.substring(0,borderRightPx.length-2); + var padding = paddingLeftPx.substring(0,paddingLeftPx.length-2)+paddingRightPx.substring(0,paddingRightPx.length-2); + return Math.ceil(width+border+padding); + }-*/; + + public static native int getRequiredHeightBoundingClientRect( com.google.gwt.dom.client.Element element) /*-{ var height; @@ -1070,9 +1153,8 @@ public class Util { } return null; - }-*/ - ; - + }-*/; + /** * Gets the currently focused element for Internet Explorer. * diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index 6d3f2365e2..e39742b2fa 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -748,7 +748,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, // style inheritance) if (ComponentStateUtil.hasStyles(state)) { final List<String> styles = state.styles; - if (!currentStyle.equals(styles.toString())) { + if (currentStyle == null || !currentStyle.equals(styles.toString())) { currentStyle = styles.toString(); final String tabsBaseClass = TABS_CLASSNAME; String tabsClass = tabsBaseClass; diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/EXtraScrollbarsInTabSheet.html b/uitest/src/com/vaadin/tests/components/tabsheet/EXtraScrollbarsInTabSheet.html new file mode 100755 index 0000000000..4287eaa05b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/EXtraScrollbarsInTabSheet.html @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.tabsheet.ExtraScrollbarsInTabSheet?restartApplication</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>no-scrollbars</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java new file mode 100755 index 0000000000..2917eccbfb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java @@ -0,0 +1,41 @@ +package com.vaadin.tests.components.tabsheet;
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Runo;
+
+@Theme("runo")
+public class ExtraScrollbarsInTabSheet extends UI {
+
+ @Override
+ public void init(VaadinRequest request) {
+
+ VerticalLayout vl = new VerticalLayout();
+ vl.setSizeFull();
+
+ HorizontalSplitPanel horizontalSplit = new HorizontalSplitPanel();
+
+ TabSheet ts = new TabSheet();
+
+ VerticalLayout tabContent = new VerticalLayout();
+ tabContent.setSizeFull();
+
+ Panel p = new Panel();
+ p.addStyleName(Runo.PANEL_LIGHT);
+ p.setHeight("400px");
+ tabContent.addComponent(p);
+
+ ts.addTab(tabContent);
+ horizontalSplit.setSecondComponent(ts);
+
+ vl.addComponent(horizontalSplit);
+
+ setContent(vl);
+
+ }
+
+}
|