Bug 28632 - Unable to drag Keepvid.com bookmarklet (to bookmarks bar)
Summary: Unable to drag Keepvid.com bookmarklet (to bookmarks bar)
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Victor Wang
URL: http://keepvid.com/
Depends on:
Reported: 2009-08-21 15:13 PDT by jasneet
Modified: 2010-02-26 15:01 PST (History)
8 users (show)

See Also:

Proposed patch (6.65 KB, patch)
2009-10-01 09:22 PDT, Victor Wang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jasneet 2009-08-21 15:13:05 PDT
I Steps:
Go to http://keepvid.com/
Try to drag the Keepvid bookmarklet (to the bookmarks bar)

II Issue:
Dragging is not possible

III Other Browsers:
IE8: not ok
FF3: ok

IV Nightly tested: 46809

Bug in Chromium : http://code.google.com/p/chromium/issues/detail?id=16307
Comment 1 Victor Wang 2009-08-24 10:59:04 PDT
The reason why this bookmark can't be dragged is because it has child node. The current webkit code does not allow a node to be dragged if it has child node:
bool EventHandler::shouldDragAutoNode(Node* node, const IntPoint& point) const
    if (!node || node->hasChildNodes() || !m_frame->view())
        return false;
Comment 2 Victor Wang 2009-08-25 11:21:25 PDT
Hi David,

In this case, the node to drag is Anchor node, which has a #text child node. The EventHandler::shouldDragAutoNode in WebCore\page\EvnetHandler.cpp return false if the node to drag has child nodes, do you know any background why this check is required? Is it OK to remove the child node checking to fix this bug? If not, any suggestions on how to fix it?

This is a bug in both Safari and Chrome.

Comment 3 Dave Hyatt 2009-09-28 14:31:49 PDT
Not sure why that check is there.  Oliver Hunt (olliej) in IRC might remember.
Comment 4 Dave Hyatt 2009-09-28 14:54:02 PDT
Does this code actually have to do with link dragging or is it more about dragging of text... most links have child nodes obviously and still work in Safari, so it's not clear to me if you're looking in the right spot?
Comment 5 Oliver Hunt 2009-09-28 14:56:46 PDT
What's the backtrace that leads to EventHandler::shouldDragAutoNode in this case?
Comment 6 Victor Wang 2009-09-28 15:08:53 PDT
I think normally when you drag a link, it is the child text node getting dragged so it works fine for link dragging. "Keep it" bookmark is little special, the actual text is indented -10000px, so you are not actually dragging the text link. Instead, you are dragging the image part, which corresponds to the anchor node. I believe this is why it fails but other link dragging works fine. I tested it by removing the child node checking and it works after that.
Comment 7 Victor Wang 2009-09-28 15:13:18 PDT
WebCore::EventHandler::shouldDragAutoNode(WebCore::Node * node=0x048d9140, const WebCore::IntPoint & point={...}) Line 2170	C++
WebCore::RenderObject::draggableNode(bool dhtmlOK=true, bool uaOK=true, int x=456, int y=41, bool & dhtmlWillDrag=false) Line 1404 + 0x4c bytes	C++
WebCore::EventHandler::handleDrag(const WebCore::MouseEventWithHitTestResults & event={...}) Line 2233 + 0x48 bytes	C++
WebCore::EventHandler::handleMouseDraggedEvent(const WebCore::MouseEventWithHitTestResults & event={...}) Line 429 + 0xc bytes	C++
WebCore::EventHandler::handleMouseMoveEvent(const WebCore::PlatformMouseEvent & mouseEvent={...}, WebCore::HitTestResult * hoveredNode=0x0438ecac) Line 1413 + 0xc bytes	C++
WebCore::EventHandler::mouseMoved(const WebCore::PlatformMouseEvent & event={...}) Line 1309 + 0x10 bytes	C++
WebViewImpl::MouseMove(const WebKit::WebMouseEvent & event={...}) Line 448	C++
WebViewImpl::handleInputEvent(const WebKit::WebInputEvent & input_event={...}) Line 1041	C++
RenderWidget::OnHandleInputEvent(const IPC::Message & message={...}) Line 318 + 0x1b bytes	C++
Comment 8 Oliver Hunt 2009-09-28 15:16:14 PDT
Yeah i think the hasChildNodes check should just go away
Comment 9 Victor Wang 2009-10-01 09:22:56 PDT
Created attachment 40450 [details]
Proposed patch
Comment 10 WebKit Commit Bot 2009-10-01 10:25:43 PDT
Comment on attachment 40450 [details]
Proposed patch

Clearing flags on attachment: 40450

Committed r48981: <http://trac.webkit.org/changeset/48981>
Comment 11 WebKit Commit Bot 2009-10-01 10:25:48 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 mitz 2010-02-25 21:48:02 PST
This change broke the following case:
<img style="-webkit-user-drag: none;" src="foo.png">
and made the image draggable.
Comment 13 mitz 2010-02-26 14:45:34 PST
(In reply to comment #12)
> This change broke the following case:
> <img style="-webkit-user-drag: none;" src="foo.png">
> and made the image draggable.

Filed as bug 35459.
Comment 14 Victor Wang 2010-02-26 15:01:18 PST
working on it. thanks!