Title: [224509] trunk/Source/WebKit
Revision
224509
Author
commit-qu...@webkit.org
Date
2017-11-06 13:35:11 -0800 (Mon, 06 Nov 2017)

Log Message

iOS element fullscreen should use a UIGestureRecognizer to detect user interaction.
https://bugs.webkit.org/show_bug.cgi?id=179029
rdar://problem/35307882

Patch by Jeremy Jones <jere...@apple.com> on 2017-11-06
Reviewed by Simon Fraser.

Replace _WKTapDelegatingView with a UILongPressGestureRecognizer. When set with a duration of 0, it effectively
recognizes UITouchBegin events.

* UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
(-[_WKFullScreenViewController loadView]):
(-[_WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[_WKTapDelegatingView setTarget:action:]): Deleted.
(-[_WKTapDelegatingView hitTest:withEvent:]): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (224508 => 224509)


--- trunk/Source/WebKit/ChangeLog	2017-11-06 21:08:01 UTC (rev 224508)
+++ trunk/Source/WebKit/ChangeLog	2017-11-06 21:35:11 UTC (rev 224509)
@@ -1,3 +1,20 @@
+2017-11-06  Jeremy Jones  <jere...@apple.com>
+
+        iOS element fullscreen should use a UIGestureRecognizer to detect user interaction.
+        https://bugs.webkit.org/show_bug.cgi?id=179029
+        rdar://problem/35307882
+
+        Reviewed by Simon Fraser.
+
+        Replace _WKTapDelegatingView with a UILongPressGestureRecognizer. When set with a duration of 0, it effectively
+        recognizes UITouchBegin events.
+
+        * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
+        (-[_WKFullScreenViewController loadView]):
+        (-[_WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
+        (-[_WKTapDelegatingView setTarget:action:]): Deleted.
+        (-[_WKTapDelegatingView hitTest:withEvent:]): Deleted.
+
 2017-11-06  Chris Dumez  <cdu...@apple.com>
 
         [Service Workers] Add proper implementation for 'updatefound' event

Modified: trunk/Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.mm (224508 => 224509)


--- trunk/Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.mm	2017-11-06 21:08:01 UTC (rev 224508)
+++ trunk/Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.mm	2017-11-06 21:35:11 UTC (rev 224509)
@@ -101,26 +101,7 @@
 } // namespace WebKit
 
 
-@interface _WKTapDelegatingView: UIView
-@property (retain) id target;
-@property (assign) SEL action;
-@end
-
-@implementation _WKTapDelegatingView
-- (void)setTarget:(id)target action:(SEL)action
-{
-    [self setTarget:target];
-    [self setAction:action];
-}
-
-- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
-{
-    [[self target] performSelector:[self action]];
-    return nil;
-}
-@end
-
-@interface _WKFullScreenViewController : UIViewController
+@interface _WKFullScreenViewController : UIViewController <UIGestureRecognizerDelegate>
 @property (retain, nonatomic) NSArray *savedConstraints;
 @property (retain, nonatomic) UIView *contentView;
 @property (retain, nonatomic) id target;
@@ -129,7 +110,7 @@
 
 @implementation _WKFullScreenViewController {
     RetainPtr<UIView> _backgroundView;
-    RetainPtr<_WKTapDelegatingView> _tapView;
+    RetainPtr<UILongPressGestureRecognizer> _touchGestureRecognizer;
     RetainPtr<UIButton> _cancelButton;
     RetainPtr<UIVisualEffectView> _visualEffectView;
 }
@@ -225,10 +206,11 @@
 
     [[self view] addSubview:_cancelButton.get()];
 
-    _tapView = adoptNS([[_WKTapDelegatingView alloc] initWithFrame:[[self view] bounds]]);
-    [_tapView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-    [_tapView setTarget:self action:@selector(showCancelButton)];
-    [[self view] addSubview:_tapView.get()];
+    _touchGestureRecognizer = adoptNS([[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(showCancelButton:)]);
+    [_touchGestureRecognizer setDelegate:self];
+    [_touchGestureRecognizer setCancelsTouchesInView:NO];
+    [_touchGestureRecognizer setMinimumPressDuration:0];
+    [[self view] addGestureRecognizer:_touchGestureRecognizer.get()];
 }
 
 - (void)viewWillAppear:(BOOL)animated
@@ -261,7 +243,7 @@
     }];
 }
 
-- (void)showCancelButton
+- (void)showCancelButton:(id)sender
 {
     [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(hideCancelButton) object:nil];
     [self performSelector:@selector(hideCancelButton) withObject:nil afterDelay:3.0];
@@ -284,6 +266,13 @@
     return YES;
 }
 
+// MARK - UIGestureRecognizerDelegate
+
+- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
+{
+    return YES;
+}
+
 @end
 
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to