* If the traversal operation is
* <code>DELETE_CONTENTS</code> the return value is null.
*/
private Node traverseRightBoundary( Node root, int how )
{
Node next = getSelectedNode( fEndContainer, fEndOffset-1 );
boolean isFullySelected = ( next!=fEndContainer );
if ( next==root )
return traverseNode( next, isFullySelected, false, how );
Node parent = next.getParentNode();
Node clonedParent = traverseNode( parent, false, false, how );
while( parent!=null )
{
while( next!=null )
{
Node prevSibling = next.getPreviousSibling();
Node clonedChild =
traverseNode( next, isFullySelected, false, how );
if ( how!=DELETE_CONTENTS )
{
clonedParent.insertBefore(
clonedChild,
clonedParent.getFirstChild()
);
}
isFullySelected = true;
next = prevSibling;
}
if ( parent==root )
return clonedParent;
next = parent.getPreviousSibling();
parent = parent.getParentNode();
Node clonedGrandParent = traverseNode( parent, false, false, how );
if ( how!=DELETE_CONTENTS )
clonedGrandParent.appendChild( clonedParent );
clonedParent = clonedGrandParent;
}
// should never occur