diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-11-03 16:17:17 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-11-03 16:17:17 +0000 |
commit | 94036207dbd7441254bc3ff9bc9a203a33ad819c (patch) | |
tree | 8260949e29c38fa5a6f6ea4383c1b13bccfb14c4 /src | |
parent | 7165b1d6601b32a6b258f6309f5aa4293bf5f4d5 (diff) | |
download | vaadin-framework-94036207dbd7441254bc3ff9bc9a203a33ad819c.tar.gz vaadin-framework-94036207dbd7441254bc3ff9bc9a203a33ad819c.zip |
fixes #2898, value updates now deferred to help FF optimizations
svn changeset:9606/svn branch:6.2
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VTextField.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java index 4403aede35..cccb0a26be 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java @@ -10,7 +10,9 @@ import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.TextBoxBase; @@ -110,13 +112,32 @@ public class VTextField extends TextBoxBase implements Paintable, Field, : null; setPrompting(inputPrompt != null && focusedTextField != this && (text == null || text.equals(""))); + + final String fieldValue; if (prompting) { - setText(inputPrompt); + fieldValue = inputPrompt; addStyleDependentName(CLASSNAME_PROMPT); } else { - setText(text); + fieldValue = text; removeStyleDependentName(CLASSNAME_PROMPT); } + if (BrowserInfo.get().isGecko()) { + /* + * Gecko is really sluggish when updating input attached to dom. + * Some optimizations seems to work much better in Gecko if we + * update the actual content lazily when the rest of the DOM has + * stabilized. In tests, about ten times better performance is + * achieved with this optimization. See for eg. #2898 + */ + DeferredCommand.addCommand(new Command() { + public void execute() { + setText(fieldValue); + } + }); + } else { + setText(fieldValue); + } + valueBeforeEdit = uidl.getStringVariable("text"); } |