diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm index a3eee3178a066f..e1893809e7ba72 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -13,6 +13,7 @@ #include "base/containers/contains.h" #include "base/debug/crash_logging.h" +#include "base/mac/mac_util.h" #import "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "components/remote_cocoa/app_shim/ns_view_ids.h" @@ -1404,6 +1405,27 @@ - (void)scrollWheel:(NSEvent*)event { // Called repeatedly during a pinch gesture, with incremental change values. - (void)magnifyWithEvent:(NSEvent*)event { + if (base::mac::IsAtLeastOS10_11()) { + if (event.phase == NSEventPhaseBegan) { + [self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO]; + return; + } + + if (event.phase == NSEventPhaseEnded || + event.phase == NSEventPhaseCancelled) { + [self handleEndGestureWithEvent:event]; + return; + } + } + + // If this conditional evalutes to true, and the function has not + // short-circuited from the previous block, then this event is a duplicate of + // a gesture event, and should be ignored. + if (event.phase == NSEventPhaseBegan || event.phase == NSEventPhaseEnded || + event.phase == NSEventPhaseCancelled) { + return; + } + WebGestureEvent updateEvent = WebGestureEventBuilder::Build(event, self); _hostHelper->GestureUpdate(updateEvent); }