Synthesize ctrl-wheel events on touchpad pinch

On Windows, pinch gestures on a touchpad typically sends wheel events
with the ctrlKey modifier set.  This CL makes Chrome on Mac do the same
thing so that pages that are 'naturally zoomable' (eg. maps) get a
chance to override the pinch behavior before we use it to do browser
zoom.  Getting browser zoom on pinch is a long standing source of
confusion for users of Google Maps.  See http://goo.gl/84CTaJ for
discussion.

To be compatible with existing uses of wheel events, the deltaY value
in the wheel event is computed as -100*log(scale).  So zooming in 2x is
about -70 and zooming out 2x is 70. To compute a scale factor from this
value in JavaScript use 'Math.exp(-deltaY / 100)'.  See demo at
http://jsbin.com/qiyaseza/.

We expect to eventually want this change on ChromeOS as well (once
ChromeOS wires pinch up to pinch-zoom), and so this transformation
belongs in InputRouter.

The trickiest part of this change is handling the WheelEvent ACK
messages properly.  If the wheel was synthesized from a
GesturePinchUpdate, we need to convert the ACK back to the right type.
To do this I attach a 'synthesized_from_pinch' bit to each
WebWheelEvent in InputRouter's coalesced_mouse_wheel_events_ and to the
current_wheel_event_.  Then when I get a wheel ACK I use this bit on
current_wheel_event_ to decide how it should be handled.

This removes some old code which flushed any pending wheel events
whenever we got a non-wheel event.  Doing that causes us to ignore (or
possibly misattribute) the ACKs we'll eventually get back from the
renderer for these events.  This was probably already responsible for
some bugs with the Overscroll controller (which relies on
current_wheel_event representing THE event that we received an ACK for)
and  would be very problematic for the pinch-derived wheels where
(since the GestureEventQueue expects to reliably get an ack per event).
I tracked this code back to http://crbug.com/154740 where it was added
to cope with the fact that we were discarding pending wheel events.  I
think a better fix for that is to just continue to queue and send wheel
events, even when there are other events happening (as we do for
interleaving touch and gesture events with other events).

BUG=289887

Review URL: https://codereview.chromium.org/250923004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267822 0039d316-1c4b-4281-b951-d872f2087c98
12 files changed