final boolean hasChildren = getWidget() != null;
Element contentEl = null;
String origPositioning = null;
+ // save scroll position
+ int scrollTop = DOM.getElementPropertyInt(contentNode, "scrollTop");
+ int scrollLeft = DOM.getElementPropertyInt(contentNode,
+ "scrollLeft");
if (hasChildren) {
// Remove children temporary form normal flow to detect proper
// size
origPositioning = DOM.getStyleAttribute(contentEl, "position");
DOM.setStyleAttribute(contentEl, "position", "absolute");
}
+
// Set defaults
DOM.setStyleAttribute(contentNode, "overflow", "hidden");
DOM.setStyleAttribute(contentNode, "height", "");
"positioning:" + origPositioning);
DOM.setStyleAttribute(contentEl, "position", origPositioning);
}
+ // restore scroll position
+ DOM.setElementPropertyInt(contentNode, "scrollTop", scrollTop);
+ DOM.setElementPropertyInt(contentNode, "scrollLeft", scrollLeft);
+
} else {
DOM.setStyleAttribute(contentNode, "height", "");
}
public void iLayout() {
if (height != null && height != "") {
+ // save scroll position
+ int scrollTop = DOM.getElementPropertyInt(contentNode, "scrollTop");
+ int scrollLeft = DOM.getElementPropertyInt(contentNode,
+ "scrollLeft");
// Take content out of flow for a while
final String originalPositioning = DOM.getStyleAttribute(tp
.getElement(), "position");
DOM.setStyleAttribute(tp.getElement(), "position",
originalPositioning);
DOM.setStyleAttribute(contentNode, "overflow", "auto");
+ // restore scroll position
+ DOM.setElementPropertyInt(contentNode, "scrollTop", scrollTop);
+ DOM.setElementPropertyInt(contentNode, "scrollLeft", scrollLeft);
} else {
tp.setHeight("");
}