Rolling out the patch I just checked in.
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2006 21:57:55 +0000 (21:57 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2006 21:57:55 +0000 (21:57 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13731 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/editing/ReplaceSelectionCommand.cpp

index 6de87b0..c79df87 100644 (file)
@@ -84,27 +84,6 @@ ReplacementFragment::ReplacementFragment(Document *document, DocumentFragment *f
     }
     
     m_type = TreeFragment;
-    
-    ASSERT(editableRoot);
-    if (!editableRoot)
-        return;
-            
-    RefPtr<Node> holder = insertFragmentForTestRendering();
-    
-    Selection selectionAroundFragment = Selection::selectionFromContentsOfNode(holder.get());
-    RefPtr<Range> range = selectionAroundFragment.toRange();
-    String text = plainText(range.get());
-    String newText = text.copy();
-    // Give the root a chance to change the text.
-    RefPtr<Event> evt = new BeforeTextInsertedEvent(newText);
-    ExceptionCode ec = 0;
-    editableRoot->dispatchEvent(evt, ec, true);
-    ASSERT(ec == 0);
-    if (text != newText || !editableRoot->isContentRichlyEditable()) {
-        removeNode(holder);
-        m_fragment = createFragmentFromText(document, newText.deprecatedString());
-        holder = insertFragmentForTestRendering();
-     }
 
     Node *node = fragment->firstChild();
     Node *newlineAtStartNode = 0;
@@ -138,7 +117,28 @@ ReplacementFragment::ReplacementFragment(Document *document, DocumentFragment *f
         removeNode(newlineAtStartNode);
     if (newlineAtEndNode)
         removeNode(newlineAtEndNode);
-        
+    
+    ASSERT(editableRoot);
+    if (!editableRoot)
+        return;
+            
+    RefPtr<Node> holder = insertFragmentForTestRendering();
+    
+    Selection selectionAroundFragment = Selection::selectionFromContentsOfNode(holder.get());
+    RefPtr<Range> range = selectionAroundFragment.toRange();
+    String text = plainText(range.get());
+    String newText = text.copy();
+    // Give the root a chance to change the text.
+    RefPtr<Event> evt = new BeforeTextInsertedEvent(newText);
+    ExceptionCode ec = 0;
+    editableRoot->dispatchEvent(evt, ec, true);
+    ASSERT(ec == 0);
+    if (text != newText || !editableRoot->isContentRichlyEditable()) {
+        removeNode(holder);
+        m_fragment = createFragmentFromText(document, newText.deprecatedString());
+        holder = insertFragmentForTestRendering();
+     }
+    
     saveRenderingInfo(holder.get());
     removeUnrenderedNodes(holder.get());
     m_hasMoreThanOneBlock = renderedBlocks(holder.get()) > 1;