Commit ee5d0dc8 authored by darin@apple.com's avatar darin@apple.com

2008-10-12 Jonathon Jongsma <jonathon.jongsma@collabora.co.uk>

        Reviewed by Oliver Hunt.

        - https://bugs.webkit.org/show_bug.cgi?id=19331
          <rdar://problem/5984433>: Drag and drop of links in edit mode violates assert in MoveSelectionCommand::doApply()

        * page/DragController.cpp:
        (WebCore::DragController::startDrag): When a link is dragged without any
        text selected (note: for this to work, the EditableLinkBehavior setting must be
        set to 'live' or 'default') and then dropped into an editable html document it
        will eventually violate an ASSERT in MoveSelectionCommand that requires that there
        is a selection.  To prevent this, expand the selection to the enclosing anchor tag
        when the drag begins.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b3de9be0
2008-10-12 Jonathon Jongsma <jonathon.jongsma@collabora.co.uk>
Reviewed by Oliver Hunt.
- https://bugs.webkit.org/show_bug.cgi?id=19331
<rdar://problem/5984433>: Drag and drop of links in edit mode violates assert in MoveSelectionCommand::doApply()
* page/DragController.cpp:
(WebCore::DragController::startDrag): When a link is dragged without any
text selected (note: for this to work, the EditableLinkBehavior setting must be
set to 'live' or 'default') and then dropped into an editable html document it
will eventually violate an ASSERT in MoveSelectionCommand that requires that there
is a selection. To prevent this, expand the selection to the enclosing anchor tag
when the drag begins.
2008-10-12 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
......
......@@ -59,6 +59,7 @@
#include "Settings.h"
#include "SystemTime.h"
#include "Text.h"
#include "htmlediting.h"
#include "markup.h"
#include <wtf/RefPtr.h>
......@@ -653,7 +654,17 @@ bool DragController::startDrag(Frame* src, Clipboard* clipboard, DragOperation s
// Simplify whitespace so the title put on the clipboard resembles what the user sees
// on the web page. This includes replacing newlines with spaces.
clipboard->writeURL(linkURL, dragSource.textContent().simplifyWhiteSpace(), src);
if (src->selection()->isCaret() && src->selection()->isContentEditable()) {
// a user can initiate a drag on a link without having any text
// selected. In this case, we should expand the selection to
// the enclosing anchor element
Position pos = src->selection()->base();
Node* node = enclosingAnchorElement(pos);
if (node)
src->selection()->setSelection(Selection::selectionFromContentsOfNode(node));
}
m_client->willPerformDragSourceAction(DragSourceActionLink, dragOrigin, clipboard);
if (!dragImage) {
dragImage = m_client->createDragImageForLink(linkURL, dragSource.textContent(), src);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment