Comment 29 for bug 62071

Revision history for this message
In , Akkana Peck (akkzilla) wrote :

(Thanks for the clear summary, R.K.Aa)

What I'm seeing: the scrollbar jumps, as expected, but then the paste happens
anyway.

I thought initially that this probably meant that PreventDefault wasn't being
called on the mouse button event. But I tried a simple fix for that, and when
it didn't work I poked around a bit to find out why, and here's the scoop:

So then I suspected that the scroll was being handled by
nsSliderFrame::MouseDown ... which in fact does not call PreventDefault, but
adding it doesn't help. The paste is being handled by
nsTextEditorMouseListener::MouseClick (which doesn't check for
GetPreventDefault, but adding that doesn't help either). See the problem?
MouseDown is one event, and MouseClick is a different event, so handling the
first doesn't prevent the second from happening.

Moving the editor's middleclick handling from MouseClick to MouseDown cures the
problem, but that's not the right solution: it really should be handled on
click, not down, and I suspect that it's only using mouse down in layout because
it was a convenience since the twips calculation code that handles dragging was
already in that routine. Anyway, factoring out the relevant code isn't difficult.

Unfortunately, it turns out that nsSliderFrame::MouseDown is not in fact where
the scroll is being handled. There's probably another routine somewhere that
does the same thing, in the same way, also on MouseDown instead of MouseClick;
and if we could find that routine, we could move it to MouseClick instead.
Anybody else have better luck with finding this than I'm having?