aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-01-20 21:08:33 +0000
committerArtur Signell <artur.signell@itmill.com>2009-01-20 21:08:33 +0000
commit2cc86a51ba523e655b559f5009ca24a7d0a15146 (patch)
treeea6553719c9d57c872739b2be224df1b87eaa000 /src
parent66e3979916159b4eff5df16972e5e57c22fe91bc (diff)
downloadvaadin-framework-2cc86a51ba523e655b559f5009ca24a7d0a15146.tar.gz
vaadin-framework-2cc86a51ba523e655b559f5009ca24a7d0a15146.zip
Fix for #2483 - Changed the way ICaption calculates required space to fix Firefox caption wrapping issue
svn changeset:6606/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ICaption.java58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java b/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java
index 96cf81ea87..66d0789f27 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java
@@ -289,17 +289,17 @@ public class ICaption extends HTML {
int width = 0;
if (icon != null) {
- width += icon.getOffsetWidth();
+ width += Util.getRequiredWidth(icon.getElement());
}
if (captionText != null) {
- width += captionText.getOffsetWidth();
+ width += Util.getRequiredWidth(captionText);
}
if (requiredFieldIndicator != null) {
- width += requiredFieldIndicator.getOffsetWidth();
+ width += Util.getRequiredWidth(requiredFieldIndicator);
}
if (errorIndicatorElement != null) {
- width += errorIndicatorElement.getOffsetWidth();
+ width += Util.getRequiredWidth(errorIndicatorElement);
}
return width;
@@ -310,16 +310,28 @@ public class ICaption extends HTML {
int width = 0;
if (icon != null) {
- width += icon.getOffsetWidth();
+ width += Util.getRequiredWidth(icon.getElement());
}
if (captionText != null) {
- width += captionText.getScrollWidth();
+ int textWidth = captionText.getScrollWidth();
+ if (BrowserInfo.get().isFF3()) {
+ /*
+ * In Firefox3 the caption might require more space than the
+ * scrollWidth returns as scrollWidth is rounded down.
+ */
+ int requiredWidth = Util.getRequiredWidth(captionText);
+ if (requiredWidth > textWidth) {
+ textWidth = requiredWidth;
+ }
+
+ }
+ width += textWidth;
}
if (requiredFieldIndicator != null) {
- width += requiredFieldIndicator.getScrollWidth();
+ width += Util.getRequiredWidth(requiredFieldIndicator);
}
if (errorIndicatorElement != null) {
- width += errorIndicatorElement.getScrollWidth();
+ width += Util.getRequiredWidth(errorIndicatorElement);
}
return width;
@@ -386,17 +398,11 @@ public class ICaption extends HTML {
// DOM.setStyleAttribute(getElement(), "width", maxWidth + "px");
if (requiredFieldIndicator != null) {
- // ApplicationConnection.getConsole().log(
- // "requiredFieldIndicator width: "
- // + requiredFieldIndicator.getOffsetWidth());
- availableWidth -= requiredFieldIndicator.getOffsetWidth();
+ availableWidth -= Util.getRequiredWidth(requiredFieldIndicator);
}
if (errorIndicatorElement != null) {
- // ApplicationConnection.getConsole().log(
- // "errorIndicatorElement width: "
- // + errorIndicatorElement.getOffsetWidth());
- availableWidth -= errorIndicatorElement.getOffsetWidth();
+ availableWidth -= Util.getRequiredWidth(errorIndicatorElement);
}
if (availableWidth < 0) {
@@ -404,28 +410,22 @@ public class ICaption extends HTML {
}
if (icon != null) {
- if (availableWidth > icon.getOffsetWidth()) {
- // ApplicationConnection.getConsole().log(
- // "icon width: " + icon.getOffsetWidth());
- availableWidth -= icon.getOffsetWidth();
+ int iconRequiredWidth = Util
+ .getRequiredWidth(icon.getElement());
+ if (availableWidth > iconRequiredWidth) {
+ availableWidth -= iconRequiredWidth;
} else {
- // ApplicationConnection.getConsole().log(
- // "icon forced width: " + availableWidth);
DOM.setStyleAttribute(icon.getElement(), "width",
availableWidth + "px");
availableWidth = 0;
}
}
if (captionText != null) {
- if (availableWidth > captionText.getOffsetWidth()) {
- // ApplicationConnection.getConsole().log(
- // "captionText width: "
- // + captionText.getOffsetWidth());
- availableWidth -= captionText.getOffsetWidth();
+ int captionWidth = Util.getRequiredWidth(captionText);
+ if (availableWidth > captionWidth) {
+ availableWidth -= captionWidth;
} else {
- // ApplicationConnection.getConsole().log(
- // "captionText forced width: " + availableWidth);
DOM.setStyleAttribute(captionText, "width", availableWidth
+ "px");
availableWidth = 0;