New issue
Advanced search Search tips

Issue 715662 link

Starred by 9 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Feature

Blocked on:
issue 739213

Blocking:
issue 775515



Sign in to add a comment

Chrome PDF viewer should pinch-zoom when using a Mac touchpad.

Project Member Reported by dsinclair@chromium.org, Apr 26 2017

Issue description

The browser responds to the pinch-zoom gesture when using a Mac touchpad. We should implement this in the PDF viewer along with the touch pinch-zoom.
 

Comment 1 by kpreid@google.com, Apr 26 2017

Please make sure that the zoom is smooth and arbitrary (not snapping to the currently available discrete zoom levels).

As well as zoom, Apple Preview also allows using two fingers to rotate (individual) pages (in 90° steps). I don't particularly like that feature but it seems worth noting as a matter of what gestures people might expect to work.

Comment 2 by mcnee@chromium.org, Apr 28 2017

So we currently are only able to listen to the raw touch events in javascript and not the higher level gesture events. With the Mac touchpad, we have gesture events that don't originate from touch events, so we can't handle the events ourselves.

Here's an idea of how we could implement this:
1) Extend ppapi to handle gesture events
2) In OutOfProcessInstance::HandleInputEvent, indicate that we've handled the gesture pinch events so that native pinch-zoom is prevented
3) PostMessage the gesture event information to the page so that gesture_detector.js can see it and pass it on to its listeners to invoke our custom pinch-zoom
Mac trackpad pinch generates a sequence of MouseWheel events. These exist
primarily to provide a way for JS to disable trackpad pinch if desired, but
they do carry information about pinch scale. Assuming we can find a way to
differentiate them from trackpad scroll (the pinch wheels all have the
control modifier set, may this is enough), then we can unpack the
information about the intended scale and use that to provide pinch.

Of course, GesturePinchX events never make it into the WebView, so we'd
have to be sure that the mouse-wheels propagate properly to the WebView for
this to work.

Comment 4 by mcnee@chromium.org, May 1 2017

It looks like the pdf viewer does not see the wheel events from a touchpad pinch, although it does see the wheel events from a touchpad scroll.
Correct ... only the "parent" will see those wheels ... and I guess we
don't forward them to the guest either. I suppose we could imagine adding
JS to the page that embeds the WV to do something reasonable, like
post-messaging the wheels through, though not sure if that would (1) be
acceptable to the Blink folks, or (2) have security implications.
Status: Available (was: Untriaged)

Comment 7 by ebra...@gnu.org, Jun 22 2017

Cc: ebra...@gnu.org

Comment 8 by sdy@chromium.org, Sep 26 2017

Issue 767501 has been merged into this issue.

Comment 9 by mcnee@chromium.org, Oct 12 2017

Blockedon: 739213
Owner: mcnee@chromium.org
Status: Assigned (was: Available)
Blocking: 775515

Comment 11 by mcnee@chromium.org, Oct 20 2017

Status: Started (was: Assigned)
Project Member

Comment 12 by bugdroid1@chromium.org, Nov 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bc61eb6a67219aa4352a4767d62d5b46719ca03e

commit bc61eb6a67219aa4352a4767d62d5b46719ca03e
Author: Kevin McNee <mcnee@chromium.org>
Date: Mon Nov 13 20:39:14 2017

PDF viewer: Handle ctrl-wheel zooming with the viewer's pinch zoom mechanism.

When pinch zooming with a Mac trackpad, we generate synthetic ctrl-wheels
so that JS can handle the gesture. We now use these wheel events in the
PDF viewer's gesture detector to create pinch events for the viewer's
pinch zoom mechanism, as we currently do for pinches from touch events.

We also use this for non-synthetic ctrl-wheels. This allows us to have
zooming with the mouse wheel anchor the zoom around the mouse position
instead of the scroll position.

Bug:  715662 ,  715670 
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ia672a266cdd69c3e87d1451548c7470176ed8fd6
Reviewed-on: https://chromium-review.googlesource.com/730648
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516034}
[modify] https://crrev.com/bc61eb6a67219aa4352a4767d62d5b46719ca03e/chrome/browser/pdf/pdf_extension_test.cc
[modify] https://crrev.com/bc61eb6a67219aa4352a4767d62d5b46719ca03e/chrome/browser/resources/pdf/gesture_detector.js
[modify] https://crrev.com/bc61eb6a67219aa4352a4767d62d5b46719ca03e/chrome/test/data/pdf/gesture_detector_test.js
[modify] https://crrev.com/bc61eb6a67219aa4352a4767d62d5b46719ca03e/content/public/test/browser_test_utils.cc
[modify] https://crrev.com/bc61eb6a67219aa4352a4767d62d5b46719ca03e/content/public/test/browser_test_utils.h

Comment 13 by mcnee@chromium.org, Nov 14 2017

Status: Fixed (was: Started)

Sign in to add a comment