WKWebViewContentProvider shouldn't be a UIScrollViewDelegate
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2018 20:11:47 +0000 (20:11 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2018 20:11:47 +0000 (20:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184107
<rdar://problem/38967492>

Reviewed by Tim Horton.

There is no need for this class to be a UIScrollViewDelegate. Instead
the protocol should have an optional method that is effectively
scrollViewDidScroll.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView scrollViewDidScroll:]): Call web_scrollViewDidScroll
if it exists.
* UIProcess/Cocoa/WKWebViewContentProvider.h: Remove UIScrollViewDelegate
and add an optional web_scrollViewDidScroll.
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_scrollViewDidScroll:]): Renamed from scrollViewDidScroll.
(-[WKPDFView scrollViewDidScroll:]): Deleted.
* UIProcess/ios/WKSystemPreviewView.mm:
(-[WKSystemPreviewView scrollViewDidScroll:]): Deleted.

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h
Source/WebKit/UIProcess/ios/WKPDFView.mm
Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm

index 2038db5..9753d60 100644 (file)
@@ -1,3 +1,26 @@
+2018-03-28  Dean Jackson  <dino@apple.com>
+
+        WKWebViewContentProvider shouldn't be a UIScrollViewDelegate
+        https://bugs.webkit.org/show_bug.cgi?id=184107
+        <rdar://problem/38967492>
+
+        Reviewed by Tim Horton.
+
+        There is no need for this class to be a UIScrollViewDelegate. Instead
+        the protocol should have an optional method that is effectively
+        scrollViewDidScroll.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView scrollViewDidScroll:]): Call web_scrollViewDidScroll
+        if it exists.
+        * UIProcess/Cocoa/WKWebViewContentProvider.h: Remove UIScrollViewDelegate
+        and add an optional web_scrollViewDidScroll.
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView web_scrollViewDidScroll:]): Renamed from scrollViewDidScroll.
+        (-[WKPDFView scrollViewDidScroll:]): Deleted.
+        * UIProcess/ios/WKSystemPreviewView.mm:
+        (-[WKSystemPreviewView scrollViewDidScroll:]): Deleted.
+
 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
index db7efb4..0d18e15 100644 (file)
@@ -2428,8 +2428,8 @@ static WebCore::FloatPoint constrainContentOffset(WebCore::FloatPoint contentOff
 
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
 {
-    if (![self usesStandardContentView])
-        [_customContentView scrollViewDidScroll:(UIScrollView *)scrollView];
+    if (![self usesStandardContentView] && [_customContentView respondsToSelector:@selector(web_scrollViewDidScroll:)])
+        [_customContentView web_scrollViewDidScroll:(UIScrollView *)scrollView];
 
     [self _scheduleVisibleContentRectUpdateAfterScrollInView:scrollView];
 
index c1a0501..0565e3e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 @class UIView;
 @class WKWebView;
 @protocol NSObject;
-@protocol UIScrollViewDelegate;
 struct CGSize;
 struct UIEdgeInsets;
 
-// FIXME: This should be API (and probably should not be a UIScrollViewDelegate).
-@protocol WKWebViewContentProvider <NSObject, UIScrollViewDelegate>
+@protocol WKWebViewContentProvider <NSObject>
 
 - (instancetype)web_initWithFrame:(CGRect) frame webView:(WKWebView *)webView;
 - (void)web_setContentProviderData:(NSData *)data suggestedFilename:(NSString *)filename;
@@ -55,6 +53,9 @@ struct UIEdgeInsets;
 - (void)web_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
 - (void)web_hideFindUI;
 
+@optional
+- (void)web_scrollViewDidScroll:(UIScrollView *)scrollView;
+
 @end
 
 #endif // PLATFORM(IOS)
index df2132f..8492dd0 100644 (file)
@@ -242,7 +242,7 @@ static void detachViewForPage(PDFPageInfo& page)
     [self _revalidateViews];
 }
 
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView
+- (void)web_scrollViewDidScroll:(UIScrollView *)scrollView
 {
     if (scrollView.isZoomBouncing || scrollView._isAnimatingZoom)
         return;
index 6442597..0380315 100644 (file)
@@ -161,14 +161,6 @@ SOFT_LINK_CLASS(QuickLook, QLPreviewController);
     page->goBack();
 }
 
-#pragma mark UIScrollViewDelegate
-
-// FIXME: This class, and WKWebContentProvider itself, shouldn't need to be a UIScrollViewDelegate.
-
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView
-{
-}
-
 @end
 
 #endif