LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2006 23:58:43 +0000 (23:58 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2006 23:58:43 +0000 (23:58 +0000)
        Reviewed by harrison

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=8117>
        REGRESSION (NativeTextField): Drag and drop text within a text input field modifies page
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=7567>
        A drag and drop in DumpRenderTree copies the source, instead of cutting it

        * editing/pasteboard/drag-drop-modifies-page-expected.checksum: Added.
        * editing/pasteboard/drag-drop-modifies-page-expected.png: Added.
        * editing/pasteboard/drag-drop-modifies-page-expected.txt: Added.
        * editing/pasteboard/drag-drop-modifies-page.html: Added.

        Updated:
        * fast/lists/drag-onto-marker.html:
        * fast/lists/drag-onto-marker-expected.txt:
        * fast/lists/drag-onto-marker-expected.png:
        * fast/lists/drag-onto-marker-expected.checksum:

WebCore:

        Reviewed by harrison

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=8117>
        REGRESSION (NativeTextField): Drag and drop text within a text input field modifies page

        The frame's selection is only set after all sub-commands have been
        performed.  When we send the khtmlBeforeTextInsertedEvent to the root
        editable element we were using frame->selection(), which may no longer
        be in the document.

        Had to move the construction of the ReplacementFragment to when the
        replace operation is applied, because endingSelection isn't the
        endingSelection of the last operation when the replace operation
        is constructed.

        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::ReplacementFragment::ReplacementFragment):
        (WebCore::ReplaceSelectionCommand::ReplaceSelectionCommand):
        (WebCore::ReplaceSelectionCommand::doApply):
        * editing/ReplaceSelectionCommand.h:

WebKitTools:

        Reviewed by harrison

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=7567>
        A drag and drop in DumpRenderTree copies the source, instead of cutting it

        Tell the source that the drag is over after the drag is performed, not before.

        * DumpRenderTree/EventSendingController.m:
        (-[EventSendingController mouseUp]):

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.checksum [new file with mode: 0644]
LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.png [new file with mode: 0644]
LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/drag-drop-modifies-page.html [new file with mode: 0644]
LayoutTests/fast/lists/drag-into-marker-expected.checksum
LayoutTests/fast/lists/drag-into-marker-expected.png
LayoutTests/fast/lists/drag-into-marker-expected.txt
LayoutTests/fast/lists/drag-into-marker.html
WebCore/ChangeLog
WebCore/editing/ReplaceSelectionCommand.cpp
WebCore/editing/ReplaceSelectionCommand.h
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/EventSendingController.m

index 64401779000ac62e90d2b31ce93ec10b736d57d4..84e106842ef074b22e337ed4938a1daa29ab83f1 100644 (file)
@@ -1,3 +1,23 @@
+2006-04-03  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=8117>
+        REGRESSION (NativeTextField): Drag and drop text within a text input field modifies page
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=7567>
+        A drag and drop in DumpRenderTree copies the source, instead of cutting it
+
+        * editing/pasteboard/drag-drop-modifies-page-expected.checksum: Added.
+        * editing/pasteboard/drag-drop-modifies-page-expected.png: Added.
+        * editing/pasteboard/drag-drop-modifies-page-expected.txt: Added.
+        * editing/pasteboard/drag-drop-modifies-page.html: Added.
+
+        Updated:
+        * fast/lists/drag-onto-marker.html:
+        * fast/lists/drag-onto-marker-expected.txt:
+        * fast/lists/drag-onto-marker-expected.png:
+        * fast/lists/drag-onto-marker-expected.checksum:
+
 2006-04-03  Beth Dakin  <bdakin@apple.com>
 
         Layout test for <rdar://problem/4495644> crash when mousing over 
