aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2011-12-05 14:33:59 +0000
committerLeif Åstrand <leif@vaadin.com>2011-12-05 14:33:59 +0000
commit5a55a5b71943a7095679d9c627023176c0415e06 (patch)
tree34b8073fb0d999ed549599c5e2ae42a7cadc8d3b /src/com/vaadin
parent8343130d2baf9b047305d60c5ee4a551ee81946d (diff)
downloadvaadin-framework-5a55a5b71943a7095679d9c627023176c0415e06.tar.gz
vaadin-framework-5a55a5b71943a7095679d9c627023176c0415e06.zip
#3915 ChildComponentContainer fails to calculate width of its child widget properly in IE7 if the child has borders
svn changeset:22234/svn branch:6.7
Diffstat (limited to 'src/com/vaadin')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java b/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java
index bcb972ca6a..5786dc421a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java
@@ -9,6 +9,8 @@ import java.util.NoSuchElementException;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.BorderStyle;
import com.google.gwt.dom.client.TableElement;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
@@ -222,6 +224,36 @@ public class ChildComponentContainer extends Panel {
* does not include
*/
int w = Util.getRequiredWidth(widgetDIV);
+
+ // IE7 ignores the width of the content if there's a border (#3915)
+ if (BrowserInfo.get().isIE7()) {
+ // Also read the inner width of the target element
+ int clientWidth = widget.getElement().getClientWidth();
+
+ // If the widths are different, there might be a border involved and
+ // then the width should be calculated without borders
+ if (w != clientWidth) {
+ // Remember old border style and remove current border
+ Style style = widget.getElement().getStyle();
+ String oldBorderStyle = style.getBorderStyle();
+ style.setBorderStyle(BorderStyle.NONE);
+
+ // Calculate width without borders
+ int newWidth = Util.getRequiredWidth(widgetDIV);
+
+ // Restore old border style
+ style.setProperty("borderStyle", oldBorderStyle);
+
+ // Borders triggered the bug if the element is wider without
+ // borders
+ if (newWidth > w) {
+ // Use new measured width + the border width calculated as
+ // the difference between previous inner and outer widths
+ w = newWidth + (w - clientWidth);
+ }
+ }
+ }
+
int h = Util.getRequiredHeight(widgetDIV);
widgetSize.setWidth(w);