Swipe gesture can get stuck, preventing scrolling and other gestures
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jun 2015 00:03:42 +0000 (00:03 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jun 2015 00:03:42 +0000 (00:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146088
<rdar://problem/16056087>

Reviewed by Darin Adler.

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::trackSwipeGesture):
Ignore mouse events that come in while we're doing a swipe.
This prevents potentially problematic mouse events (especially context menus)
won't be processed during a swipe, avoiding situations that can cause
the swipe gesture to get stuck.

* WebCore.xcodeproj/project.pbxproj:
* platform/spi/mac/NSEventSPI.h: Added.
Add an SPI header.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185679 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/spi/mac/NSEventSPI.h [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm

index 0390d96..ea16da6 100644 (file)
@@ -1,3 +1,15 @@
+2015-06-17  Tim Horton  <timothy_horton@apple.com>
+
+        Swipe gesture can get stuck, preventing scrolling and other gestures
+        https://bugs.webkit.org/show_bug.cgi?id=146088
+        <rdar://problem/16056087>
+
+        Reviewed by Darin Adler.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/spi/mac/NSEventSPI.h: Added.
+        Add an SPI header.
+
 2015-06-16  Matt Rajca  <mrajca@apple.com>
 
         MediaSession: handle MediaEventTrackNext and MediaEventTrackPrevious events
index 0208cb5..e872b75 100644 (file)
                2D9A247515B9C2E300D34527 /* DOMDOMSecurityPolicyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9A247115B9C29500D34527 /* DOMDOMSecurityPolicyInternal.h */; };
                2D9A247615B9C2F400D34527 /* DOMDOMSecurityPolicy.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 2D9A247015B9C29500D34527 /* DOMDOMSecurityPolicy.h */; };
                2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; };
+               2DB9C4AA1B3231F40070F27F /* NSEventSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DB9C4A91B3231F40070F27F /* NSEventSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2DCB837919F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2DCB837A19F99BBA00A7FBE4 /* NSSharingServiceSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2DDB97F419F9AECA002025D8 /* NSExtensionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */ = {isa = PBXFileReference; lastKnownFileType = file; path = linearSRGB.icc; sourceTree = "<group>"; };
                2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockPageOverlayClient.cpp; sourceTree = "<group>"; };
                2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockPageOverlayClient.h; sourceTree = "<group>"; };
+               2DB9C4A91B3231F40070F27F /* NSEventSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSEventSPI.h; sourceTree = "<group>"; };
                2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSSharingServicePickerSPI.h; sourceTree = "<group>"; };
                2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSSharingServiceSPI.h; sourceTree = "<group>"; };
                2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSExtensionSPI.h; sourceTree = "<group>"; };
                                07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */,
                                2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */,
                                2D413F601A187A3F0041A521 /* LookupSPI.h */,
+                               2DB9C4A91B3231F40070F27F /* NSEventSPI.h */,
                                1C6466271A12C3F90094603C /* NSFontSPI.h */,
                                9321D58F1A3906FA008052BE /* NSImmediateActionGestureRecognizerSPI.h */,
                                937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */,
                                85032DE30AA8C9BE007D3B7D /* DOMCSSRuleList.h in Headers */,
                                85E711920AC5D5350053270F /* DOMCSSRuleListInternal.h in Headers */,
                                85032DE50AA8C9BE007D3B7D /* DOMCSSStyleDeclaration.h in Headers */,
+                               2DB9C4AA1B3231F40070F27F /* NSEventSPI.h in Headers */,
                                85E711930AC5D5350053270F /* DOMCSSStyleDeclarationInternal.h in Headers */,
                                85032DE70AA8C9BE007D3B7D /* DOMCSSStyleRule.h in Headers */,
                                85909CE20ACC7A7E00DF01F1 /* DOMCSSStyleRuleInternal.h in Headers */,
diff --git a/Source/WebCore/platform/spi/mac/NSEventSPI.h b/Source/WebCore/platform/spi/mac/NSEventSPI.h
new file mode 100644 (file)
index 0000000..11dd022
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <AppKit/NSEvent_Private.h>
+
+#else
+
+enum {
+    NSEventSwipeTrackingConsumeMouseEvents = 0x1 << 2
+};
+
+#endif
index 0dc560e..5d85a39 100644 (file)
@@ -1,3 +1,18 @@
+2015-06-17  Tim Horton  <timothy_horton@apple.com>
+
+        Swipe gesture can get stuck, preventing scrolling and other gestures
+        https://bugs.webkit.org/show_bug.cgi?id=146088
+        <rdar://problem/16056087>
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::trackSwipeGesture):
+        Ignore mouse events that come in while we're doing a swipe.
+        This prevents potentially problematic mouse events (especially context menus)
+        won't be processed during a swipe, avoiding situations that can cause
+        the swipe gesture to get stuck.
+
 2015-06-17  Sungmann Cho  <sungmann.cho@navercorp.com>
 
         Remove willSendEventToPlugin() from PluginController.h.
index 6a8f746..286b1d5 100644 (file)
@@ -41,6 +41,7 @@
 #import "WebProcessProxy.h"
 #import <Cocoa/Cocoa.h>
 #import <WebCore/IOSurface.h>
+#import <WebCore/NSEventSPI.h>
 #import <WebCore/QuartzCoreSPI.h>
 #import <WebCore/WebActionDisablingCALayerDelegate.h>
 
@@ -407,7 +408,7 @@ void ViewGestureController::trackSwipeGesture(NSEvent *event, SwipeDirection dir
     RetainPtr<WKSwipeCancellationTracker> swipeCancellationTracker = adoptNS([[WKSwipeCancellationTracker alloc] init]);
     m_swipeCancellationTracker = swipeCancellationTracker;
 
-    [event trackSwipeEventWithOptions:0 dampenAmountThresholdMin:minProgress max:maxProgress usingHandler:^(CGFloat progress, NSEventPhase phase, BOOL isComplete, BOOL *stop) {
+    [event trackSwipeEventWithOptions:NSEventSwipeTrackingConsumeMouseEvents dampenAmountThresholdMin:minProgress max:maxProgress usingHandler:^(CGFloat progress, NSEventPhase phase, BOOL isComplete, BOOL *stop) {
         if ([swipeCancellationTracker isCancelled]) {
             *stop = YES;
             return;