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
+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
//------------------------------------------------------------------------------------------
// 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))
{
}
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;
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);
}
}
//------------------------------------------------------------------------------------------
// 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();
}
}
- deleteSelection();
+ deleteSelection(m_smartMove);
setEndingSelection(Position(positionNode, positionOffset));
- ReplaceSelectionCommand cmd(document(), m_fragment, true);
+ ReplaceSelectionCommand cmd(document(), m_fragment, true, m_smartMove);
applyCommandToComposite(cmd);
}
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);
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();
private:
DOM::DocumentFragmentImpl *m_fragment;
DOM::Position m_position;
+ bool m_smartMove;
};
//------------------------------------------------------------------------------------------
- (void)insertNewline;
- (void)setSelectionToDragCaret;
-- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment;
+- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove;
- (void)moveDragCaretToPoint:(NSPoint)point;
- (void)removeDragCaret;
- (DOMRange *)dragCaretDOMRange;
_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();
}
+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:
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]];