]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use absolute positioning to avoid a scrollbar bug (#8313)
authorLeif Åstrand <leif@vaadin.com>
Thu, 1 Mar 2012 08:39:49 +0000 (10:39 +0200)
committerLeif Åstrand <leif@vaadin.com>
Thu, 1 Mar 2012 08:40:44 +0000 (10:40 +0200)
src/com/vaadin/terminal/gwt/client/ui/RootConnector.java

index fd49fb1cb283d1ca7d0fee1dae2ca42dc220d087..a42b797af835a8595a6c31dedc0f6f1a490c1d71 100644 (file)
@@ -8,6 +8,8 @@ import java.util.Iterator;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Position;
 import com.google.gwt.event.dom.client.DomEvent.Type;
 import com.google.gwt.event.shared.EventHandler;
 import com.google.gwt.event.shared.HandlerRegistration;
@@ -27,7 +29,8 @@ import com.vaadin.terminal.gwt.client.UIDL;
 import com.vaadin.terminal.gwt.client.Util;
 import com.vaadin.terminal.gwt.client.VConsole;
 
-public class RootConnector extends AbstractComponentContainerConnector {
+public class RootConnector extends AbstractComponentContainerConnector
+        implements SimpleManagedLayout {
 
     private static final String CLICK_EVENT_IDENTIFIER = PanelConnector.CLICK_EVENT_IDENTIFIER;
 
@@ -221,8 +224,6 @@ public class RootConnector extends AbstractComponentContainerConnector {
             Window.addResizeHandler(getWidget());
         }
 
-        getWidget().onResize();
-
         // finally set scroll position from UIDL
         if (uidl.hasVariable("scrollTop")) {
             getWidget().scrollable = true;
@@ -316,4 +317,21 @@ public class RootConnector extends AbstractComponentContainerConnector {
         return GWT.create(VView.class);
     }
 
+    public void layout() {
+        ComponentConnector child = getWidget().layout;
+        Style childStyle = child.getWidget().getElement().getStyle();
+        /*
+         * Must set absolute position if the child has relative height and
+         * there's a chance of horizontal scrolling as some browsers will
+         * otherwise not take the scrollbar into account when calculating the
+         * height. Assuming v-view does not have an undefined width for now, see
+         * #8460.
+         */
+        if (child.isRelativeHeight()) {
+            childStyle.setPosition(Position.ABSOLUTE);
+        } else {
+            childStyle.clearPosition();
+        }
+    }
+
 }