From c8a4ca73ac23373683cab03cb8aa46ca5ea6fa7c Mon Sep 17 00:00:00 2001 From: Automerge Date: Thu, 10 May 2012 13:07:21 +0000 Subject: [PATCH] [merge from 6.7] Tweaks to #7931 based on review. svn changeset:23708/svn branch:6.8 --- .../vaadin/terminal/gwt/client/ui/VView.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java index 8f8a6ab4b3..d500c56e52 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java @@ -61,10 +61,18 @@ public class VView extends SimplePanel implements Container, ResizeHandler, private 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; @@ -146,6 +154,13 @@ public class VView extends SimplePanel implements Container, 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"); connection.runDescendentsLayout(VView.this); Util.runWebkitOverflowAutoFix(getElement()); @@ -493,8 +508,9 @@ public class VView extends SimplePanel implements Container, 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) { -- 2.39.5