]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #5091
authorJohn Alhroos <john.ahlroos@itmill.com>
Tue, 29 Jun 2010 14:08:28 +0000 (14:08 +0000)
committerJohn Alhroos <john.ahlroos@itmill.com>
Tue, 29 Jun 2010 14:08:28 +0000 (14:08 +0000)
svn changeset:13966/svn branch:6.4

src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java

index e7ea12a1ed27d6e12ae39e1bb1c092ec57177bef..1e31dffb6e28e2b288d6d4fd473a3c7ac0bed911 100644 (file)
@@ -195,12 +195,21 @@ public class VRichTextArea extends Composite implements Paintable, Field,
         if (height == null || height.equals("")) {
             rta.setHeight("");
         } else {
-            int editorHeight = getOffsetHeight() - getExtraVerticalPixels()
-                    - formatter.getOffsetHeight();
-            if (editorHeight < 0) {
-                editorHeight = 0;
-            }
-            rta.setHeight(editorHeight + "px");
+            /*
+             * The formatter height will be initially calculated wrong so we
+             * delay the height setting so the DOM has had time to stabilize.
+             */
+            DeferredCommand.addCommand(new Command() {
+                public void execute() {
+                    int editorHeight = getOffsetHeight()
+                            - getExtraVerticalPixels()
+                            - formatter.getOffsetHeight();
+                    if (editorHeight < 0) {
+                        editorHeight = 0;
+                    }
+                    rta.setHeight(editorHeight + "px");
+                }
+            });
         }
     }