diff options
author | Felype Santiago Ferreira <felype@vaadin.com> | 2013-10-23 11:23:02 +0300 |
---|---|---|
committer | Felype Santiago Ferreira <felype@vaadin.com> | 2013-10-23 11:59:41 +0300 |
commit | 51a46a038fe0353f4babfd8218153eb68e2602ca (patch) | |
tree | cda1af0404939c1f6a11fab6af16fbd17a4c8d50 /client | |
parent | ee809e5985d7a438e031c40bed160ac78ae8d0bc (diff) | |
download | vaadin-framework-51a46a038fe0353f4babfd8218153eb68e2602ca.tar.gz vaadin-framework-51a46a038fe0353f4babfd8218153eb68e2602ca.zip |
Recovering scroll position after regression problems. (#12727)
The fix for "Panels get unnecessary scroll bars in WebKit when content is 100% wide (#12727)" introduced side effects to #6731. This fix solves the problem.
Change-Id: I15ca926c0ee4cad49e9eea0c578c9cc73c850588
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VPanel.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/VPanel.java b/client/src/com/vaadin/client/ui/VPanel.java index 1a87362fea..15c3883b11 100644 --- a/client/src/com/vaadin/client/ui/VPanel.java +++ b/client/src/com/vaadin/client/ui/VPanel.java @@ -218,7 +218,7 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, * Don't touch it unless you know what you're doing! Fixes ticket * #12727. * - * This solution comes from ticket #11994: Windows get unnecessary + * This solution comes from the ticket #11994: Windows get unnecessary * scroll bars in WebKit when content is 100% wide. */ if (BrowserInfo.get().isWebkit()) { @@ -227,6 +227,10 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, public void execute() { final com.google.gwt.dom.client.Element scrollable = contentNode .getFirstChildElement(); + + int contentNodeScrollTop = contentNode.getScrollTop(); + int contentNodeScrollLeft = contentNode.getScrollLeft(); + final String oldWidth = scrollable.getStyle().getWidth(); final String oldHeight = scrollable.getStyle().getHeight(); @@ -237,9 +241,12 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, scrollable.getStyle().setHeight(110, Unit.PCT); scrollable.getOffsetHeight(); scrollable.getStyle().setProperty("height", oldHeight); + + // Recovering scroll position: + contentNode.setScrollTop(contentNodeScrollTop); + contentNode.setScrollLeft(contentNodeScrollLeft); } }); } - } } |