]> source.dussan.org Git - vaadin-framework.git/commitdiff
Backported fix and test case for #3407
authorArtur Signell <artur.signell@itmill.com>
Thu, 11 Mar 2010 15:43:17 +0000 (15:43 +0000)
committerArtur Signell <artur.signell@itmill.com>
Thu, 11 Mar 2010 15:43:17 +0000 (15:43 +0000)
svn changeset:11798/svn branch:6.2

src/com/vaadin/terminal/gwt/client/ui/VWindow.java
tests/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java [new file with mode: 0644]

index 0cae63b8ca63c4221605160562bc29b8eea9659b..78a9b9eda52878c5a3806ca5a635ef45ee0049fb 100644 (file)
@@ -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 (file)
index 0000000..bcaa44d
--- /dev/null
@@ -0,0 +1,32 @@
+package com.vaadin.tests.components.window;\r
+\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.NativeButton;\r
+import com.vaadin.ui.Window;\r
+\r
+public class ExtraLargeSubWindow extends TestBase {\r
+\r
+    @Override\r
+    protected void setup() {\r
+        Window w = new Window("full sized window");\r
+        w.setWidth("2000px");\r
+        w.setHeight("2000px");\r
+        w.getContent().setSizeFull();\r
+        NativeButton b = new NativeButton("A large button");\r
+        b.setSizeFull();\r
+        w.addComponent(b);\r
+\r
+        getMainWindow().addWindow(w);\r
+    }\r
+\r
+    @Override\r
+    protected String getDescription() {\r
+        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";\r
+    }\r
+\r
+    @Override\r
+    protected Integer getTicketNumber() {\r
+        return 3407;\r
+    }\r
+\r
+}\r