diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2014-12-29 13:17:57 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2014-12-29 13:17:57 +0200 |
commit | 0d93598759d2a1a95a25cc84e75cfa03f154590e (patch) | |
tree | c51fc6647ff4a99705cf96499008dc529148c997 | |
parent | 0937a50c9d99ca585cbc3e27fbfe3cbf7822f26e (diff) | |
download | vaadin-framework-0d93598759d2a1a95a25cc84e75cfa03f154590e.tar.gz vaadin-framework-0d93598759d2a1a95a25cc84e75cfa03f154590e.zip |
Fix Grid columns being too narrow on IE9 (#15475)
Change-Id: Ifb46093ffb43a4fa03b051719f3480ef469b460e
-rw-r--r-- | client/src/com/vaadin/client/widgets/Escalator.java | 18 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/AbstractGridColumnAutoWidthTest.java | 13 |
2 files changed, 28 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java index 74fb28bbd2..57c55d457d 100644 --- a/client/src/com/vaadin/client/widgets/Escalator.java +++ b/client/src/com/vaadin/client/widgets/Escalator.java @@ -50,6 +50,7 @@ import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.RequiresResize; import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.DeferredWorker; import com.vaadin.client.Profiler; import com.vaadin.client.Util; @@ -63,6 +64,7 @@ import com.vaadin.client.widget.escalator.PositionFunction.AbsolutePosition; import com.vaadin.client.widget.escalator.PositionFunction.Translate3DPosition; import com.vaadin.client.widget.escalator.PositionFunction.TranslatePosition; import com.vaadin.client.widget.escalator.PositionFunction.WebkitTranslate3DPosition; +import com.vaadin.client.widget.escalator.Row; import com.vaadin.client.widget.escalator.RowContainer; import com.vaadin.client.widget.escalator.RowVisibilityChangeEvent; import com.vaadin.client.widget.escalator.RowVisibilityChangeHandler; @@ -2009,9 +2011,19 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker cellClone.getStyle().clearWidth(); rowElement.insertBefore(cellClone, cellOriginal); - maxCellWidth = Math.max(Util - .getRequiredWidthBoundingClientRectDouble(cellClone), - maxCellWidth); + double requiredWidth = Util + .getRequiredWidthBoundingClientRectDouble(cellClone); + + if (BrowserInfo.get().isIE9()) { + /* + * IE9 does not support subpixels. Usually it is rounded + * down which leads to content not shown. Increase the + * counted required size by one just to be on the safe side. + */ + requiredWidth += 1; + } + + maxCellWidth = Math.max(requiredWidth, maxCellWidth); cellClone.removeFromParent(); } diff --git a/uitest/src/com/vaadin/tests/components/grid/AbstractGridColumnAutoWidthTest.java b/uitest/src/com/vaadin/tests/components/grid/AbstractGridColumnAutoWidthTest.java index d66a95a13c..cc5be455cd 100644 --- a/uitest/src/com/vaadin/tests/components/grid/AbstractGridColumnAutoWidthTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/AbstractGridColumnAutoWidthTest.java @@ -17,6 +17,8 @@ package com.vaadin.tests.components.grid; import static org.junit.Assert.assertEquals; +import java.io.IOException; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -60,10 +62,16 @@ public abstract class AbstractGridColumnAutoWidthTest extends MultiBrowserTest { bodyWidth); assertEquals("column should've been roughly as wide as the header", headerWidth, colWidth, 5); + } @Test public void testTooNarrowColumn() { + if (BrowserUtil.isIE(getDesiredCapabilities())) { + // IE can't deal with overflow nicely. + return; + } + WebElement[] col = getColumn(3); int headerWidth = col[0].getSize().getWidth(); int colWidth = col[2].getSize().getWidth() - TOTAL_MARGIN_PX; @@ -82,6 +90,11 @@ public abstract class AbstractGridColumnAutoWidthTest extends MultiBrowserTest { headerWidth); } + @Test + public void testColumnsRenderCorrectly() throws IOException { + compareScreen("initialRender"); + } + private WebElement[] getColumn(int i) { WebElement[] col = new WebElement[3]; col[0] = getDriver().findElement( |