From fc4aeac8b43bb3f200b25a997ade05075592ee90 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Wed, 17 Apr 2013 17:17:39 +0300 Subject: Fixed IE8 scrollbar issue with vertical layout when using both expansions and alignments #11169 Change-Id: Ia62db30e4e7f9bd02966db31b3bb691a1a60e58d --- .../ui/orderedlayout/VAbstractOrderedLayout.java | 16 ++++++-- .../VerticalLayoutSlotExpansionAndAlignment.html | 26 +++++++++++++ .../VerticalLayoutSlotExpansionAndAlignment.java | 45 ++++++++++++++++++++++ 3 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html create mode 100644 uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java diff --git a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index 93176f67bb..d8b0888936 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -29,6 +29,7 @@ import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.RequiresResize; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.LayoutManager; import com.vaadin.client.Util; import com.vaadin.shared.ui.MarginInfo; @@ -411,10 +412,19 @@ public class VAbstractOrderedLayout extends FlowPanel { } else { // Non-relative child without expansion should be unconstrained - if (vertical) { - slotStyle.clearHeight(); + if (BrowserInfo.get().isIE8()) { + // unconstrained in IE8 is auto + if (vertical) { + slot.setHeight("auto"); + } else { + slot.setWidth("auto"); + } } else { - slotStyle.clearWidth(); + if (vertical) { + slotStyle.clearHeight(); + } else { + slotStyle.clearWidth(); + } } } } diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html new file mode 100644 index 0000000000..e0b17ec8cf --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html @@ -0,0 +1,26 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + +
New Test
openrun/com.vaadin.tests.layouts.VerticalLayoutSlotExpansionAndAlignment?restartApplication
screenCaptureno-scrollbars
+ + diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java new file mode 100644 index 0000000000..bba8ccf120 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.layouts; + +import com.vaadin.annotations.Theme; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.Reindeer; + +@SuppressWarnings("serial") +public class VerticalLayoutSlotExpansionAndAlignment extends UI { + + @Override + protected void init(VaadinRequest request) { + + VerticalLayout layout = new VerticalLayout(); + layout.setSizeFull(); + setContent(layout); + + HorizontalLayout header = new HorizontalLayout(new Label("HEADER")); + header.setHeight("100px"); + header.setWidth("100%"); + header.setStyleName(Reindeer.LAYOUT_WHITE); + layout.addComponent(header); + + HorizontalLayout content = new HorizontalLayout(new Label("CONTENT")); + content.setSizeFull(); + content.setStyleName(Reindeer.LAYOUT_BLUE); + layout.addComponent(content); + + HorizontalLayout footer = new HorizontalLayout(new Label("FOOTER")); + footer.setHeight("150px"); + footer.setWidth("100%"); + footer.setStyleName(Reindeer.LAYOUT_BLACK); + layout.addComponent(footer); + + // This break things + layout.setComponentAlignment(footer, Alignment.BOTTOM_LEFT); + layout.setExpandRatio(content, 1); + + } + +} \ No newline at end of file -- cgit v1.2.3