From be8e2da2a3d5d866185c99d4e57fd46d4b53d3e9 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 11 Mar 2010 15:38:43 +0000 Subject: [PATCH] Fix for #3407 - Sub window higher than the browser window produces extra scrollbars for a relative sized child Additional test case for #3407 svn changeset:11797/svn branch:6.3 --- .../terminal/gwt/client/ui/VWindow.java | 9 ++++++ .../window/ExtraLargeSubWindow.java | 32 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java diff --git a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java index 0cae63b8ca..78a9b9eda5 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java @@ -438,12 +438,15 @@ public class VWindow extends VOverlay implements Container, ScrollListener { updateShadowSizeAndPosition(); + boolean sizeReduced = false; // ensure window is not larger than browser window if (getOffsetWidth() > Window.getClientWidth()) { setWidth(Window.getClientWidth() + "px"); + sizeReduced = true; } if (getOffsetHeight() > Window.getClientHeight()) { setHeight(Window.getClientHeight() + "px"); + sizeReduced = true; } if (dynamicHeight && layoutRelativeHeight) { @@ -461,6 +464,12 @@ public class VWindow extends VOverlay implements Container, ScrollListener { client.updateVariable(id, "width", w, true); } + if (sizeReduced) { + // If we changed the size we need to update the size of the child + // component if it is relative (#3407) + client.runDescendentsLayout(this); + } + Util.runWebkitOverflowAutoFix(contentPanel.getElement()); } diff --git a/tests/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java b/tests/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java new file mode 100644 index 0000000000..bcaa44dc76 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.Window; + +public class ExtraLargeSubWindow extends TestBase { + + @Override + protected void setup() { + Window w = new Window("full sized window"); + w.setWidth("2000px"); + w.setHeight("2000px"); + w.getContent().setSizeFull(); + NativeButton b = new NativeButton("A large button"); + b.setSizeFull(); + w.addComponent(b); + + getMainWindow().addWindow(w); + } + + @Override + protected String getDescription() { + return "A 100%x100% sub window should not produce scrollbars in the main view or in the sub window. The button inside the sub window is 100%x100%, as is the layout"; + } + + @Override + protected Integer getTicketNumber() { + return 3407; + } + +} -- 2.39.5