I am guessing that when the stack expands, the dynamic content is not attached to the stack, or not yet fully populated to have a correct height (the expand method on the Stack class uses the scroll height). If you collapse the stack and then expanded it the second time, and the stack resizes correctly, that will prove the stack did not get the content's scroll height right the first time. Try adding the method to the stack class and call it once the dynamic content is fully poluated (at least when the height is figured out), and see if it helps any.
public void resize() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Utils.Console(_content.getElement().getScrollHeight() - _content.getElement().getOffsetHeight() + "px");
_content.setHeight(_content.getElement().getScrollHeight() - _content.getElement().getOffsetHeight()+ "px");
}
});
}