nddelima 2004/08/13 14:24:14 Modified: java/src/org/apache/xerces/dom RangeImpl.java Log: Fixing a bug in RangeImpl related to the effect of DOM mutations (insertions) on Ranges. Revision Changes Path 1.35 +9 -6 xml-xerces/java/src/org/apache/xerces/dom/RangeImpl.java Index: RangeImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/RangeImpl.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- RangeImpl.java 10 Aug 2004 19:35:13 -0000 1.34 +++ RangeImpl.java 13 Aug 2004 21:24:13 -0000 1.35 @@ -53,7 +53,8 @@ Node fInsertNode = null; Node fDeleteNode = null; Node fSplitNode = null; - + // Was the Node inserted from the Range or the Document + boolean fInsertedFromRange = false; /** The constructor. Clients must use DocumentRange.createRange(), * because it registers the Range with the document, so it can @@ -622,7 +623,8 @@ Node cloneCurrent; Node current; int currentChildren = 0; - + fInsertedFromRange = true; + //boolean MULTIPLE_MODE = false; if (fStartContainer.getNodeType() == Node.TEXT_NODE) { @@ -676,11 +678,11 @@ } //update fEndOffset. ex:<body><p/></body>. Range(start;end): body,0; body,1 // insert <h1>: <body></h1><p/></body>. Range(start;end): body,0; body,2 - if ( fEndContainer == fStartContainer ) { //update fEndOffset + if ( fEndContainer == fStartContainer && fEndOffset != 0 ) { //update fEndOffset if not 0 fEndOffset += (fEndContainer.getChildNodes().getLength() - currentChildren); } - - } + } + fInsertedFromRange = false; } public void surroundContents(Node newParent) @@ -947,6 +949,7 @@ public void insertedNodeFromDOM(Node node) { if (node == null) return; if (fInsertNode == node) return; + if (fInsertedFromRange) return; // Offsets are adjusted in Range.insertNode Node parent = node.getParentNode();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]