diff --git a/LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.checksum b/LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.checksum
new file mode 100644 (file)
index 0000000..11a75b8
--- /dev/null
@@ -0,0 +1 @@
+fe8c29c135a47dbfb80e6bbf8ad273bf
\ No newline at end of file
diff --git a/LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.png b/LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.png
new file mode 100644 (file)
index 0000000..2d1e3ce
Binary files /dev/null and b/LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.png differ
diff --git a/LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.txt b/LayoutTests/editing/pasteboard/drag-drop-modifies-page-expected.txt
new file mode 100644 (file)
index 0000000..82c4658
--- /dev/null
@@ -0,0 +1,25 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 2 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionDropped
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {TEXT} at (0,0) size 757x18
+          text run at (0,0) width 757: "This test does a drag and drop such that the selection around the dragged word is no longer in the document on the drop."
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderText {TEXT} at (0,0) size 37x18
+          text run at (0,0) width 37: "world"
+        RenderText {TEXT} at (37,0) size 4x18
+          text run at (37,0) width 4: " "
+        RenderInline {SPAN} at (0,0) size 31x18
+          RenderText {TEXT} at (41,0) size 31x18
+            text run at (41,0) width 31: "hello"
+caret: position 1 of child 1 {TEXT} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/pasteboard/drag-drop-modifies-page.html b/LayoutTests/editing/pasteboard/drag-drop-modifies-page.html
new file mode 100644 (file)
index 0000000..710821a
--- /dev/null
@@ -0,0 +1,35 @@
+<html> 
+<head>
+<script src=../editing.js type="text/javascript"></script>
+<script>
+function editingTest() {
+  
+    if (!window.layoutTestController)
+        return;
+        
+    extendSelectionForwardByWordCommand();
+    
+    window.layoutTestController.waitUntilDone();
+    
+    // Drag 'hello'
+    var e = document.getElementById("dragme");
+    x = e.offsetLeft + 10;
+    y = e.offsetTop + e.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    // and drop it off to the right somewhere
+    eventSender.leapForward(500);
+    eventSender.mouseMoveTo(x + 300, y);
+    eventSender.mouseUp();
+
+    window.layoutTestController.notifyDone();
+}
+</script>
+<title>Drag and drop within a text input field modifies page</title> 
+</head> 
+<body>
+<p>This test does a drag and drop such that the selection around the dragged word is no longer in the document on the drop.</p>
+<div contenteditable="true" id="test"><span id="dragme">hello</span> world</div>
+<script>runEditingTest();</script>
+</body>
+</html>
index 82b6ee4d1593d88cce041915d3042ac8634c205d..059b0d4fbec2fc0608eca5336e048836ee0fdcc8 100644 (file)
@@ -1 +1 @@
-d020a6436afca6ef08679f9f9caffdaa
\ No newline at end of file
+df27ed25b1f079512d5aad0ce5771c69
\ No newline at end of file
index 4572e2868df360d9e809fd388bbacc2d286575b2..ebd05265d1445696897754be9f539709bc945061 100644 (file)
Binary files a/LayoutTests/fast/lists/drag-into-marker-expected.png and b/LayoutTests/fast/lists/drag-into-marker-expected.png differ
index 325a280c24b9ec8f8561f6b5c49f16404b36235a..4dc0edc17167dee1cc66fb0297ba9d0029898297 100644 (file)
@@ -5,8 +5,7 @@ EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotificatio
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > SPAN > LI > UL > BODY > HTML > #document to 2 of #text > SPAN > LI > UL > BODY > HTML > #document toDOMRange:range from 0 of #text > SPAN > LI > UL > BODY > HTML > #document to 5 of #text > SPAN > LI > UL > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of LI > UL > BODY > HTML > #document to 0 of LI > UL > BODY > HTML > #document givenAction:WebViewInsertActionDropped
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > SPAN > LI > UL > BODY > HTML > #document to 6 of #text > SPAN > LI > UL > BODY > HTML > #document toDOMRange:range from 0 of #text > SPAN > LI > UL > BODY > HTML > #document to 6 of #text > SPAN > LI > UL > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > SPAN > LI > UL > BODY > HTML > #document to 6 of #text > SPAN > LI > UL > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -20,11 +19,8 @@ layer at (0,0) size 800x600
           RenderInline {SPAN} at (0,0) size 124x55
             RenderText {TEXT} at (0,0) size 124x55
               text run at (0,0) width 124: "world "
