Set<Container> parents = new HashSet<Container>();
for (Widget widget : widgets) {
-/* ApplicationConnection.getConsole().log(
- "Size changed for widget: "
- + widget.toString().split(">")[0]);
-*/
Widget parent = widget.getParent();
while (parent != null && !(parent instanceof Container)) {
parent = parent.getParent();
/*-{
return element.cloneNode(deep);
}-*/;
+
+ public static int measureHorizontalPadding(Element element, int paddingGuess) {
+ String originalWidth = DOM.getStyleAttribute(element, "width");
+ int originalOffsetWidth = element.getOffsetWidth();
+ int widthGuess = (originalOffsetWidth + paddingGuess);
+ DOM.setStyleAttribute(element, "width", widthGuess + "px");
+ int padding = widthGuess - element.getOffsetWidth();
+
+ DOM.setStyleAttribute(element, "width", originalWidth);
+ return padding;
+ }
+
+ public static void setWidthExcludingPadding(Element element,
+ int requestedWidth, int paddingGuess) {
+
+ int widthGuess = requestedWidth - paddingGuess;
+ if (widthGuess < 0) {
+ widthGuess = 0;
+ }
+
+ DOM.setStyleAttribute(element, "width", widthGuess + "px");
+ int captionOffsetWidth = DOM.getElementPropertyInt(element,
+ "offsetWidth");
+
+ int actualPadding = captionOffsetWidth - widthGuess;
+
+ if (actualPadding != paddingGuess) {
+ DOM.setStyleAttribute(element, "width", requestedWidth
+ - actualPadding + "px");
+
+ }
+
+ }
+
}
public void iLayout(boolean runGeckoFix) {
- // IE6 width fix
- if (BrowserInfo.get().isIE6()) {
- int captionOffsetWidth = DOM.getElementPropertyInt(captionNode,
- "offsetWidth");
- int borderWidthGuess = 200;
- int widthGuess = captionOffsetWidth - borderWidthGuess;
- if (widthGuess < 0) {
- widthGuess = 0;
- }
- DOM.setStyleAttribute(contentNode, "width", widthGuess + "px");
-
- int actualBorder = DOM.getElementPropertyInt(contentNode,
- "offsetWidth")
- - widthGuess;
- if (actualBorder != borderWidthGuess) {
- int realWidthIncludingBorder = captionOffsetWidth
- - actualBorder;
- if (realWidthIncludingBorder < 0) {
- realWidthIncludingBorder = 0;
- }
- DOM.setStyleAttribute(contentNode, "width",
- realWidthIncludingBorder + "px");
- }
+ if (BrowserInfo.get().isIE6() && width != null && !width.equals("")) {
+ /*
+ * IE6 requires overflow-hidden elements to have a width specified
+ */
+ /*
+ * Fixes #1923 IPanel: Horizontal scrollbar does not appear in IE6
+ * with wide content
+ */
+
+ /*
+ * Caption must be shrunk for parent measurements to return correct
+ * result in IE6
+ */
+ DOM.setStyleAttribute(captionNode, "width", "1px");
+
+ int parentPadding = Util.measureHorizontalPadding(getElement(), 0);
+
+ int parentWidthExcludingPadding = getElement().getOffsetWidth()
+ - parentPadding;
+
+ int captionMarginLeft = captionNode.getAbsoluteLeft()
+ - getElement().getAbsoluteLeft();
+ Util.setWidthExcludingPadding(captionNode,
+ parentWidthExcludingPadding - captionMarginLeft, 26);
+
+ int contentMarginLeft = contentNode.getAbsoluteLeft()
+ - getElement().getAbsoluteLeft();
+
+ Util.setWidthExcludingPadding(contentNode,
+ parentWidthExcludingPadding - contentMarginLeft, 2);
+
}
if (height != null && height != "") {