/**
  * @return java.lang.StringBuffer
  * @param node org.eclipse.wst.css.core.model.interfaces.ICSSNode
  * @param region org.eclipse.jface.text.IRegion
  */
 protected final StringBuffer formatProc(ICSSNode node, IRegion region) {
   StringBuffer source = new StringBuffer();
   int curStart = ((IndexedRegion) node).getStartOffset();
   int curEnd = ((IndexedRegion) node).getEndOffset();
   if (node.getChildNodes().getLength() > 0) {
     curEnd = ((IndexedRegion) node.getFirstChild()).getStartOffset();
     if (overlaps(region, curStart, curEnd)) {
       if (includes(region, curStart, curEnd)) formatPre(node, source);
       else formatPre(node, overlappedRegion(region, curStart, curEnd), source);
     }
     curStart = curEnd;
     curEnd = ((IndexedRegion) node.getLastChild()).getEndOffset();
     if (overlaps(region, curStart, curEnd)) {
       if (includes(region, curStart, curEnd)) formatChildren(node, source);
       else formatChildren(node, overlappedRegion(region, curStart, curEnd), source);
     }
     curStart = curEnd;
     curEnd = ((IndexedRegion) node).getEndOffset();
     if (overlaps(region, curStart, curEnd)) {
       if (includes(region, curStart, curEnd)) formatPost(node, source);
       else formatPost(node, overlappedRegion(region, curStart, curEnd), source);
     }
   } else {
     curEnd = getChildInsertPos(node);
     if (overlaps(region, curStart, curEnd)) {
       if (includes(region, curStart, curEnd)) formatPre(node, source);
       else formatPre(node, overlappedRegion(region, curStart, curEnd), source);
     }
     curStart = curEnd;
     curEnd = ((IndexedRegion) node).getEndOffset();
     if (overlaps(region, curStart, curEnd)) {
       if (includes(region, curStart, curEnd)) formatPost(node, source);
       else formatPost(node, overlappedRegion(region, curStart, curEnd), source);
     }
   }
   return source;
 }