-          RenderText {TEXT} at (124,0) size 107x55
-            text run at (124,0) width 107: "hello "
-          RenderInline {SPAN} at (0,0) size 112x55
-            RenderText {TEXT} at (231,0) size 112x55
-              text run at (231,0) width 112: "world"
+          RenderText {TEXT} at (124,0) size 95x55
+            text run at (124,0) width 95: "hello"
       RenderBlock {P} at (0,73) size 784x72
         RenderText {TEXT} at (0,0) size 764x72
           text run at (0,0) width 562: "This is an automated test for elementAtPoint for points over position:outside list markers. "
index a3e856aa82cbbb8b9343d4599dec5e4c79275d22..0be774905a9458922b86921213b8f39958734b90 100644 (file)
@@ -4,8 +4,6 @@
 
 <p>This is an automated test for elementAtPoint for points over position:outside list markers.  The dictionary returned by elementAtPoint should contain the list item as the DOMNode, not the list, for points over position:outside list markers.  elementAtPoint is used to determine the drag operation that will occur when something is dropped over a given point.  So, this test drags a bit of text over the list marker and drops it.  It should be pasted into the list item, which is contenteditable.</p>
 
-<p><b>This test case demonstrates a bug in DumpRenderTree's drag and drop support, which is that the source  is copied on drop, not cut.</b>  So you'll see 'world' twice.</p>
-
 <script>
 
 function runTest() {
index 2242c5027b2ba869b116806ca737f050f31becc1..481707dd2b0f2386f418ebe37d2e2f42f639eaa6 100644 (file)
@@ -1,3 +1,26 @@
+2006-04-03  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=8117>
+        REGRESSION (NativeTextField): Drag and drop text within a text input field modifies page
+        
+        The frame's selection is only set after all sub-commands have been 
+        performed.  When we send the khtmlBeforeTextInsertedEvent to the root 
+        editable element we were using frame->selection(), which may no longer 
+        be in the document.
+        
+        Had to move the construction of the ReplacementFragment to when the
+        replace operation is applied, because endingSelection isn't the 
+        endingSelection of the last operation when the replace operation
+        is constructed.
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplacementFragment::ReplacementFragment):
+        (WebCore::ReplaceSelectionCommand::ReplaceSelectionCommand):
+        (WebCore::ReplaceSelectionCommand::doApply):
+        * editing/ReplaceSelectionCommand.h:
+
 2006-04-03  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Hyatt.
index b6cbfcd10a91d868ffe0f3c295e56370b8b0c6fe..404c6d011f1552c8571ecc32bef44626361c0d18 100644 (file)
@@ -54,7 +54,7 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-ReplacementFragment::ReplacementFragment(Document *document, DocumentFragment *fragment, bool matchStyle)
+ReplacementFragment::ReplacementFragment(Document *document, DocumentFragment *fragment, bool matchStyle, Element* editableRoot)
     : m_document(document),
       m_fragment(fragment),
       m_matchStyle(matchStyle), 
