From 7202709339d0676cd21269920cdcd7cffe90af53 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Mon, 25 Feb 2008 14:56:20 +0000 Subject: [PATCH] workaround for random table collapses in IE svn changeset:3920/svn branch:trunk --- .../terminal/gwt/client/ui/IScrollTable.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java index bcfbafb44f..2074aa1562 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java @@ -122,6 +122,12 @@ public class IScrollTable extends Composite implements Table, ScrollListener, /** flag to indicate that table body has changed */ private boolean isNewBody = true; + /** + * Stores old height for IE, that sometimes fails to return correct height + * for container element. Then this value is used as a fallback. + */ + private int oldAvailPixels; + public IScrollTable() { bodyContainer.addScrollListener(this); @@ -2046,14 +2052,25 @@ public class IScrollTable extends Composite implements Table, ScrollListener, // workaround very common 100% height problem - extract borders if (height.equals("100%")) { final int borders = getBorderSpace(); - final Element elem = getElement(); - final Element parentElem = DOM.getParent(elem); + final Element parentElem = DOM.getParent(getElement()); // put table away from flow for a moment DOM.setStyleAttribute(getElement(), "position", "absolute"); // get containers natural space for table - final int availPixels = DOM.getElementPropertyInt(parentElem, + int availPixels = DOM.getElementPropertyInt(parentElem, "offsetHeight"); + if (Util.isIE()) { + if (availPixels == 0) { + // In complex layouts IE sometimes rather randomly returns 0 + // although container really has height. Use old value if + // one exits. + if (oldAvailPixels > 0) { + availPixels = oldAvailPixels; + } + } else { + oldAvailPixels = availPixels; + } + } // put table back to flow DOM.setStyleAttribute(getElement(), "position", "static"); // set 100% height with borders -- 2.39.5