KnuthElement element = (KnuthElement) oldListIterator.previous();
int depth = thisDepth + 1;
// The last element may not have a layout manager (its position == null);
// this may happen if it is a padding box; see bug 39571.
Position pos = element.getPosition();
InlineLevelLayoutManager lm = null;
if (pos != null) {
lm = (InlineLevelLayoutManager) pos.getLM(depth);
}
if (lm == null) {
return oldList;
}
oldList = lm.addALetterSpaceTo(oldList, depth);
// "wrap" the Position stored in new elements of oldList
oldListIterator = oldList.listIterator();
while (oldListIterator.hasNext()) {
element = (KnuthElement) oldListIterator.next();
pos = element.getPosition();
lm = null;
if (pos != null) {
lm = (InlineLevelLayoutManager) pos.getLM(thisDepth);
}
// in old elements the position at thisDepth is a position for this LM
// only wrap new elements
if (lm != this) {
// new element, wrap position