aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-11-06 15:11:34 +0200
committerArtur Signell <artur@vaadin.com>2013-11-06 15:35:02 +0200
commit6674580cc54b1071551f41ecc43a63290123fe77 (patch)
tree3b2be83b6219e4c40c498f25e906bda2e2e82577
parent6d558565c2b87a1b900f5a9178eb0910e63a18f4 (diff)
downloadvaadin-framework-6674580cc54b1071551f41ecc43a63290123fe77.tar.gz
vaadin-framework-6674580cc54b1071551f41ecc43a63290123fe77.zip
Fix scroll position handling in Window Webkit hack (#12736)
Change-Id: If4d17c34b2d20ad983f21b892d3ab4c68f511780
-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 ff6a15e597..f167ca5c23 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -357,6 +357,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();
@@ -368,6 +374,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();
}