summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-09-26 09:37:16 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-09-26 09:37:16 +0000
commit4af1aabba837639e9356f352510f9c40d07ece66 (patch)
tree8c2bb5766ba13fbac0f44da2f82f1ad970e6ca49
parent01f54432226bd04bc37c5b587d2e8692c00142d1 (diff)
downloadvaadin-framework-4af1aabba837639e9356f352510f9c40d07ece66.tar.gz
vaadin-framework-4af1aabba837639e9356f352510f9c40d07ece66.zip
fixes #2091. Issues with gecko and orizontal expand layout.
svn changeset:5523/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IExpandLayout.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IExpandLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IExpandLayout.java
index 6ac56770eb..a3f4d4aa63 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IExpandLayout.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IExpandLayout.java
@@ -420,6 +420,22 @@ public class IExpandLayout extends ComplexPanel implements
final WidgetWrapper wr = getWidgetWrapperFor(expandedWidget);
wr.setExpandedSize(spaceForExpandedWidget);
+ /*
+ * Workaround for issue #2093. Gecko base brosers have some rounding
+ * issues every now and then. If all elements didn't fit on same row,
+ * decrease expanded space until they do.
+ */
+ if (orientationMode == ORIENTATION_HORIZONTAL
+ && BrowserInfo.get().isGecko()) {
+ int tries = 0;
+ while (tries < 30
+ && spaceForExpandedWidget > EXPANDED_ELEMENTS_MIN_WIDTH
+ && isLastElementDropped()) {
+ spaceForExpandedWidget--;
+ wr.setExpandedSize(spaceForExpandedWidget);
+ }
+ }
+
// setting overflow auto lazy off during layout function
DOM.setStyleAttribute(DOM.getParent(expandedWidget.getElement()),
"overflow", "hidden");
@@ -433,6 +449,18 @@ public class IExpandLayout extends ComplexPanel implements
}
+ /**
+ * Helper method to build workaround for Gecko issue.
+ *
+ * @return true if last element has dropped to another line
+ */
+ private boolean isLastElementDropped() {
+ int firstTop = DOM.getAbsoluteTop(DOM.getFirstChild(childContainer));
+ int lastTop = DOM.getAbsoluteTop(DOM.getChild(childContainer,
+ (getWidgetCount() - 1)));
+ return firstTop != lastTop;
+ }
+
private int getTopMargin() {
if (topMargin < 0) {
topMargin = DOM.getElementPropertyInt(childContainer, "offsetTop")