Title: [228016] trunk/Source/WebKit
Revision
228016
Author
wenson_hs...@apple.com
Date
2018-02-02 09:44:36 -0800 (Fri, 02 Feb 2018)

Log Message

[Extra Zoom Mode] Implement support for indirect mainframe scrolling
https://bugs.webkit.org/show_bug.cgi?id=182421
<rdar://problem/35142694>

Reviewed by Tim Horton.

Makes a few small adjustments to WKScrollView to improve mainframe scrolling, and disable the pinch gesture for
zooming. See below for more details.

* UIProcess/API/Cocoa/WKWebView.mm:

Remove a now-unneeded WebKitAdditions import.

* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView initWithFrame:]):

Add imports for -Before and -After versions of WKScrollViewAdditions.

(-[WKScrollView addGestureRecognizer:]):

Override -addGestureRecognizer here to prevent touches on the pinch gesture recognizer from being recognized.
I chose this approach instead of just disabling the gesture in -initWithFrame: because (1) the pinch gesture
recognizer is lazily created when setting minimum or maximum zoom scales, rather than immediately in
-initWithFrame:, and (2) even if we set the -enabled to NO, UIKit later resets it to YES in other codepaths.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (228015 => 228016)


--- trunk/Source/WebKit/ChangeLog	2018-02-02 17:33:53 UTC (rev 228015)
+++ trunk/Source/WebKit/ChangeLog	2018-02-02 17:44:36 UTC (rev 228016)
@@ -1,3 +1,30 @@
+2018-02-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra Zoom Mode] Implement support for indirect mainframe scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=182421
+        <rdar://problem/35142694>
+
+        Reviewed by Tim Horton.
+
+        Makes a few small adjustments to WKScrollView to improve mainframe scrolling, and disable the pinch gesture for
+        zooming. See below for more details.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+
+        Remove a now-unneeded WebKitAdditions import.
+
+        * UIProcess/ios/WKScrollView.mm:
+        (-[WKScrollView initWithFrame:]):
+
+        Add imports for -Before and -After versions of WKScrollViewAdditions.
+
+        (-[WKScrollView addGestureRecognizer:]):
+
+        Override -addGestureRecognizer here to prevent touches on the pinch gesture recognizer from being recognized.
+        I chose this approach instead of just disabling the gesture in -initWithFrame: because (1) the pinch gesture
+        recognizer is lazily created when setting minimum or maximum zoom scales, rather than immediately in
+        -initWithFrame:, and (2) even if we set the -enabled to NO, UIKit later resets it to YES in other codepaths.
+
 2018-02-01  Tim Horton  <timothy_hor...@apple.com>
 
         WebKit fails to build (_startAssistingNode has conflicting parameters)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (228015 => 228016)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-02-02 17:33:53 UTC (rev 228015)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-02-02 17:44:36 UTC (rev 228016)
@@ -6340,8 +6340,4 @@
 
 @end
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WKWebViewAdditionsAfter.mm>
-#endif
-
 #endif // WK_API_ENABLED

Modified: trunk/Source/WebKit/UIProcess/ios/WKScrollView.mm (228015 => 228016)


--- trunk/Source/WebKit/UIProcess/ios/WKScrollView.mm	2018-02-02 17:33:53 UTC (rev 228015)
+++ trunk/Source/WebKit/UIProcess/ios/WKScrollView.mm	2018-02-02 17:44:36 UTC (rev 228016)
@@ -34,6 +34,10 @@
 
 using namespace WebKit;
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WKScrollViewAdditionsBefore.mm>
+#endif
+
 @interface UIScrollView (UIScrollViewInternalHack)
 - (CGFloat)_rubberBandOffsetForOffset:(CGFloat)newOffset maxOffset:(CGFloat)maxOffset minOffset:(CGFloat)minOffset range:(CGFloat)range outside:(BOOL *)outside;
 @end
@@ -134,6 +138,10 @@
     _contentInsetAdjustmentBehaviorWasExternallyOverridden = (self.contentInsetAdjustmentBehavior != UIScrollViewContentInsetAdjustmentAutomatic);
 #endif
     
+#if ENABLE(EXTRA_ZOOM_MODE)
+    [self _configureScrollingForExtraZoomMode];
+#endif
+
     return self;
 }
 
@@ -311,6 +319,20 @@
         [self _restoreContentOffsetWithRubberbandAmount:rubberbandAmount];
 }
 
+- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
+{
+    [super addGestureRecognizer:gestureRecognizer];
+
+#if ENABLE(EXTRA_ZOOM_MODE)
+    if (gestureRecognizer == self.pinchGestureRecognizer)
+        gestureRecognizer.allowedTouchTypes = @[];
+#endif
+}
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WKScrollViewAdditionsAfter.mm>
+#endif
+
 @end
 
 #endif // PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to