[Webkit-unassigned] [Bug 31711] Fake drag example does not work properly

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 20 12:56:40 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31711





--- Comment #6 from Alejandro G. Castro <alex at igalia.com>  2009-11-20 12:56:40 PST ---
(In reply to comment #5)
> I can't figure out from bug description what the problem is. When I click in
> the text and move the mouse, text gets selected, which looks like correct
> behavior. Could you please explain the issue in more detail?

Checking the code in the example you can see we are moving to a position,
pressing the button, moving the mouse again and releasing the button:

    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.mouseMoveTo(x + target.offsetWidth / 2, y);
    eventSender.mouseUp();

This code is not going to cause a selection because the button press position
is discarded and a new selection is created with the target in the second
moveTo:

EventHandler.cpp:555

    if (!m_beganSelectingText) {
        m_beganSelectingText = true;
        newSelection = VisibleSelection(targetPosition);
    }

And in the next line we set the extent to the target again:

EventHandler.cpp:561

    newSelection.setExtent(targetPosition);

If you want to select something we would have to use code like this:

    eventSender.mouseDown();
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseMoveTo(x + target.offsetWidth / 2, y);
    eventSender.mouseUp();

The first move sets the initial position of the selection and the second one
the target because m_beganSelectingText is true. This basically means that if
you click with the mouse and move fast enough to get a motion notify far from
the press the selection will start there, not in the button press.

It is easy to reproduce with DRT events but in the  browser is difficult to
reproduce because you get a lot of motion events but if you move the mouse fast
enough when clicking and you print the press and motion positions, you could
check you will be losing selection range.

Hope this helps.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list