* @param nextChild the node that will be added to the list
* after firstTextNode
*/
public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode, FONode nextChild) {
Block currentBlock = null;
int foId = fo.getNameId();
if (foId == Constants.FO_BLOCK) {
currentBlock = (Block) fo;
if (nestedBlockStack.isEmpty() || fo != nestedBlockStack.peek()) {
if (nextChild != null) {
/* if already in a block, push the current block
* onto the stack of nested blocks
*/
nestedBlockStack.push(currentBlock);
}
} else {
if (nextChild == null) {
nestedBlockStack.pop();
}
}
} else if (foId == Constants.FO_RETRIEVE_MARKER) {
/* look for the nearest block ancestor, if any */
FONode ancestor = fo;
do {
ancestor = ancestor.getParent();
} while (ancestor.getNameId() != Constants.FO_BLOCK
&& ancestor.getNameId() != Constants.FO_STATIC_CONTENT);
if (ancestor.getNameId() == Constants.FO_BLOCK) {
currentBlock = (Block) ancestor;
}
} else if (!nestedBlockStack.isEmpty()) {
currentBlock = (Block) nestedBlockStack.peek();
}
if (currentBlock != null) {
linefeedTreatment = currentBlock.getLinefeedTreatment();
whiteSpaceCollapse = currentBlock.getWhitespaceCollapse();
whiteSpaceTreatment = currentBlock.getWhitespaceTreatment();
} else {
linefeedTreatment = Constants.EN_TREAT_AS_SPACE;
whiteSpaceCollapse = Constants.EN_TRUE;
whiteSpaceTreatment = Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED;
}