WebCore:
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Sep 2004 23:42:19 +0000 (23:42 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Sep 2004 23:42:19 +0000 (23:42 +0000)
Fixed: <rdar://problem/3812091> REGRESSION (Mail): double-clicked word is not smart inserted on drag

        Reviewed by john.

        * khtml/editing/htmlediting.cpp:
        (khtml::MoveSelectionCommand::MoveSelectionCommand): take smartMove arg
        * khtml/editing/htmlediting.h:
        * khtml/editing/htmlediting_impl.cpp:
        (khtml::CompositeEditCommandImpl::deleteSelection): take smartDelete arg
        (khtml::MoveSelectionCommandImpl::MoveSelectionCommandImpl): take smartMove arg
        (khtml::MoveSelectionCommandImpl::doApply): pass smartMove for smartDelete and smartReplace
        * khtml/editing/htmlediting_impl.h:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge moveSelectionToDragCaret:smartMove:]): take smartMove arg

WebKit:

<rdar://problem/3812091> REGRESSION (Mail): double-clicked word is not smart inserted on drag

        Reviewed by john.

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView concludeDragForDraggingInfo:actionMask:]): pass value for smartMove

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/htmlediting.cpp
WebCore/khtml/editing/htmlediting.h
WebCore/khtml/editing/htmlediting_impl.cpp
WebCore/khtml/editing/htmlediting_impl.h
WebCore/kwq/WebCoreBridge.h
WebCore/kwq/WebCoreBridge.mm
WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m

index abdf07718423b8fd6614d8ac9fe5ebb036aab6b6..b506d78f4296313217d4c46585e91a6b98662881 100644 (file)
@@ -1,3 +1,21 @@
+2004-09-22  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed: <rdar://problem/3812091> REGRESSION (Mail): double-clicked word is not smart inserted on drag
+
+        Reviewed by john.
+
+        * khtml/editing/htmlediting.cpp:
+        (khtml::MoveSelectionCommand::MoveSelectionCommand): take smartMove arg
+        * khtml/editing/htmlediting.h:
+        * khtml/editing/htmlediting_impl.cpp:
+        (khtml::CompositeEditCommandImpl::deleteSelection): take smartDelete arg
+        (khtml::MoveSelectionCommandImpl::MoveSelectionCommandImpl): take smartMove arg
+        (khtml::MoveSelectionCommandImpl::doApply): pass smartMove for smartDelete and smartReplace
+        * khtml/editing/htmlediting_impl.h:
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge moveSelectionToDragCaret:smartMove:]): take smartMove arg
+
 2004-09-22  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by Hyatt
index f578af6555e60ea44cfbea4d16c1cf2df81f4d88..bb9166180fc6e4dc714b1891a7251bee7ad1841d 100644 (file)
@@ -432,8 +432,8 @@ ReplaceSelectionCommandImpl *ReplaceSelectionCommand::impl() const
 //------------------------------------------------------------------------------------------
 // MoveSelectionCommand
 
