Program: 66328
Project: 66328
Buggy source:
/** 
 * @see org.eclipse.draw2d.AbstractLayout#calculatePreferredSize(IFigure,int,int)
 */
protected Dimension calculatePreferredSize(IFigure container,int wHint,int hHint){
  if (wHint > -1)   wHint=Math.max(0,wHint - container.getInsets().getWidth());
  if (hHint > -1)   hHint=Math.max(0,hHint - container.getInsets().getHeight());
  int maxWidth;
  maxWidth=wHint;
  hHint=-1;
  if (maxWidth < 0) {
    maxWidth=Integer.MAX_VALUE;
  }
  Dimension prefSize=new Dimension();
  List children=container.getChildren();
  int width=0;
  int height=0;
  IFigure child;
  IFigure lastChild=null;
  Dimension childSize;
  for (int i=0; i < children.size(); i++) {
    child=(IFigure)children.get(i);
    Insets fmargin=getFigureMargin(child);
    if (wHint != -1) {
      wHint=Math.max(0,wHint - fmargin.getWidth());
    }
    if (getDisplay(child) != ReportItemConstraint.BLOCK) {
      wHint=-1;
    }
    childSize=getChildSize(child,wHint,hHint);
    if (i == 0) {
      width=childSize.width + fmargin.getWidth();
      height=childSize.height + fmargin.getHeight();
    }
 else     if ((getDisplay(child) == ReportItemConstraint.NONE)) {
    }
 else     if ((width + childSize.width + fmargin.getWidth()+ getMinorSpacing() <= maxWidth) && ((getDisplay(child) == ReportItemConstraint.INLINE) && (getDisplay(lastChild) == ReportItemConstraint.INLINE))) {
      width+=childSize.width + fmargin.getWidth() + getMinorSpacing();
      height=Math.max(height,childSize.height + fmargin.getHeight());
    }
 else {
      prefSize.height+=height + getMajorSpacing();
      prefSize.width=Math.max(prefSize.width,width);
      width=childSize.width + fmargin.getWidth();
      height=childSize.height + fmargin.getHeight();
    }
    lastChild=child;
  }
  prefSize.height+=height;
  prefSize.width=Math.max(prefSize.width,width);
  prefSize.width+=container.getInsets().getWidth();
  prefSize.height+=container.getInsets().getHeight();
  prefSize.union(getBorderPreferredSize(container));
  return prefSize;
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.draw2d.AbstractLayout#calculatePreferredSize(IFigure,int,int)
 */
protected Dimension calculatePreferredSize(IFigure container,int wHint,int hHint){
  if (wHint > -1)   wHint=Math.max(0,wHint - container.getInsets().getWidth());
  if (hHint > -1)   hHint=Math.max(0,hHint - container.getInsets().getHeight());
  int maxWidth;
  maxWidth=wHint;
  hHint=-1;
  if (maxWidth < 0) {
    maxWidth=Integer.MAX_VALUE;
  }
  Dimension prefSize=new Dimension();
  List children=container.getChildren();
  int width=0;
  int height=0;
  IFigure child;
  IFigure lastChild=null;
  Dimension childSize;
  int caleHint;
  for (int i=0; i < children.size(); i++) {
    child=(IFigure)children.get(i);
    Insets fmargin=getFigureMargin(child);
    if (wHint != -1) {
      wHint=Math.max(0,wHint - fmargin.getWidth());
    }
    if (getDisplay(child) != ReportItemConstraint.BLOCK) {
      caleHint=-1;
    }
 else {
      caleHint=wHint;
    }
    childSize=getChildSize(child,caleHint,hHint);
    if (i == 0) {
      width=childSize.width + fmargin.getWidth();
      height=childSize.height + fmargin.getHeight();
    }
 else     if ((getDisplay(child) == ReportItemConstraint.NONE)) {
    }
 else     if ((width + childSize.width + fmargin.getWidth()+ getMinorSpacing() <= maxWidth) && ((getDisplay(child) == ReportItemConstraint.INLINE) && (getDisplay(lastChild) == ReportItemConstraint.INLINE))) {
      width+=childSize.width + fmargin.getWidth() + getMinorSpacing();
      height=Math.max(height,childSize.height + fmargin.getHeight());
    }
 else {
      prefSize.height+=height + getMajorSpacing();
      prefSize.width=Math.max(prefSize.width,width);
      width=childSize.width + fmargin.getWidth();
      height=childSize.height + fmargin.getHeight();
    }
    lastChild=child;
  }
  prefSize.height+=height;
  prefSize.width=Math.max(prefSize.width,width);
  prefSize.width+=container.getInsets().getWidth();
  prefSize.height+=container.getInsets().getHeight();
  prefSize.union(getBorderPreferredSize(container));
  return prefSize;
}