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

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: 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 result.type = WebInputEvent::GestureDoubleTap;
aelias_OOO_until_Jul13 2015/02/07 01:48:00 I think this is worth a comment: // Map the OS X
ccameron 2015/02/07 08:19:41 Good idea (and thanks for the wording suggestion).
1157 result.data.tap.tapCount = 1;
1158 break;
1151 case NSEventTypeBeginGesture: 1159 case NSEventTypeBeginGesture:
1152 case NSEventTypeEndGesture: 1160 case NSEventTypeEndGesture:
1153 // The specific type of a gesture is not defined when the gesture begin 1161 // 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 1162 // and end NSEvents come in. Leave them undefined. The caller will need
1155 // to specify them when the gesture is differentiated. 1163 // to specify them when the gesture is differentiated.
1156 result.type = WebInputEvent::Undefined; 1164 result.type = WebInputEvent::Undefined;
1157 break; 1165 break;
1158 default: 1166 default:
1159 ASSERT_NOT_REACHED(); 1167 ASSERT_NOT_REACHED();
1160 result.type = WebInputEvent::Undefined; 1168 result.type = WebInputEvent::Undefined;
1161 } 1169 }
1162 1170
1163 return result; 1171 return result;
1164 } 1172 }
1165 1173
1166 } // namespace blink 1174 } // 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