summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VWindow.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java
index 396169eb8c..73b57c7e5b 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -360,6 +360,12 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
public void execute() {
final com.google.gwt.dom.client.Element scrollable = contents
.getFirstChildElement();
+
+ // Adjusting the width or height may change the scroll
+ // position, so store the current position
+ int horizontalScrollPosition = scrollable.getScrollLeft();
+ int verticalScrollPosition = scrollable.getScrollTop();
+
final String oldWidth = scrollable.getStyle().getWidth();
final String oldHeight = scrollable.getStyle().getHeight();
@@ -371,6 +377,10 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
scrollable.getOffsetHeight();
scrollable.getStyle().setProperty("height", oldHeight);
+ // Restore the scroll position
+ scrollable.setScrollLeft(horizontalScrollPosition);
+ scrollable.setScrollTop(verticalScrollPosition);
+
updateContentsSize();
positionOrSizeUpdated();
}