Title: [233569] branches/safari-606.1.24-branch/Source/WebKit
Revision
233569
Author
[email protected]
Date
2018-07-05 23:43:24 -0700 (Thu, 05 Jul 2018)

Log Message

Cherry-pick r233546. rdar://problem/41867306

    Upstream hover gesture implementation
    https://bugs.webkit.org/show_bug.cgi?id=187366

    Reviewed by Wenson Hsieh.

    * UIProcess/ios/WKContentViewInteraction.h:
    * UIProcess/ios/WKContentViewInteraction.mm:
    (-[WKContentView setupInteraction]):
    (-[WKContentView cleanupInteraction]):
    (-[WKContentView _removeDefaultGestureRecognizers]):
    (-[WKContentView _addDefaultGestureRecognizers]):
    (-[WKContentView _hoverGestureRecognizerChanged:]):

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

Modified Paths

Diff

Modified: branches/safari-606.1.24-branch/Source/WebKit/ChangeLog (233568 => 233569)


--- branches/safari-606.1.24-branch/Source/WebKit/ChangeLog	2018-07-06 06:40:21 UTC (rev 233568)
+++ branches/safari-606.1.24-branch/Source/WebKit/ChangeLog	2018-07-06 06:43:24 UTC (rev 233569)
@@ -1,3 +1,38 @@
+2018-07-05  Babak Shafiei  <[email protected]>
+
+        Cherry-pick r233546. rdar://problem/41867306
+
+    Upstream hover gesture implementation
+    https://bugs.webkit.org/show_bug.cgi?id=187366
+    
+    Reviewed by Wenson Hsieh.
+    
+    * UIProcess/ios/WKContentViewInteraction.h:
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView setupInteraction]):
+    (-[WKContentView cleanupInteraction]):
+    (-[WKContentView _removeDefaultGestureRecognizers]):
+    (-[WKContentView _addDefaultGestureRecognizers]):
+    (-[WKContentView _hoverGestureRecognizerChanged:]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-05  Tim Horton  <[email protected]>
+
+            Upstream hover gesture implementation
+            https://bugs.webkit.org/show_bug.cgi?id=187366
+
+            Reviewed by Wenson Hsieh.
+
+            * UIProcess/ios/WKContentViewInteraction.h:
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView setupInteraction]):
+            (-[WKContentView cleanupInteraction]):
+            (-[WKContentView _removeDefaultGestureRecognizers]):
+            (-[WKContentView _addDefaultGestureRecognizers]):
+            (-[WKContentView _hoverGestureRecognizerChanged:]):
+
 2018-07-04  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r233325): [GTK] Broke 40 animations tests

Modified: branches/safari-606.1.24-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (233568 => 233569)


--- branches/safari-606.1.24-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-07-06 06:40:21 UTC (rev 233568)
+++ branches/safari-606.1.24-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-07-06 06:43:24 UTC (rev 233569)
@@ -77,21 +77,15 @@
 class WebPageProxy;
 }
 
+@class _UIHighlightView;
+@class _UIWebHighlightLongPressGestureRecognizer;
+@class UIHoverGestureRecognizer;
+@class WebEvent;
 @class WKActionSheetAssistant;
+@class WKFocusedFormControlView;
 @class WKFormInputSession;
 @class WKInspectorNodeSearchGestureRecognizer;
-@class WebEvent;
-@class _UIHighlightView;
-@class _UIWebHighlightLongPressGestureRecognizer;
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WKContentViewInteractionAdditionsBefore.h>
-#endif
-
-#if PLATFORM(WATCHOS)
-@class WKFocusedFormControlView;
-#endif
-
 typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput);
 typedef void (^UIWKAutocorrectionContextHandler)(UIWKAutocorrectionContext *autocorrectionContext);
 typedef void (^UIWKDictationContextHandler)(NSString *selectedText, NSString *beforeText, NSString *afterText);
@@ -151,10 +145,6 @@
 
     BOOL _canSendTouchEventsAsynchronously;
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WKContentViewInteractionAdditionsAfter.h>
-#endif
-
     RetainPtr<WKSyntheticClickTapGestureRecognizer> _singleTapGestureRecognizer;
     RetainPtr<_UIWebHighlightLongPressGestureRecognizer> _highlightLongPressGestureRecognizer;
     RetainPtr<UILongPressGestureRecognizer> _longPressGestureRecognizer;
@@ -164,6 +154,10 @@
     RetainPtr<UITapGestureRecognizer> _twoFingerSingleTapGestureRecognizer;
     RetainPtr<WKInspectorNodeSearchGestureRecognizer> _inspectorNodeSearchGestureRecognizer;
 