-MoveSelectionCommand::MoveSelectionCommand(DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position) 
-    : CompositeEditCommand(new MoveSelectionCommandImpl(document, fragment, position))
+MoveSelectionCommand::MoveSelectionCommand(DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position, bool smartMove
+    : CompositeEditCommand(new MoveSelectionCommandImpl(document, fragment, position, smartMove))
 {
 }
 
index abf74a5741f2b49cddc90a0af1412a232cf5430f..1adb80fcff5cffce93e69c8127e2b8ed1b8dcc1d 100644 (file)
@@ -273,7 +273,7 @@ private:
 class MoveSelectionCommand : public CompositeEditCommand
 {
 public:
-    MoveSelectionCommand(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position);
+    MoveSelectionCommand(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position, bool smartMove=false);
     
 private:
     MoveSelectionCommandImpl *impl() const;
index 0e00497349854e206747273351628d3564edefea..11aa9883abb57ed4bcd008135a1ef3fec55770f4 100644 (file)
@@ -529,18 +529,18 @@ void CompositeEditCommandImpl::replaceText(TextImpl *node, long offset, long cou
     applyCommandToComposite(insertCommand);
 }
 
-void CompositeEditCommandImpl::deleteSelection()
+void CompositeEditCommandImpl::deleteSelection(bool smartDelete)
 {
     if (endingSelection().isRange()) {
-        DeleteSelectionCommand cmd(document());
+        DeleteSelectionCommand cmd(document(), smartDelete);
         applyCommandToComposite(cmd);
     }
 }
 
-void CompositeEditCommandImpl::deleteSelection(const Selection &selection)
+void CompositeEditCommandImpl::deleteSelection(const Selection &selection, bool smartDelete)
 {
     if (selection.isRange()) {
-        DeleteSelectionCommand cmd(document(), selection);
+        DeleteSelectionCommand cmd(document(), selection, smartDelete);
         applyCommandToComposite(cmd);
     }
 }
@@ -1941,8 +1941,8 @@ void ReplaceSelectionCommandImpl::doApply()
 //------------------------------------------------------------------------------------------
 // MoveSelectionCommandImpl
 
-MoveSelectionCommandImpl::MoveSelectionCommandImpl(DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position) 
-    : CompositeEditCommandImpl(document), m_fragment(fragment), m_position(position)
+MoveSelectionCommandImpl::MoveSelectionCommandImpl(DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position, bool smartMove
+    : CompositeEditCommandImpl(document), m_fragment(fragment), m_position(position), m_smartMove(smartMove)
 {
     ASSERT(m_fragment);
     m_fragment->ref();
@@ -1972,10 +1972,10 @@ void MoveSelectionCommandImpl::doApply()
         }
     }
     
-    deleteSelection();
+    deleteSelection(m_smartMove);
 
     setEndingSelection(Position(positionNode, positionOffset));
-    ReplaceSelectionCommand cmd(document(), m_fragment, true);
+    ReplaceSelectionCommand cmd(document(), m_fragment, true, m_smartMove);
     applyCommandToComposite(cmd);
 }
 
index f40c87d7236bf4c157796f719bafaa770d56b80e..20e225b3467c72c2628f91c1770e8a2f7450e03b 100644 (file)
@@ -149,8 +149,8 @@ protected:
     void appendNode(DOM::NodeImpl *appendChild, DOM::NodeImpl *parentNode);
     void applyCommandToComposite(EditCommand &);
     void deleteKeyPressed();
-    void deleteSelection();
-    void deleteSelection(const DOM::Selection &selection);
+    void deleteSelection(bool smartDelete=false);
+    void deleteSelection(const DOM::Selection &selection, bool smartDelete=false);
     void deleteText(DOM::TextImpl *node, long offset, long count);
     void inputText(const DOM::DOMString &text, bool selectInsertedText = false);
     void insertNodeAfter(DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild);
@@ -397,7 +397,7 @@ private:
 class MoveSelectionCommandImpl : public CompositeEditCommandImpl
 {
 public:
-    MoveSelectionCommandImpl(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position);
+    MoveSelectionCommandImpl(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position, bool smartMove=false);
     virtual ~MoveSelectionCommandImpl();
     
     virtual void doApply();
@@ -405,6 +405,7 @@ public:
 private:
     DOM::DocumentFragmentImpl *m_fragment;
     DOM::Position m_position;
+    bool m_smartMove;
 };
 
 //------------------------------------------------------------------------------------------
index 43999f83a72ffe282d7cb69035c6275efa02aa63..bd3d25102d640a0f5cb73b5bd4eeecf4c437bf65 100644 (file)
@@ -318,7 +318,7 @@ typedef enum {
 - (void)insertNewline;
 
 - (void)setSelectionToDragCaret;
-- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment;
+- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove;
 - (void)moveDragCaretToPoint:(NSPoint)point;
 - (void)removeDragCaret;
 - (DOMRange *)dragCaretDOMRange;
index b9c0c779088018ea013b5a8e8de1b9ee64fdbbc9..347d6e01c49ce9514c2f0d3057ee78827b3c572a 100644 (file)
@@ -1551,10 +1551,10 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     _part->setSelection(_part->dragCaret());
 }
 
-- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment
+- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove
 {
     Position base = _part->dragCaret().base();
-    MoveSelectionCommand cmd(_part->xmlDocImpl(), [selectionFragment _fragmentImpl], base);
+    MoveSelectionCommand cmd(_part->xmlDocImpl(), [selectionFragment _fragmentImpl], base, smartMove);
     cmd.apply();
 }
 
index 4e128d5729d91327b961d5ab02e39bd621b32590..41b5eaefd08266d703ff3fe12010b6d85b9e0353 100644 (file)
@@ -1,3 +1,12 @@
+2004-09-22  Chris Blumenberg  <cblu@apple.com>
+
+       <rdar://problem/3812091> REGRESSION (Mail): double-clicked word is not smart inserted on drag
+
+        Reviewed by john.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView concludeDragForDraggingInfo:actionMask:]): pass value for smartMove
+
 2004-09-22  Chris Blumenberg  <cblu@apple.com>
 
        Fixed:
index 113de220ba96a61986ec26a2de622840fe76a5d8..ee13cc309a2f920c313701e874f8d1330f01f027 100644 (file)
@@ -2296,7 +2296,8 @@ static WebHTMLView *lastHitView = nil;
             if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:[bridge dragCaretDOMRange] givenAction:WebViewInsertActionDropped]) {
                 [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
                 if ([self _isMoveDrag]) {
-                    [bridge moveSelectionToDragCaret:fragment];
+                    BOOL smartMove = [[self _bridge] selectionGranularity] == WebSelectByWord && [self _canSmartReplaceWithPasteboard:pasteboard]
+                    [bridge moveSelectionToDragCaret:fragment smartMove:smartMove];
                 } else {
                     [bridge setSelectionToDragCaret];
                     [bridge replaceSelectionWithFragment:fragment selectReplacement:YES smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard]];