[webkit-dev] selecting text ignores mouse down position

Ryosuke Niwa rniwa at webkit.org
Fri Mar 11 11:39:08 PST 2011

I think this is a WebKit bug indeed.  I've been annoyed by this bug quite
few times and have been trying to figure out the reason.  Thanks for
spotting the root cause!

- Ryosuke

On Fri, Mar 11, 2011 at 11:34 AM, Evan Martin <evan at chromium.org> wrote:

> The simple layout test below demonstrates that when you select text by
> clicking and dragging, we ignore the position of the initial mouse
> down and instead rely on mouse move events to judge what text is
> selected.  I verified the behavior on Linux (Chrome) and Mac
> (non-Chrome).
> Is it expected that the platform sends a mouse move event at the
> position of the initial mouse down when dragging?
> Or is this a bug in WebKit?  I'm trying to figure out which layer I
> should fix this at.
> I manually verified on Chrome Linux via some logging statements that
> if I move the mouse rapidly and drag, the mouse down position is
> sometimes a pixel away from the first mouse move event position.
> <div id='text'>The first part of this text should be selected.</div>
> <script>
> if (window.eventSender) {
>    var div = document.getElementById('text');
>    var x = div.offsetLeft + 1;
>    var y = div.offsetTop + 5;
>    eventSender.mouseMoveTo(x, y);
>    eventSender.mouseDown();
>    // With this mouse move event, we select the initial range of text.
>    // Without it, we don't -- we just get the caret positioned within the
> text.
>    eventSender.mouseMoveTo(x, y);
>    eventSender.mouseMoveTo(x + 50, y);
>    eventSender.mouseUp();
> }
> </script>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110311/0813ff9d/attachment.html>

More information about the webkit-dev mailing list