Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: Source/web/WebInputEventFactoryMac.mm

Issue 906623003: Mac: Enable two finger double-tap smart zoom (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporate review feedback Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2006-2009 Google Inc. 3 * Copyright (C) 2006-2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 #endif // __MAC_OS_X_VERSION_MAX_ALLOWED == 1060 56 #endif // __MAC_OS_X_VERSION_MAX_ALLOWED == 1060
57 57
58 #if __MAC_OS_X_VERSION_MAX_ALLOWED < 1080 58 #if __MAC_OS_X_VERSION_MAX_ALLOWED < 1080
59 59
60 // Additional Mountain Lion APIs. 60 // Additional Mountain Lion APIs.
61 enum { 61 enum {
62 NSEventPhaseMayBegin = 0x1 << 5 62 NSEventPhaseMayBegin = 0x1 << 5
63 }; 63 };
64 64
65 enum {
66 NSEventTypeSmartMagnify = 32
67 };
68
65 #endif // __MAC_OS_X_VERSION_MAX_ALLOWED < 1080 69 #endif // __MAC_OS_X_VERSION_MAX_ALLOWED < 1080
66 70
67 namespace blink { 71 namespace blink {
68 72
69 static int windowsKeyCodeForKeyCode(uint16_t keyCode) 73 static int windowsKeyCodeForKeyCode(uint16_t keyCode)
70 { 74 {
71 static const int windowsKeyCode[] = { 75 static const int windowsKeyCode[] = {
72 /* 0 */ VK_A, 76 /* 0 */ VK_A,
73 /* 1 */ VK_S, 77 /* 1 */ VK_S,
74 /* 2 */ VK_D, 78 /* 2 */ VK_D,
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 1145
1142 result.modifiers = modifiersFromEvent(event); 1146 result.modifiers = modifiersFromEvent(event);
1143 result.timeStampSeconds = [event timestamp]; 1147 result.timeStampSeconds = [event timestamp];
1144 1148
1145 result.sourceDevice = WebGestureDeviceTouchpad; 1149 result.sourceDevice = WebGestureDeviceTouchpad;
1146 switch ([event type]) { 1150 switch ([event type]) {
1147 case NSEventTypeMagnify: 1151 case NSEventTypeMagnify:
1148 result.type = WebInputEvent::GesturePinchUpdate; 1152 result.type = WebInputEvent::GesturePinchUpdate;
1149 result.data.pinchUpdate.scale = [event magnification] + 1.0; 1153 result.data.pinchUpdate.scale = [event magnification] + 1.0;
1150 break; 1154 break;
1155 case NSEventTypeSmartMagnify:
1156 // Map the Cocoa "double-tap with two fingers" zoom gesture to regular
1157 // GestureDoubleTap, because the effect is similar to single-finger
1158 // double-tap zoom on mobile platforms. Note that tapCount is set to 1
1159 // because the gesture type already encodes that information.
1160 result.type = WebInputEvent::GestureDoubleTap;
1161 result.data.tap.tapCount = 1;
1162 break;
1151 case NSEventTypeBeginGesture: 1163 case NSEventTypeBeginGesture:
1152 case NSEventTypeEndGesture: 1164 case NSEventTypeEndGesture:
1153 // The specific type of a gesture is not defined when the gesture begin 1165 // The specific type of a gesture is not defined when the gesture begin
1154 // and end NSEvents come in. Leave them undefined. The caller will need 1166 // and end NSEvents come in. Leave them undefined. The caller will need
1155 // to specify them when the gesture is differentiated. 1167 // to specify them when the gesture is differentiated.
1156 result.type = WebInputEvent::Undefined; 1168 result.type = WebInputEvent::Undefined;
1157 break; 1169 break;
1158 default: 1170 default:
1159 ASSERT_NOT_REACHED(); 1171 ASSERT_NOT_REACHED();
1160 result.type = WebInputEvent::Undefined; 1172 result.type = WebInputEvent::Undefined;
1161 } 1173 }
1162 1174
1163 return result; 1175 return result;
1164 } 1176 }
1165 1177
1166 } // namespace blink 1178 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698