diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-23 23:22:54 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-23 23:22:54 +0000 |
commit | ff00968f75fd1a82532b0009f535310db5a9556c (patch) | |
tree | 0f00cd0a24103602635e1f0350b3f33090ab6a4f | |
parent | 2f74428eee5f226ccdba805b91bd7e45a0f7a4e4 (diff) | |
download | chromium_src-ff00968f75fd1a82532b0009f535310db5a9556c.zip chromium_src-ff00968f75fd1a82532b0009f535310db5a9556c.tar.gz chromium_src-ff00968f75fd1a82532b0009f535310db5a9556c.tar.bz2 |
Lion: Make history swipes easier to cancel.
Patch from jamesrtclarke@gmail.com!
BUG=104013
TEST=start a right-left swipe, and then quickly swipe back to the left.
No navigation should happen.
Review URL: http://codereview.chromium.org/8960005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115742 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm index 60cc143..854e939 100644 --- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm +++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm @@ -217,9 +217,22 @@ class SpellCheckRenderViewObserver : public content::RenderViewHostObserver { // toward 0. When gestureAmount has reaches its final value, i.e. the // track animation is done, the handler is called with |isComplete| set // to |YES|. + // When starting a backwards navigation gesture (swipe from left to right, + // gestureAmount will go from 0 to 1), if the user swipes from left to + // right and then quickly back to the left, this call can send + // NSEventPhaseEnded and then animate to gestureAmount of -1. For a + // picture viewer, that makes sense, but for back/forward navigation users + // find it confusing. There are two ways to prevent this: + // 1. Set Options to NSEventSwipeTrackingLockDirection. This way, + // gestureAmount will always stay > 0. + // 2. Pass min:0 max:1 (instead of min:-1 max:1). This way, gestureAmount + // will become less than 0, but on the quick swipe back to the left, + // NSEventPhaseCancelled is sent instead. + // The overshoot behavior of (2) looks nicer with the current UI, so let's + // do that for now. [theEvent trackSwipeEventWithOptions:0 - dampenAmountThresholdMin:-1 - max:1 + dampenAmountThresholdMin:goForward ? -1 : 0 + max:goForward ? 0 : 1 usingHandler:^(CGFloat gestureAmount, NSEventPhase phase, BOOL isComplete, |