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

Unified Diff: Source/web/WebInputEventFactoryMac.mm

Issue 184983003: Update WebInputEventFactory on Mac for pinch gesture support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebInputEventFactoryMac.mm
diff --git a/Source/web/WebInputEventFactoryMac.mm b/Source/web/WebInputEventFactoryMac.mm
index 516ae2f853cdd07e02e49007cfbbb4cee390f8cf..303fb04ef5001b8fa1fe087a42623e574ce1a283 100644
--- a/Source/web/WebInputEventFactoryMac.mm
+++ b/Source/web/WebInputEventFactoryMac.mm
@@ -366,19 +366,6 @@ static int windowsKeyCodeForKeyEvent(NSEvent* event)
return windowsKeyCodeForKeyCode([event keyCode]);
}
-static WebInputEvent::Type gestureEventTypeForEvent(NSEvent *event)
-{
- switch ([event type]) {
- case NSEventTypeBeginGesture:
- return WebInputEvent::GestureScrollBegin;
- case NSEventTypeEndGesture:
- return WebInputEvent::GestureScrollEnd;
- default:
- ASSERT_NOT_REACHED();
- return WebInputEvent::GestureScrollEnd;
- }
-}
-
static inline NSString* textFromEvent(NSEvent* event)
{
if ([event type] == NSFlagsChanged)
@@ -1138,10 +1125,21 @@ WebGestureEvent WebInputEventFactory::gestureEvent(NSEvent *event, NSView *view)
result.globalX = temp.globalX;
result.globalY = temp.globalY;
- result.type = gestureEventTypeForEvent(event);
result.modifiers = modifiersFromEvent(event);
result.timeStampSeconds = [event timestamp];
+ // MacOS X gestures are used only for pinch support.
+ result.sourceDevice = WebGestureEvent::Touchpad;
+ switch ([event type]) {
+ case NSEventTypeMagnify:
+ result.type = WebInputEvent::GesturePinchUpdate;
+ result.data.pinchUpdate.scale = [event magnification];
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ result.type = WebInputEvent::Undefined;
+ }
+
return result;
}
« 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