@@ -117,13 +117,12 @@ ReplacementFragment::ReplacementFragment(Document *document, DocumentFragment *f
         removeNode(newlineAtStartNode);
     if (newlineAtEndNode)
         removeNode(newlineAtEndNode);
-        
-    RefPtr<Node> holder = insertFragmentForTestRendering();
     
-    Element* editableRoot = document->frame() ? document->frame()->selection().rootEditableElement() : 0;
     ASSERT(editableRoot);
     if (!editableRoot)
         return;
+            
+    RefPtr<Node> holder = insertFragmentForTestRendering();
 
     RefPtr<Range> range = new Range(holder->document());
     ExceptionCode ec = 0;
@@ -140,9 +139,6 @@ ReplacementFragment::ReplacementFragment(Document *document, DocumentFragment *f
         holder = insertFragmentForTestRendering();
      }
     
-    if (!editableRoot->isContentRichlyEditable())
-        m_matchStyle = true;
-    
     saveRenderingInfo(holder.get());
     removeUnrenderedNodes(holder.get());
     m_hasMoreThanOneBlock = renderedBlocks(holder.get()) > 1;
@@ -482,11 +478,11 @@ RenderingInfo::RenderingInfo(PassRefPtr<CSSMutableStyleDeclaration> style, bool
 }
 
 ReplaceSelectionCommand::ReplaceSelectionCommand(Document *document, DocumentFragment *fragment, bool selectReplacement, bool smartReplace, bool matchStyle) 
-    : CompositeEditCommand(document), 
-      m_fragment(document, fragment, matchStyle),
+    : CompositeEditCommand(document),
       m_selectReplacement(selectReplacement), 
       m_smartReplace(smartReplace),
-      m_matchStyle(matchStyle)
+      m_matchStyle(matchStyle),
+      m_documentFragment(fragment)
 {
 }
 
@@ -503,6 +499,8 @@ void ReplaceSelectionCommand::doApply()
     if (!selection.isContentRichlyEditable())
         m_matchStyle = true;
     
+    ReplacementFragment fragment(document(), m_documentFragment.get(), m_matchStyle, selection.rootEditableElement());
+    
     if (m_matchStyle)
         m_insertionStyle = styleAtPosition(selection.start());
     
@@ -522,14 +520,14 @@ void ReplaceSelectionCommand::doApply()
         mergeStart = true;
     } else {
         // merge if current selection starts inside a paragraph, or there is only one block and no interchange newline to add
-        mergeStart = !m_fragment.hasInterchangeNewlineAtStart() && 
-            (!isStartOfParagraph(visibleStart) || (!m_fragment.hasInterchangeNewlineAtEnd() && !m_fragment.hasMoreThanOneBlock()));
+        mergeStart = !fragment.hasInterchangeNewlineAtStart() && 
+            (!isStartOfParagraph(visibleStart) || (!fragment.hasInterchangeNewlineAtEnd() && !fragment.hasMoreThanOneBlock()));
         
         // This is a workaround for this bug:
         // <rdar://problem/4013642> Copied quoted word does not paste as a quote if pasted at the start of a line
         // We need more powerful logic in this whole mergeStart code for this case to come out right without
         // breaking other cases.
-        if (isStartOfParagraph(visibleStart) && isMailBlockquote(m_fragment.firstChild()))
+        if (isStartOfParagraph(visibleStart) && isMailBlockquote(fragment.firstChild()))
             mergeStart = false;
         
         // prevent first list item from getting merged into target, thereby pulled out of list
@@ -538,7 +536,7 @@ void ReplaceSelectionCommand::doApply()
         // assume that the mergeStartNode() contains the first visible content to paste.
         // Any better ideas?
         if (mergeStart) {
-            for (Node *n = m_fragment.mergeStartNode(); n; n = n->parentNode()) {
+            for (Node *n = fragment.mergeStartNode(); n; n = n->parentNode()) {
                 if (isListElement(n)) {
                     mergeStart = false;
                     break;
@@ -549,19 +547,19 @@ void ReplaceSelectionCommand::doApply()
     
     // decide whether to later append nodes to the end
     Node *beyondEndNode = 0;
-    if (!isEndOfParagraph(visibleEnd) && !m_fragment.hasInterchangeNewlineAtEnd() &&
-       (startBlock != endBlock || m_fragment.hasMoreThanOneBlock()))
+    if (!isEndOfParagraph(visibleEnd) && !fragment.hasInterchangeNewlineAtEnd() &&
+       (startBlock != endBlock || fragment.hasMoreThanOneBlock()))
         beyondEndNode = selection.end().downstream().node();
 
     Position startPos = selection.start();
     
     // delete the current range selection, or insert paragraph for caret selection, as needed
     if (selection.isRange()) {
-        bool mergeBlocksAfterDelete = !(m_fragment.hasInterchangeNewlineAtStart() || m_fragment.hasInterchangeNewlineAtEnd() || m_fragment.hasMoreThanOneBlock());
+        bool mergeBlocksAfterDelete = !(fragment.hasInterchangeNewlineAtStart() || fragment.hasInterchangeNewlineAtEnd() || fragment.hasMoreThanOneBlock());
         deleteSelection(false, mergeBlocksAfterDelete);
         updateLayout();
         visibleStart = VisiblePosition(endingSelection().start(), VP_DEFAULT_AFFINITY);
-        if (m_fragment.hasInterchangeNewlineAtStart()) {
+        if (fragment.hasInterchangeNewlineAtStart()) {
             if (isEndOfParagraph(visibleStart) && !isStartOfParagraph(visibleStart)) {
                 if (!isEndOfDocument(visibleStart))
                     setEndingSelection(visibleStart.next());
@@ -574,7 +572,7 @@ void ReplaceSelectionCommand::doApply()
     } 
     else {
         ASSERT(selection.isCaret());
-        if (m_fragment.hasInterchangeNewlineAtStart()) {
+        if (fragment.hasInterchangeNewlineAtStart()) {
             if (isEndOfParagraph(visibleStart) && !isStartOfParagraph(visibleStart)) {
                 if (!isEndOfDocument(visibleStart))
                     setEndingSelection(visibleStart.next());
@@ -583,7 +581,7 @@ void ReplaceSelectionCommand::doApply()
                 setEndingSelection(VisiblePosition(endingSelection().start(), VP_DEFAULT_AFFINITY));
             }
         }
-        if (!m_fragment.hasInterchangeNewlineAtEnd() && m_fragment.hasMoreThanOneBlock() && 
+        if (!fragment.hasInterchangeNewlineAtEnd() && fragment.hasMoreThanOneBlock() && 
             !startAtBlockBoundary && !isEndOfParagraph(visibleEnd)) {
             // The start and the end need to wind up in separate blocks.
             // Insert a paragraph separator to make that happen.
@@ -610,7 +608,7 @@ void ReplaceSelectionCommand::doApply()
     setTypingStyle(0);    
     
     // done if there is nothing to add
-    if (!m_fragment.firstChild())
+    if (!fragment.firstChild())
         return;
     
     // check for a line placeholder, and store it away for possible removal later.
@@ -623,7 +621,7 @@ void ReplaceSelectionCommand::doApply()
         // now a "second deepest position"
         downstream = positionAvoidingSpecialElementBoundary(downstream);
         if (downstream.node()->hasTagName(brTag) && downstream.offset() == 0 && 
-            m_fragment.hasInterchangeNewlineAtEnd() &&
+            fragment.hasInterchangeNewlineAtEnd() &&
             isStartOfLine(VisiblePosition(downstream, VP_DEFAULT_AFFINITY)))
             linePlaceholder = downstream.node();
     }
@@ -661,12 +659,12 @@ void ReplaceSelectionCommand::doApply()
 
     // step 1: merge content into the start block
     if (mergeStart) {
-        Node *refNode = m_fragment.mergeStartNode();
+        Node *refNode = fragment.mergeStartNode();
         if (refNode) {
             Node *parent = refNode->parentNode();
             Node *node = refNode->nextSibling();
             insertNodeAtAndUpdateNodesInserted(refNode, startPos.node(), startPos.offset());
-            while (node && !m_fragment.isBlockFlow(node)) {
+            while (node && !fragment.isBlockFlow(node)) {
                 Node *next = node->nextSibling();
                 insertNodeAfterAndUpdateNodesInserted(node, refNode);
                 refNode = node;
@@ -689,17 +687,17 @@ void ReplaceSelectionCommand::doApply()
     }
     
     // step 2 : merge everything remaining in the fragment
-    if (m_fragment.firstChild()) {
-        Node *refNode = m_fragment.firstChild();
+    if (fragment.firstChild()) {
+        Node *refNode = fragment.firstChild();
         Node *node = refNode ? refNode->nextSibling() : 0;
         Node *insertionBlock = insertionPos.node()->enclosingBlockFlowElement();
         bool insertionBlockIsRoot = insertionBlock == insertionBlock->rootEditableElement();
         VisiblePosition visiblePos(insertionPos, DOWNSTREAM);
-        if (!insertionBlockIsRoot && m_fragment.isBlockFlow(refNode) && isStartOfBlock(visiblePos))
+        if (!insertionBlockIsRoot && fragment.isBlockFlow(refNode) && isStartOfBlock(visiblePos))
             insertNodeBeforeAndUpdateNodesInserted(refNode, insertionBlock);
-        else if (!insertionBlockIsRoot && m_fragment.isBlockFlow(refNode) && isEndOfBlock(visiblePos)) {
+        else if (!insertionBlockIsRoot && fragment.isBlockFlow(refNode) && isEndOfBlock(visiblePos)) {
             insertNodeAfterAndUpdateNodesInserted(refNode, insertionBlock);
-        } else if (m_lastNodeInserted && !m_fragment.isBlockFlow(refNode)) {
+        } else if (m_lastNodeInserted && !fragment.isBlockFlow(refNode)) {
             Position pos = visiblePos.next().deepEquivalent().downstream();
             insertNodeAtAndUpdateNodesInserted(refNode, pos.node(), pos.offset());
         } else {
@@ -753,7 +751,7 @@ void ReplaceSelectionCommand::doApply()
     Position lastPositionToSelect;
 
     // step 4 : handle trailing newline
-    if (m_fragment.hasInterchangeNewlineAtEnd()) {
+    if (fragment.hasInterchangeNewlineAtEnd()) {
         removeLinePlaceholderIfNeeded(linePlaceholder);
 
         if (!m_lastNodeInserted) {
@@ -763,7 +761,7 @@ void ReplaceSelectionCommand::doApply()
             bool insertParagraph = false;
             VisiblePosition pos(insertionPos, VP_DEFAULT_AFFINITY);
             
-            if (startBlock == endBlock && !m_fragment.isBlockFlow(m_lastTopNodeInserted.get())) {
+            if (startBlock == endBlock && !fragment.isBlockFlow(m_lastTopNodeInserted.get())) {
                 insertParagraph = true;
             } else {
                 // Handle end-of-document case.
@@ -828,7 +826,7 @@ void ReplaceSelectionCommand::doApply()
     }
     
     if (!m_matchStyle)
-        fixupNodeStyles(m_fragment.nodes(), m_fragment.renderingInfo());
+        fixupNodeStyles(fragment.nodes(), fragment.renderingInfo());
     completeHTMLReplacement(lastPositionToSelect);
     
     // step 5 : mop up
index 3e8724b0de8e686ee3d9852b371e459a391764ac..729a2a12fa4ab43db735146767de33aee32092b0 100644 (file)
@@ -54,7 +54,7 @@ typedef HashMap<Node*, RefPtr<RenderingInfo> > RenderingInfoMap;
 class ReplacementFragment
 {
 public:
-    ReplacementFragment(Document *, DocumentFragment *, bool matchStyle);
+    ReplacementFragment(Document*, DocumentFragment*, bool, Element*);
     ~ReplacementFragment();
 
     enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment };
@@ -132,7 +132,6 @@ private:
     void removeLinePlaceholderIfNeeded(Node *);
     void removeNodeAndPruneAncestors(Node*);
 
-    ReplacementFragment m_fragment;
     RefPtr<Node> m_firstNodeInserted;
     RefPtr<Node> m_lastNodeInserted;
     RefPtr<Node> m_lastTopNodeInserted;
@@ -140,6 +139,7 @@ private:
     bool m_selectReplacement;
     bool m_smartReplace;
     bool m_matchStyle;
+    RefPtr<DocumentFragment> m_documentFragment;
 };
 
 } // namespace WebCore
index 8328754115d66cc499782a61bbbb7d8d96e88e86..045c4c9846a0f64d92c1f429e71fad416b445766 100644 (file)
@@ -1,3 +1,15 @@
+2006-04-03  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=7567>
+        A drag and drop in DumpRenderTree copies the source, instead of cutting it
+        
+        Tell the source that the drag is over after the drag is performed, not before.
+
+        * DumpRenderTree/EventSendingController.m:
+        (-[EventSendingController mouseUp]):
+
 2006-04-01  Darin Adler  <darin@apple.com>
 
         Reviewed by Justin.
index afb4053632d927130fb03dc7a643db0f774d06ff..9b573260bba52c3ae2fffe829bdac284501e5c98 100644 (file)
@@ -127,9 +127,9 @@ NSPoint lastMousePosition;
             
             NSDragOperation dragOperation = [webView draggingUpdated:draggingInfo];
             
-            [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] endedAt:lastMousePosition operation:dragOperation];
             if (dragOperation != NSDragOperationNone)
                 [webView performDragOperation:draggingInfo];
+            [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] endedAt:lastMousePosition operation:dragOperation];
             [draggingInfo release];
             draggingInfo = nil;
         }