+#if PLATFORM(IOSMAC)
+    RetainPtr<UIHoverGestureRecognizer> _hoverGestureRecognizer;
+#endif
+
     RetainPtr<UIWKTextInteractionAssistant> _textSelectionAssistant;
     RetainPtr<UIWKSelectionAssistant> _webSelectionAssistant;
     BOOL _suppressAssistantSelectionView;

Modified: branches/safari-606.1.24-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (233568 => 233569)


--- branches/safari-606.1.24-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-07-06 06:40:21 UTC (rev 233568)
+++ branches/safari-606.1.24-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-07-06 06:43:24 UTC (rev 233569)
@@ -105,8 +105,10 @@
 #import <WebCore/WebItemProviderPasteboard.h>
 #endif
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WKContentViewInteractionAdditionsBefore.mm>
+#if PLATFORM(IOSMAC)
+#import "NativeWebMouseEvent.h"
+#import <UIKit/UIHoverGestureRecognizer.h>
+#import <pal/spi/ios/GraphicsServicesSPI.h>
 #endif
 
 @interface UIEvent(UIEventInternal)
@@ -617,8 +619,10 @@
     [_touchEventGestureRecognizer setDelegate:self];
     [self addGestureRecognizer:_touchEventGestureRecognizer.get()];
 
-#if USE(APPLE_INTERNAL_SDK)
-    [self _internalSetupInteraction];
+#if PLATFORM(IOSMAC)
+    _hoverGestureRecognizer = adoptNS([[UIHoverGestureRecognizer alloc] initWithTarget:self action:@selector(_hoverGestureRecognizerChanged:)]);
+    [_hoverGestureRecognizer setDelegate:self];
+    [self addGestureRecognizer:_hoverGestureRecognizer.get()];
 #endif
 
     _singleTapGestureRecognizer = adoptNS([[WKSyntheticClickTapGestureRecognizer alloc] initWithTarget:self action:@selector(_singleTapCommited:)]);
@@ -711,8 +715,9 @@
     [_touchEventGestureRecognizer setDelegate:nil];
     [self removeGestureRecognizer:_touchEventGestureRecognizer.get()];
 
-#if USE(APPLE_INTERNAL_SDK)
-    [self _internalCleanupInteraction];
+#if PLATFORM(IOSMAC)
+    [_hoverGestureRecognizer setDelegate:nil];
+    [self removeGestureRecognizer:_hoverGestureRecognizer.get()];
 #endif
 
     [_singleTapGestureRecognizer setDelegate:nil];
@@ -775,9 +780,8 @@
     [self removeGestureRecognizer:_nonBlockingDoubleTapGestureRecognizer.get()];
     [self removeGestureRecognizer:_twoFingerDoubleTapGestureRecognizer.get()];
     [self removeGestureRecognizer:_twoFingerSingleTapGestureRecognizer.get()];
-
-#if USE(APPLE_INTERNAL_SDK)
-    [self _internalRemoveDefaultGestureRecognizers];
+#if PLATFORM(IOSMAC)
+    [self removeGestureRecognizer:_hoverGestureRecognizer.get()];
 #endif
 }
 
@@ -790,9 +794,8 @@
     [self addGestureRecognizer:_nonBlockingDoubleTapGestureRecognizer.get()];
     [self addGestureRecognizer:_twoFingerDoubleTapGestureRecognizer.get()];
     [self addGestureRecognizer:_twoFingerSingleTapGestureRecognizer.get()];
-
-#if USE(APPLE_INTERNAL_SDK)
-    [self _internalAddDefaultGestureRecognizers];
+#if PLATFORM(IOSMAC)
+    [self addGestureRecognizer:_hoverGestureRecognizer.get()];
 #endif
 }
 
@@ -5657,8 +5660,31 @@
 
 #endif // PLATFORM(WATCHOS)
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WKContentViewInteractionAdditionsAfter.mm>
+#if PLATFORM(IOSMAC)
+- (void)_hoverGestureRecognizerChanged:(UIGestureRecognizer *)gestureRecognizer
+{
+    if (!_page->isValid())
+        return;
+
+    // Make a timestamp that matches UITouch and UIEvent.
+    CFTimeInterval timestamp = GSCurrentEventTimestamp() / 1000000000.0;
+
+    CGPoint point;
+    switch (gestureRecognizer.state) {
+    case UIGestureRecognizerStateBegan:
+    case UIGestureRecognizerStateChanged:
+        point = [gestureRecognizer locationInView:self];
+        break;
+    case UIGestureRecognizerStateEnded:
+    case UIGestureRecognizerStateCancelled:
+    default:
+        point = CGPointMake(-1, -1);
+        break;
+    }
+
+    auto event = adoptNS([[::WebEvent alloc] initWithMouseEventType:WebEventMouseMoved timeStamp:timestamp location:point]);
+    _page->handleMouseEvent(NativeWebMouseEvent(event.get()));
+}
 #endif
 
 @end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to