diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-11 13:42:57 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-11 13:42:57 +0300 |
commit | ffe9c0414589fde6229bd282197081ba0b94d0ff (patch) | |
tree | d02fe7f2c2e9e4bdaf3f0b34e908d64c0289eac7 /src/com | |
parent | 729eeff844ab96f179e7828876377d7f65cd2c9d (diff) | |
parent | c8a4ca73ac23373683cab03cb8aa46ca5ea6fa7c (diff) | |
download | vaadin-framework-ffe9c0414589fde6229bd282197081ba0b94d0ff.tar.gz vaadin-framework-ffe9c0414589fde6229bd282197081ba0b94d0ff.zip |
Merge commit 'c8a4ca'
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java b/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java index e43d001f32..9db0220470 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java +++ b/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java @@ -47,10 +47,18 @@ public class VRoot extends SimplePanel implements ResizeHandler, ShortcutActionHandler actionHandler; - /** stored size for IE resize optimization */ + /* + * Last known window size used to detect whether VView should be layouted + * again. Detection must be based on window size, because the VView size + * might be fixed and thus not automatically adapt to changed window sizes. + */ private int windowWidth; private int windowHeight; + /* + * Last know view size used to detect whether new dimensions should be sent + * to the server. + */ private int viewWidth; private int viewHeight; @@ -170,6 +178,13 @@ public class VRoot extends SimplePanel implements ResizeHandler, VConsole.log("New window height: " + windowHeight); } if (changed) { + /* + * If the window size has changed, layout the VView again and send + * new size to the server if the size changed. (Just checking VView + * size would cause us to ignore cases when a relatively sized VView + * should shrink as the content's size is fixed and would thus not + * automatically shrink.) + */ VConsole.log("Running layout functions due to window resize"); sendClientResized(); @@ -287,8 +302,9 @@ public class VRoot extends SimplePanel implements ResizeHandler, * Send new dimensions to the server. */ private void sendClientResized() { - int newViewHeight = getElement().getClientHeight(); - int newViewWidth = getElement().getClientWidth(); + Element parentElement = getElement().getParentElement(); + int newViewHeight = parentElement.getClientHeight(); + int newViewWidth = parentElement.getClientWidth(); // Send the view dimensions if they have changed if (newViewHeight != viewHeight || newViewWidth != viewWidth) { |