diff options
author | Artur Signell <artur@vaadin.com> | 2013-11-06 15:11:34 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-11-06 15:27:19 +0200 |
commit | 2e3e877e1bf99bbaf89d5dc45625ab44322c20e0 (patch) | |
tree | 7b3681db59bcd341201271feff1f127b054db023 /client | |
parent | c351b6464a6154205a8bd6f79880df968df68777 (diff) | |
download | vaadin-framework-2e3e877e1bf99bbaf89d5dc45625ab44322c20e0.tar.gz vaadin-framework-2e3e877e1bf99bbaf89d5dc45625ab44322c20e0.zip |
Fix scroll position handling in Window Webkit hack (#12736)
Change-Id: If4d17c34b2d20ad983f21b892d3ab4c68f511780
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VWindow.java | 10 |
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(); } |