diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-03-11 15:38:43 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-03-11 15:38:43 +0000 |
commit | be8e2da2a3d5d866185c99d4e57fd46d4b53d3e9 (patch) | |
tree | b3832ac2b7cd587f46dbe1bcd0cdc02259d842f8 | |
parent | 222a4f869a754a9f8c1294045423809f299886b9 (diff) | |
download | vaadin-framework-be8e2da2a3d5d866185c99d4e57fd46d4b53d3e9.tar.gz vaadin-framework-be8e2da2a3d5d866185c99d4e57fd46d4b53d3e9.zip |
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
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VWindow.java | 9 | ||||
-rw-r--r-- | tests/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java | 32 |
2 files changed, 41 insertions, 0 deletions
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;
+ }
+
+}
|