Reviewed by Adele.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 21:41:29 +0000 (21:41 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 21:41:29 +0000 (21:41 +0000)
        - fix 435 more layout tests Node leaks

        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::moveParagraphs): fix more instances of leaked DOM ranges

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15187 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/editing/CompositeEditCommand.cpp

index f0afba1f3390665a46c9b5d45802571163654b46..90fbbf0f66f4621287d9e7771c4babbbde578bf3 100644 (file)
@@ -1,3 +1,12 @@
+2006-07-06  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Adele.
+
+        - fix 435 more layout tests Node leaks
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::moveParagraphs): fix more instances of leaked DOM ranges
+
 2006-07-06  David Harrison  <harrison@apple.com>
 
         Reviewed by Geoff
index b2aeb93eae2f123be40e6cdf4836ec80cb2c3cce..af317eaea5a17e665fcc9c7fb69afc69e27e27a8 100644 (file)
@@ -668,8 +668,17 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
             bool startInParagraph = Range::compareBoundaryPoints(visibleStart.deepEquivalent(), startOfParagraphToMove.deepEquivalent()) >= 0;
             bool endInParagraph = Range::compareBoundaryPoints(visibleEnd.deepEquivalent(), endOfParagraphToMove.deepEquivalent()) <= 0;
             
-            startIndex = startInParagraph ? TextIterator::rangeLength(new Range(document(), startOfParagraphToMove.deepEquivalent(), visibleStart.deepEquivalent())) : 0;
-            endIndex = endInParagraph ? TextIterator::rangeLength(new Range(document(), startOfParagraphToMove.deepEquivalent(), visibleEnd.deepEquivalent())) : 0;
+            startIndex = 0;
+            if (startInParagraph) {
+                RefPtr<Range> startRange = new Range(document(), startOfParagraphToMove.deepEquivalent(), visibleStart.deepEquivalent());
+                startIndex = TextIterator::rangeLength(startRange.get());
+            }
+
+            endIndex = 0;
+            if (endInParagraph) {
+                RefPtr<Range> endRange = new Range(document(), startOfParagraphToMove.deepEquivalent(), visibleEnd.deepEquivalent());
+                endIndex = TextIterator::rangeLength(endRange.get());
+            }
         }
     }