Index: chrome/browser/ui/cocoa/browser_window_controller.mm |
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm |
index 6e4a26ae3e6c2017a59688886d76f1bc2f4fb8eb..e8aaf325ec0d5b576754f54f06eceedbecaa657c 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm |
@@ -1673,13 +1673,23 @@ typedef NSInteger NSWindowAnimationBehavior; |
// Documented in 10.6+, but present starting in 10.5. Called when we get a |
// three-finger swipe. |
- (void)swipeWithEvent:(NSEvent*)event { |
+ CGFloat deltaX = [event deltaX]; |
+ CGFloat deltaY = [event deltaY]; |
+ |
+ // On Lion, the user can choose to use a "natural" scroll direction with |
+ // inverted axes. |
+ if ([self isScrollDirectionInverted]) { |
+ deltaX *= -1; |
+ deltaY *= -1; |
+ } |
+ |
// Map forwards and backwards to history; left is positive, right is negative. |
unsigned int command = 0; |
- if ([event deltaX] > 0.5) { |
+ if (deltaX > 0.5) { |
command = IDC_BACK; |
- } else if ([event deltaX] < -0.5) { |
+ } else if (deltaX < -0.5) { |
command = IDC_FORWARD; |
- } else if ([event deltaY] > 0.5) { |
+ } else if (deltaY > 0.5) { |
// TODO(pinkerton): figure out page-up, http://crbug.com/16305 |
} else if ([event deltaY] < -0.5) { |
// TODO(pinkerton): figure out page-down, http://crbug.com/16305 |
@@ -1787,6 +1797,11 @@ typedef NSInteger NSWindowAnimationBehavior; |
return; |
CGFloat sum = std::accumulate(magnitudes.begin(), magnitudes.end(), 0.0f); |
+ // On Lion, the user can choose to use a "natural" scroll direction with |
+ // inverted axes. |
+ if ([self isScrollDirectionInverted]) |
+ sum *= -1; |
+ |
int command_id = 0; |
if (sum > 0.3) |
command_id = IDC_FORWARD; |