diff options
author | Artur Signell <artur.signell@itmill.com> | 2011-01-18 14:52:03 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2011-01-18 14:52:03 +0000 |
commit | 1827aa73c0cfa0b50c103ee90e8a9cd15f36aff5 (patch) | |
tree | b7449581bbe26fbe18c7265344cc48702d453005 /src/com | |
parent | 65610174d8315d761583ae64cf7149e8ff253e55 (diff) | |
download | vaadin-framework-1827aa73c0cfa0b50c103ee90e8a9cd15f36aff5.tar.gz vaadin-framework-1827aa73c0cfa0b50c103ee90e8a9cd15f36aff5.zip |
#3991 Select with icons shown wrong in IE8 upon first render
svn changeset:16934/svn branch:6.5
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/Util.java | 28 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java | 15 |
2 files changed, 30 insertions, 13 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java index e21be19fac..cd8bef0341 100644 --- a/src/com/vaadin/terminal/gwt/client/Util.java +++ b/src/com/vaadin/terminal/gwt/client/Util.java @@ -13,6 +13,7 @@ import java.util.Set; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; +import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Node; @@ -1018,4 +1019,31 @@ public class Util { } } + /** + * Temporarily sets the {@code styleProperty} to {@code tempValue} and then + * resets it to its current value. Used mainly to work around rendering + * issues in IE (and possibly in other browsers) + * + * @param element + * The target element + * @param styleProperty + * The name of the property to set + * @param tempValue + * The temporary value + */ + public static void setStyleTemporarily(Element element, + final String styleProperty, String tempValue) { + final Style style = element.getStyle(); + final String currentValue = style.getProperty(styleProperty); + + style.setProperty(styleProperty, tempValue); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + public void execute() { + style.setProperty(styleProperty, currentValue); + } + }); + + } + } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java index 0d9ba336a1..01d2722c9c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java @@ -817,22 +817,11 @@ public class VFilterSelect extends Composite implements Paintable, Field, public void onLoad(LoadEvent event) { updateRootWidth(); updateSelectedIconPosition(); - /* - * We need to re-calculate the widths in IE at load time to - * ensure that the text is not placed behind the icon. #3991 + * Force IE to recalculate the position of the text (#3991) */ if (BrowserInfo.get().isIE()) { - int tbWidth = Util.getRequiredWidth(tb); - int openerWidth = Util.getRequiredWidth(popupOpener); - int iconWidth = selectedItemIcon.isAttached() ? Util - .measureMarginLeft(tb.getElement()) - - Util.measureMarginLeft(selectedItemIcon - .getElement()) : 0; - - int w = tbWidth + openerWidth + iconWidth; - tb.setWidth((tbWidth - getTextboxPadding()) + "px"); - setTextboxWidth(w); + Util.setStyleTemporarily(tb.getElement(), "paddingLeft", "0"); } } }); |