WebKit Bugzilla
Attachment 361853 Details for
Bug 194559
: Remove WKLegacyPDFView
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194559-20190212152833.patch (text/plain), 55.93 KB, created by
Tim Horton
on 2019-02-12 15:28:34 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2019-02-12 15:28:34 PST
Size:
55.93 KB
patch
obsolete
>Subversion Revision: 241286 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 823ab06a9facaad0c7b21a1f4ffd6fa308d3ca29..37a6bec54ee98db32385aefc9458fcf3da3ba3c4 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,12 @@ >+2019-02-12 Tim Horton <timothy_horton@apple.com> >+ >+ Remove WKLegacyPDFView >+ https://bugs.webkit.org/show_bug.cgi?id=194559 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/FeatureDefines.h: >+ > 2019-02-11 Truitt Savell <tsavell@apple.com> > > Unreviewed, rolling out r241229. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 42533e35fc61ed9f26f7e8648112b03b1cbe88a7..4fc9569bb46bd9aeec2f4cde29296085bc36c7fa 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2019-02-12 Tim Horton <timothy_horton@apple.com> >+ >+ Remove WKLegacyPDFView >+ https://bugs.webkit.org/show_bug.cgi?id=194559 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Platform/spi/ios/CorePDFSPI.h: Removed. >+ * SourcesCocoa.txt: >+ * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm: >+ (-[WKWebViewContentProviderRegistry initWithConfiguration:]): >+ * UIProcess/ios/WKLegacyPDFView.h: Removed. >+ * UIProcess/ios/WKLegacyPDFView.mm: Removed. >+ * WebKit.xcodeproj/project.pbxproj: >+ > 2019-02-11 Brian Burg <bburg@apple.com> > > [Cocoa] Web Automation: client callbacks are not called if delegate does not override >diff --git a/Source/WTF/wtf/FeatureDefines.h b/Source/WTF/wtf/FeatureDefines.h >index 7bbf97099b0b5eb65d4cd898ac6bae712e591a89..cf92c5b1247b8a5fa63f2981d93f278a1c92b4c7 100644 >--- a/Source/WTF/wtf/FeatureDefines.h >+++ b/Source/WTF/wtf/FeatureDefines.h >@@ -165,12 +165,6 @@ the public iOS SDK. See <https://webkit.org/b/179167>. */ > #define ENABLE_DOWNLOAD_ATTRIBUTE 1 > #endif > >-#if !defined(ENABLE_WKLEGACYPDFVIEW) >-#if PLATFORM(IOS_FAMILY) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV) && !PLATFORM(IOSMAC) && __IPHONE_OS_VERSION_MIN_REQUIRED < 120000 >-#define ENABLE_WKLEGACYPDFVIEW 1 >-#endif >-#endif >- > #if !defined(ENABLE_WKPDFVIEW) > #if PLATFORM(IOS_FAMILY) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV) && !PLATFORM(IOSMAC) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000 > #define ENABLE_WKPDFVIEW 1 >diff --git a/Source/WebKit/Platform/spi/ios/CorePDFSPI.h b/Source/WebKit/Platform/spi/ios/CorePDFSPI.h >deleted file mode 100644 >index 465d663c554b8f7a653bb570c82868d3ae7aa931..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Platform/spi/ios/CorePDFSPI.h >+++ /dev/null >@@ -1,145 +0,0 @@ >-/* >- * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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 ENABLE(WKLEGACYPDFVIEW) || ENABLE(WKPDFVIEW) >- >-#import <CoreGraphics/CoreGraphics.h> >-#import <UIKit/UIKit.h> >- >-#if USE(APPLE_INTERNAL_SDK) >- >-#import <CorePDF/UIPDFAnnotationController.h> >-#import <CorePDF/UIPDFDocument.h> >-#import <CorePDF/UIPDFLinkAnnotation.h> >-#import <CorePDF/UIPDFPage.h> >-#import <CorePDF/UIPDFPageView.h> >-#import <CorePDF/UIPDFSelection.h> >- >-#else >- >-@class UIPDFSelection; >- >-@interface UIPDFPage : NSObject >-@end >- >-@interface UIPDFPage () >-- (CGRect)cropBoxAccountForRotation; >-- (UIPDFSelection *)findString:(NSString *)string fromSelection:(UIPDFSelection *)selection options:(NSStringCompareOptions)options; >-@end >- >-@interface UIPDFDocument : NSObject >-@end >- >-@interface UIPDFDocument () >-- (UIPDFPage *)pageAtIndex:(NSUInteger)index; >-- (id)initWithCGPDFDocument:(CGPDFDocumentRef)document; >-@property (assign, readonly) NSUInteger numberOfPages; >-@property (readonly) CGPDFDocumentRef CGDocument; >-@end >- >-typedef enum { >- kUIPDFObjectKindGraphic = 1, >- kUIPDFObjectKindText = 2 >-} UIPDFObjectKind; >- >-@class UIPDFPageView; >-@protocol UIPDFAnnotationControllerDelegate; >- >-@interface UIPDFAnnotationController : NSObject<UIGestureRecognizerDelegate> >-@end >- >-@interface UIPDFAnnotationController () >-@property (nonatomic, readonly) UIPDFPageView *pageView; >-@property (nonatomic, assign) id<NSObject, UIPDFAnnotationControllerDelegate> delegate; >-@end >- >-@protocol UIPDFPageViewDelegate; >- >-@interface UIPDFPageView : UIView >-@end >- >-@interface UIPDFPageView () >-- (id)initWithPage:(UIPDFPage *) page tiledContent:(BOOL)tiled; >-- (CGRect)convertRectFromPDFPageSpace:(CGRect)p; >-- (void)highlightSearchSelection:(UIPDFSelection *)selection animated:(BOOL)animated; >-- (void)clearSearchHighlights; >-@property (nonatomic, assign) BOOL useBackingLayer; >-@property (nonatomic, assign) id<NSObject, UIPDFPageViewDelegate> delegate; >-@property (nonatomic, readonly) CALayer *contentLayer; >-@property (nonatomic, readonly) UIPDFAnnotationController *annotationController; >-@end >- >-@protocol UIPDFPageViewDelegate >-@optional >-- (BOOL)selectionWillTrack:(UIPDFPageView*)pageView; >-- (BOOL)shouldRecognizeTapIn:(UIPDFPageView *)pageView atPoint:(CGPoint)point; >-- (Class)classForAnnotationType:(const char *)type; >-- (void)didTap:(UIPDFPageView *)pageView atPoint:(CGPoint)point; >-- (void)doubleTapIn:(UIPDFPageView *)pageView atPoint:(CGPoint)point; >-- (void)pageWasRendered:(UIPDFPageView *)pageView; >-- (void)resetZoom:(UIPDFPageView *)pageView; >-- (void)selectionDidEndTracking:(UIPDFPageView *)pageView; >-- (void)zoom:(UIPDFPageView *)pageView to:(CGRect)rect atPoint:(CGPoint)pt kind:(UIPDFObjectKind)kind; >-@end >- >-@interface UIPDFAnnotation : NSObject >-@end >- >-@interface UIPDFAnnotation () >-- (CGRect)Rect; >-@property (nonatomic, assign) UIPDFAnnotationController* annotationController; >-@end >- >-@interface UIPDFMarkupAnnotation : UIPDFAnnotation >-@end >- >-@interface UIPDFLinkAnnotation : UIPDFMarkupAnnotation >-@end >- >-@interface UIPDFLinkAnnotation () >-- (NSURL *)url; >-- (NSUInteger)pageNumber; >-@end >- >-@protocol UIPDFAnnotationControllerDelegate >-@optional >-- (void)annotation:(UIPDFAnnotation *)annotation wasTouchedAtPoint:(CGPoint) point controller:(UIPDFAnnotationController *)controller; >-- (void)annotation:(UIPDFAnnotation *)annotation isBeingPressedAtPoint:(CGPoint) point controller:(UIPDFAnnotationController *)controller; >-@end >- >-@interface UIPDFSelection : NSObject >-@end >- >-@interface UIPDFSelection () >-- (id)initWithPage:(UIPDFPage *)page fromIndex:(NSUInteger)startIndex toIndex:(NSUInteger)endIndex; >-- (CGRect)bounds; >-- (UIPDFPage *)page; >-- (NSUInteger)startIndex; >-@property (nonatomic, assign) CFRange stringRange; >-@end >- >-#endif >- >-#endif // ENABLE(WKLEGACYPDFVIEW) || ENABLE(WKPDFVIEW) >diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt >index 9fee2c6cc17f719163b91a063683abef2030c7a9..6ca45ca8caaa53dd7de551f39b9a80314ec5be73 100644 >--- a/Source/WebKit/SourcesCocoa.txt >+++ b/Source/WebKit/SourcesCocoa.txt >@@ -403,7 +403,6 @@ UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm > UIProcess/ios/WKInkPickerView.mm > UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.mm > UIProcess/ios/WKKeyboardScrollingAnimator.mm >-UIProcess/ios/WKLegacyPDFView.mm > UIProcess/ios/WKPasswordView.mm > UIProcess/ios/WKPDFPageNumberIndicator.mm > UIProcess/ios/WKPDFView.mm >diff --git a/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm b/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm >index 6d7f917ab4a8f067dbc0220b75baab09923250f3..c2a30337a25c9b2805de8edbc241baacb974ab31 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm >@@ -30,7 +30,6 @@ > > #if PLATFORM(IOS_FAMILY) > >-#import "WKLegacyPDFView.h" > #import "WKPDFView.h" > #import "WKSystemPreviewView.h" > #import "WKWebViewConfigurationPrivate.h" >@@ -55,9 +54,6 @@ - (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration > #if ENABLE(WKPDFVIEW) > for (auto& mimeType : WebCore::MIMETypeRegistry::pdfMIMETypes()) > [self registerProvider:[WKPDFView class] forMIMEType:mimeType]; >-#elif ENABLE(WKLEGACYPDFVIEW) >- for (auto& mimeType : WebCore::MIMETypeRegistry::pdfMIMETypes()) >- [self registerProvider:[WKLegacyPDFView class] forMIMEType:mimeType]; > #endif > > #if USE(SYSTEM_PREVIEW) >diff --git a/Source/WebKit/UIProcess/ProvisionalPageProxy.h b/Source/WebKit/UIProcess/ProvisionalPageProxy.h >index 1e8e2df8783c968d919da0b0d863f7830dd0c7c3..5181fd86b1cbcf7621ba58d93641892cc6b84dc5 100644 >--- a/Source/WebKit/UIProcess/ProvisionalPageProxy.h >+++ b/Source/WebKit/UIProcess/ProvisionalPageProxy.h >@@ -26,20 +26,30 @@ > #pragma once > > #include "MessageReceiver.h" >+#include "WebFramePolicyListenerProxy.h" > #include <wtf/WeakPtr.h> > >+namespace IPC { >+class FormDataReference; >+} >+ > namespace WebCore { > class ResourceRequest; >+struct BackForwardItemIdentifier; > } > > namespace WebKit { > > class DrawingAreaProxy; >+class SandboxExtension; > class SuspendedPageProxy; >+class UserData; > class WebFrameProxy; >-struct WebNavigationDataStore; > class WebPageProxy; > class WebProcessProxy; >+struct URLSchemeTaskParameters; >+struct WebNavigationDataStore; >+struct WebsitePoliciesData; > > class ProvisionalPageProxy : public IPC::MessageReceiver, public CanMakeWeakPtr<ProvisionalPageProxy> { > WTF_MAKE_FAST_ALLOCATED; >diff --git a/Source/WebKit/UIProcess/ios/WKLegacyPDFView.h b/Source/WebKit/UIProcess/ios/WKLegacyPDFView.h >deleted file mode 100644 >index b21eb7c0ab29d88cf7bc3f96df37fdf35f1074fd..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/ios/WKLegacyPDFView.h >+++ /dev/null >@@ -1,36 +0,0 @@ >-/* >- * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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 ENABLE(WKLEGACYPDFVIEW) >- >-#import "CorePDFSPI.h" >-#import "WKActionSheetAssistant.h" >-#import "WKApplicationStateTrackingView.h" >-#import "WKWebViewContentProvider.h" >- >-@interface WKLegacyPDFView : WKApplicationStateTrackingView <WKWebViewContentProvider, UIPDFPageViewDelegate, UIPDFAnnotationControllerDelegate, WKActionSheetAssistantDelegate> >-@end >- >-#endif // ENABLE(WKLEGACYPDFVIEW) >diff --git a/Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm b/Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm >deleted file mode 100644 >index 8312084952a5583794fff2344b00e972e4be15d4..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm >+++ /dev/null >@@ -1,860 +0,0 @@ >-/* >- * Copyright (C) 2014-2016 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. AND ITS CONTRIBUTORS ``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 ITS 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. >- */ >- >-#import "config.h" >-#import "WKLegacyPDFView.h" >- >-#if ENABLE(WKLEGACYPDFVIEW) >- >-#import "APIFindClient.h" >-#import "APIUIClient.h" >-#import "CorePDFSPI.h" >-#import "DrawingAreaProxy.h" >-#import "SessionState.h" >-#import "UIKitSPI.h" >-#import "WKPDFPageNumberIndicator.h" >-#import "WKPasswordView.h" >-#import "WKWebViewInternal.h" >-#import "WebPageProxy.h" >-#import "_WKFindDelegate.h" >-#import "_WKWebViewPrintFormatterInternal.h" >-#import <MobileCoreServices/UTCoreTypes.h> >-#import <WebCore/FloatRect.h> >-#import <WebCore/LocalizedStrings.h> >-#import <pal/spi/cg/CoreGraphicsSPI.h> >-#import <wtf/RetainPtr.h> >-#import <wtf/Vector.h> >-#import <wtf/WeakObjCPtr.h> >-#import <wtf/cocoa/NSURLExtras.h> >- >-// All of UIPDFPage* are deprecated, so just ignore deprecated declarations >-// in this file until we switch off them. >-ALLOW_DEPRECATED_DECLARATIONS_BEGIN >- >-const CGFloat pdfPageMargin = 8; >-const CGFloat pdfMinimumZoomScale = 1; >-const CGFloat pdfMaximumZoomScale = 5; >- >-const float overdrawHeightMultiplier = 1.5; >- >-static const CGFloat smartMagnificationElementPadding = 0.05; >- >-typedef struct { >- CGRect frame; >- RetainPtr<UIPDFPageView> view; >- RetainPtr<UIPDFPage> page; >- unsigned index; >-} PDFPageInfo; >- >-@interface WKLegacyPDFView () >-- (void)_resetZoomAnimated:(BOOL)animated; >-@end >- >-@implementation WKLegacyPDFView { >- RetainPtr<CGPDFDocumentRef> _cgPDFDocument; >- RetainPtr<UIPDFDocument> _pdfDocument; >- RetainPtr<NSString> _suggestedFilename; >- RetainPtr<WKPDFPageNumberIndicator> _pageNumberIndicator; >- >- Vector<PDFPageInfo> _pages; >- unsigned _centerPageNumber; >- >- CGSize _minimumSize; >- CGSize _overlaidAccessoryViewsInset; >- WKWebView *_webView; >- UIScrollView *_scrollView; >- UIView *_fixedOverlayView; >- >- BOOL _isStartingZoom; >- BOOL _isPerformingSameDocumentNavigation; >- >- RetainPtr<WKActionSheetAssistant> _actionSheetAssistant; >- WebKit::InteractionInformationAtPosition _positionInformation; >- >- unsigned _currentFindPageIndex; >- unsigned _currentFindMatchIndex; >- RetainPtr<UIPDFSelection> _currentFindSelection; >- >- RetainPtr<NSString> _cachedFindString; >- Vector<RetainPtr<UIPDFSelection>> _cachedFindMatches; >- unsigned _cachedFindMaximumCount; >- _WKFindOptions _cachedFindOptionsAffectingResults; >- >- std::atomic<unsigned> _nextComputeMatchesOperationID; >- RetainPtr<NSString> _nextCachedFindString; >- unsigned _nextCachedFindMaximumCount; >- _WKFindOptions _nextCachedFindOptionsAffectingResults; >- >- dispatch_queue_t _findQueue; >- >- RetainPtr<UIWKSelectionAssistant> _webSelectionAssistant; >- >- UIEdgeInsets _lastUnobscuredSafeAreaInset; >- CGFloat _lastLayoutWidth; >-} >- >-- (instancetype)web_initWithFrame:(CGRect)frame webView:(WKWebView *)webView mimeType:(NSString *)mimeType >-{ >- if (!(self = [super initWithFrame:frame webView:webView])) >- return nil; >- >- self.backgroundColor = [UIColor grayColor]; >- >- _webView = webView; >- >- _scrollView = webView.scrollView; >- [_scrollView setMinimumZoomScale:pdfMinimumZoomScale]; >- [_scrollView setMaximumZoomScale:pdfMaximumZoomScale]; >- [_scrollView setBackgroundColor:[UIColor grayColor]]; >- >- _actionSheetAssistant = adoptNS([[WKActionSheetAssistant alloc] initWithView:self]); >- [_actionSheetAssistant setDelegate:self]; >- >- _findQueue = dispatch_queue_create("com.apple.WebKit.WKPDFViewComputeMatchesQueue", DISPATCH_QUEUE_SERIAL); >- >- return self; >-} >- >-- (void)dealloc >-{ >- [[NSNotificationCenter defaultCenter] removeObserver:self]; >- >- [self _clearPages]; >- [_pageNumberIndicator removeFromSuperview]; >- dispatch_release(_findQueue); >- [_actionSheetAssistant cleanupSheet]; >- [super dealloc]; >-} >- >-- (NSString *)web_suggestedFilename >-{ >- return _suggestedFilename.get(); >-} >- >-- (NSData *)web_dataRepresentation >-{ >- return [(NSData *)CGDataProviderCopyData(CGPDFDocumentGetDataProvider(_cgPDFDocument.get())) autorelease]; >-} >- >-static void detachViewForPage(PDFPageInfo& page) >-{ >- [page.view removeFromSuperview]; >- [page.view setDelegate:nil]; >- [[page.view annotationController] setDelegate:nil]; >- page.view = nil; >-} >- >-- (void)_clearPages >-{ >- for (auto& page : _pages) >- detachViewForPage(page); >- >- _pages.clear(); >-} >- >-- (void)_didLoadPDFDocument >-{ >- _pdfDocument = adoptNS([[UIPDFDocument alloc] initWithCGPDFDocument:_cgPDFDocument.get()]); >- >- // FIXME: Restore the scroll position and page scale if navigating from the back/forward list. >- >- [self _computePageAndDocumentFrames]; >- [self _revalidateViews]; >- [self _scrollToFragment:_webView.URL.fragment]; >-} >- >-- (void)web_setContentProviderData:(NSData *)data suggestedFilename:(NSString *)filename >-{ >- _suggestedFilename = adoptNS([filename copy]); >- >- [self _clearPages]; >- >- RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData((CFDataRef)data)); >- _cgPDFDocument = adoptCF(CGPDFDocumentCreateWithProvider(dataProvider.get())); >- >- if (!_cgPDFDocument) >- return; >- >- if (CGPDFDocumentIsUnlocked(_cgPDFDocument.get())) { >- [self _didLoadPDFDocument]; >- return; >- } >- >- [self _showPasswordEntryField]; >-} >- >-- (void)web_setMinimumSize:(CGSize)size >-{ >- if (CGSizeEqualToSize(size, _minimumSize)) >- return; >- >- _minimumSize = size; >- >- if (_webView._passwordView) { >- self.frame = { self.frame.origin, size }; >- return; >- } >- >- CGFloat oldDocumentLeftFraction = 0; >- CGFloat oldDocumentTopFraction = 0; >- CGSize contentSize = _scrollView.contentSize; >- if (contentSize.width && contentSize.height) { >- CGPoint contentOffset = _scrollView.contentOffset; >- UIEdgeInsets contentInset = _scrollView.contentInset; >- oldDocumentLeftFraction = (contentOffset.x + contentInset.left) / contentSize.width; >- oldDocumentTopFraction = (contentOffset.y + contentInset.top) / contentSize.height; >- } >- >- [self _computePageAndDocumentFrames]; >- >- CGSize newContentSize = _scrollView.contentSize; >- UIEdgeInsets contentInset = _scrollView.contentInset; >- [_scrollView setContentOffset:CGPointMake((oldDocumentLeftFraction * newContentSize.width) - contentInset.left, (oldDocumentTopFraction * newContentSize.height) - contentInset.top) animated:NO]; >- >- [self _revalidateViews]; >-} >- >-- (void)web_scrollViewDidScroll:(UIScrollView *)scrollView >-{ >- if (scrollView.isZoomBouncing || scrollView._isAnimatingZoom) >- return; >- >- [self _revalidateViews]; >- >- if (!_isPerformingSameDocumentNavigation) >- [_pageNumberIndicator show]; >-} >- >-- (void)_ensureViewForPage:(PDFPageInfo&)pageInfo >-{ >- if (pageInfo.view) >- return; >- >- pageInfo.view = adoptNS([[UIPDFPageView alloc] initWithPage:pageInfo.page.get() tiledContent:YES]); >- [pageInfo.view setUseBackingLayer:YES]; >- [pageInfo.view setDelegate:self]; >- [[pageInfo.view annotationController] setDelegate:self]; >- [self addSubview:pageInfo.view.get()]; >- >- [pageInfo.view setFrame:pageInfo.frame]; >- [pageInfo.view contentLayer].contentsScale = self.window.screen.scale; >-} >- >-- (void)_revalidateViews >-{ >- if (_isStartingZoom) >- return; >- >- CGRect targetRect = [_scrollView convertRect:_scrollView.bounds toView:self]; >- >- // We apply overdraw after applying scale in order to avoid excessive >- // memory use caused by scaling the overdraw. >- CGRect targetRectWithOverdraw = CGRectInset(targetRect, 0, -targetRect.size.height * overdrawHeightMultiplier); >- CGRect targetRectForCenterPage = CGRectInset(targetRect, 0, targetRect.size.height / 2 - pdfPageMargin * 2); >- >- _centerPageNumber = 0; >- >- for (auto& pageInfo : _pages) { >- if (!CGRectIntersectsRect(pageInfo.frame, targetRectWithOverdraw) && pageInfo.index != _currentFindPageIndex) { >- detachViewForPage(pageInfo); >- continue; >- } >- >- if (!_centerPageNumber && CGRectIntersectsRect(pageInfo.frame, targetRectForCenterPage)) >- _centerPageNumber = pageInfo.index + 1; >- >- [self _ensureViewForPage:pageInfo]; >- } >- >- if (!_centerPageNumber && _pages.size()) { >- if (CGRectGetMinY(_pages.first().frame) > CGRectGetMaxY(targetRectForCenterPage)) >- _centerPageNumber = 1; >- else { >- ASSERT(CGRectGetMaxY(_pages.last().frame) < CGRectGetMinY(targetRectForCenterPage)); >- _centerPageNumber = _pages.size(); >- } >- } >- >- [self _updatePageNumberIndicator]; >-} >- >-- (CGPoint)_offsetForPageNumberIndicator >-{ >- UIEdgeInsets insets = UIEdgeInsetsAdd(_webView._computedUnobscuredSafeAreaInset, _webView._computedObscuredInset, UIRectEdgeAll); >- return CGPointMake(insets.left, insets.top + _overlaidAccessoryViewsInset.height); >-} >- >-- (void)_updatePageNumberIndicator >-{ >- if (_isPerformingSameDocumentNavigation) >- return; >- >- if (!_pageNumberIndicator) >- _pageNumberIndicator = adoptNS([[WKPDFPageNumberIndicator alloc] initWithFrame:CGRectZero]); >- >- [_fixedOverlayView addSubview:_pageNumberIndicator.get()]; >- >- [_pageNumberIndicator setCurrentPageNumber:_centerPageNumber]; >- [_pageNumberIndicator moveToPoint:[self _offsetForPageNumberIndicator] animated:NO]; >-} >- >-- (void)web_setOverlaidAccessoryViewsInset:(CGSize)inset >-{ >- _overlaidAccessoryViewsInset = inset; >- [_pageNumberIndicator moveToPoint:[self _offsetForPageNumberIndicator] animated:YES]; >-} >- >-- (void)web_computedContentInsetDidChange >-{ >- [self _updatePageNumberIndicator]; >- >- if (UIEdgeInsetsEqualToEdgeInsets(_webView._computedUnobscuredSafeAreaInset, _lastUnobscuredSafeAreaInset)) >- return; >- >- [self _computePageAndDocumentFrames]; >- [self _revalidateViews]; >-} >- >-- (void)web_setFixedOverlayView:(UIView *)fixedOverlayView >-{ >- _fixedOverlayView = fixedOverlayView; >- >- if (_pageNumberIndicator) >- [_fixedOverlayView addSubview:_pageNumberIndicator.get()]; >-} >- >-- (void)_scrollToFragment:(NSString *)fragment >-{ >- if (![fragment hasPrefix:@"page"]) >- return; >- >- NSInteger pageIndex = [[fragment substringFromIndex:4] integerValue] - 1; >- if (pageIndex < 0 || static_cast<std::size_t>(pageIndex) >= _pages.size()) >- return; >- >- _isPerformingSameDocumentNavigation = YES; >- >- [_pageNumberIndicator hide]; >- [self _resetZoomAnimated:NO]; >- >- // Ensure that the page margin is visible below the content inset. >- const CGFloat verticalOffset = _pages[pageIndex].frame.origin.y - _webView._computedObscuredInset.top - pdfPageMargin; >- [_scrollView setContentOffset:CGPointMake(_scrollView.contentOffset.x, verticalOffset) animated:NO]; >- >- _isPerformingSameDocumentNavigation = NO; >-} >- >-- (void)web_didSameDocumentNavigation:(WKSameDocumentNavigationType)navigationType >-{ >- // Check for kWKSameDocumentNavigationSessionStatePop instead of kWKSameDocumentNavigationAnchorNavigation since the >- // latter is only called once when navigating to the same anchor in succession. If the user navigates to a page >- // then scrolls back and clicks on the same link a second time, we want to scroll again. >- if (navigationType != kWKSameDocumentNavigationSessionStatePop) >- return; >- >- // FIXME: restore the scroll position and page scale if navigating back from a fragment. >- >- [self _scrollToFragment:_webView.URL.fragment]; >-} >- >-- (UIView *)web_contentView >-{ >- return self; >-} >- >-- (void)_computePageAndDocumentFrames >-{ >- UIEdgeInsets safeAreaInsets = _webView._computedUnobscuredSafeAreaInset; >- _lastUnobscuredSafeAreaInset = safeAreaInsets; >- CGSize minimumSizeRespectingContentInset = CGSizeMake(_minimumSize.width - (safeAreaInsets.left + safeAreaInsets.right), _minimumSize.height - (safeAreaInsets.top + safeAreaInsets.bottom)); >- >- if (!_pages.isEmpty() && _lastLayoutWidth == minimumSizeRespectingContentInset.width) { >- [self _updateDocumentFrame]; >- return; >- } >- >- NSUInteger pageCount = [_pdfDocument numberOfPages]; >- if (!pageCount) >- return; >- >- _lastLayoutWidth = minimumSizeRespectingContentInset.width; >- [_pageNumberIndicator setPageCount:pageCount]; >- >- [self _clearPages]; >- >- _pages.reserveCapacity(pageCount); >- >- CGRect pageFrame = CGRectMake(0, 0, minimumSizeRespectingContentInset.width, minimumSizeRespectingContentInset.height); >- for (NSUInteger pageIndex = 0; pageIndex < pageCount; ++pageIndex) { >- UIPDFPage *page = [_pdfDocument pageAtIndex:pageIndex]; >- if (!page) >- continue; >- >- CGSize pageSize = [page cropBoxAccountForRotation].size; >- pageFrame.size.height = pageSize.height / pageSize.width * pageFrame.size.width; >- CGRect pageFrameWithMarginApplied = CGRectInset(pageFrame, pdfPageMargin, pdfPageMargin); >- if (CGRectIsNull(pageFrameWithMarginApplied)) >- pageFrameWithMarginApplied = CGRectZero; >- >- PDFPageInfo pageInfo; >- pageInfo.page = page; >- pageInfo.frame = pageFrameWithMarginApplied; >- pageInfo.index = pageIndex; >- _pages.append(pageInfo); >- pageFrame.origin.y += pageFrame.size.height - pdfPageMargin; >- } >- >- [self _updateDocumentFrame]; >-} >- >-- (void)_updateDocumentFrame >-{ >- if (_pages.isEmpty()) >- return; >- >- UIEdgeInsets safeAreaInsets = _webView._computedUnobscuredSafeAreaInset; >- CGFloat scale = _scrollView.zoomScale; >- CGRect newFrame = CGRectZero; >- newFrame.origin.x = safeAreaInsets.left; >- newFrame.origin.y = safeAreaInsets.top; >- newFrame.size.width = _lastLayoutWidth * scale; >- newFrame.size.height = std::max((CGRectGetMaxY(_pages.last().frame) + pdfPageMargin) * scale + safeAreaInsets.bottom, _minimumSize.height * scale); >- >- [self setFrame:newFrame]; >- [_scrollView setContentSize:newFrame.size]; >-} >- >-- (void)_resetZoomAnimated:(BOOL)animated >-{ >- _isStartingZoom = YES; >- >- CGRect scrollViewBounds = _scrollView.bounds; >- CGPoint centerOfPageInDocumentCoordinates = [_scrollView convertPoint:CGPointMake(CGRectGetMidX(scrollViewBounds), CGRectGetMidY(scrollViewBounds)) toView:self]; >- [_webView _zoomOutWithOrigin:centerOfPageInDocumentCoordinates animated:animated]; >- >- _isStartingZoom = NO; >-} >- >-- (void)_highlightLinkAnnotation:(UIPDFLinkAnnotation *)linkAnnotation forDuration:(NSTimeInterval)duration completionHandler:(void (^)(void))completionHandler >-{ >- static const CGFloat highlightBorderRadius = 3; >- static const CGFloat highlightColorComponent = 26.0 / 255; >- static UIColor *highlightColor = [[UIColor alloc] initWithRed:highlightColorComponent green:highlightColorComponent blue:highlightColorComponent alpha:0.3]; >- >- UIPDFPageView *pageView = linkAnnotation.annotationController.pageView; >- CGRect highlightViewFrame = [self convertRect:[pageView convertRectFromPDFPageSpace:linkAnnotation.Rect] fromView:pageView]; >- RetainPtr<_UIHighlightView> highlightView = adoptNS([[_UIHighlightView alloc] initWithFrame:CGRectInset(highlightViewFrame, -highlightBorderRadius, -highlightBorderRadius)]); >- [highlightView setOpaque:NO]; >- [highlightView setCornerRadius:highlightBorderRadius]; >- [highlightView setColor:highlightColor]; >- >- ASSERT(RunLoop::isMain()); >- [self addSubview:highlightView.get()]; >- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ >- [highlightView removeFromSuperview]; >- completionHandler(); >- }); >-} >- >-- (NSURL *)_URLForLinkAnnotation:(UIPDFLinkAnnotation *)linkAnnotation >-{ >- NSURL *documentURL = _webView.URL; >- >- if (NSURL *url = linkAnnotation.url) >- return [NSURL URLWithString:url.relativeString relativeToURL:documentURL]; >- >- if (NSUInteger pageNumber = linkAnnotation.pageNumber) { >- String anchorString = makeString("#page", pageNumber); >- return [NSURL URLWithString:anchorString relativeToURL:documentURL]; >- } >- >- return nil; >-} >- >-#pragma mark Find-in-Page >- >-static NSStringCompareOptions stringCompareOptions(_WKFindOptions options) >-{ >- NSStringCompareOptions findOptions = 0; >- if (options & _WKFindOptionsCaseInsensitive) >- findOptions |= NSCaseInsensitiveSearch; >- if (options & _WKFindOptionsBackwards) >- findOptions |= NSBackwardsSearch; >- return findOptions; >-} >- >-- (void)_computeMatchesForString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount completionHandler:(void (^)(BOOL success))completionHandler >-{ >- if (!_pdfDocument) { >- completionHandler(NO); >- return; >- } >- >- _WKFindOptions optionsAffectingResults = options & ~_WKFindOptionsIrrelevantForBatchResults; >- >- // If this search is equivalent to the currently cached search, bail and call the completion handler, because the existing cached results are valid. >- if (!_cachedFindMatches.isEmpty() && [_cachedFindString isEqualToString:string] && _cachedFindOptionsAffectingResults == optionsAffectingResults && _cachedFindMaximumCount == maxCount) { >- // Also, cancel any running search, because it will eventually replace the now-valid results. >- ++_nextComputeMatchesOperationID; >- >- completionHandler(YES); >- return; >- } >- >- // If this search is equivalent to the currently running asynchronous search, bail as if this search were cancelled; the original search's completion handler will eventually fire. >- if ([_nextCachedFindString isEqualToString:string] && _nextCachedFindOptionsAffectingResults == optionsAffectingResults && _nextCachedFindMaximumCount == maxCount) { >- completionHandler(NO); >- return; >- } >- >- NSStringCompareOptions findOptions = stringCompareOptions(optionsAffectingResults); >- >- Vector<PDFPageInfo> pages = _pages; >- >- unsigned computeMatchesOperationID = ++_nextComputeMatchesOperationID; >- _nextCachedFindString = string; >- _nextCachedFindOptionsAffectingResults = optionsAffectingResults; >- _nextCachedFindMaximumCount = maxCount; >- >- RetainPtr<WKLegacyPDFView> retainedSelf = self; >- typeof(completionHandler) completionHandlerCopy = Block_copy(completionHandler); >- >- dispatch_async(_findQueue, [pages, string, findOptions, optionsAffectingResults, maxCount, computeMatchesOperationID, retainedSelf, completionHandlerCopy] { >- Vector<RetainPtr<UIPDFSelection>> matches; >- >- for (unsigned pageIndex = 0; pageIndex < pages.size(); ++pageIndex) { >- UIPDFSelection *match = nullptr; >- while ((match = [pages[pageIndex].page findString:string fromSelection:match options:findOptions])) { >- matches.append(match); >- if (matches.size() > maxCount) >- goto maxCountExceeded; >- >- // If we've enqueued another search, cancel this one. >- if (retainedSelf->_nextComputeMatchesOperationID != computeMatchesOperationID) { >- dispatch_async(dispatch_get_main_queue(), [completionHandlerCopy] { >- completionHandlerCopy(NO); >- Block_release(completionHandlerCopy); >- }); >- return; >- } >- }; >- } >- >- maxCountExceeded: >- dispatch_async(dispatch_get_main_queue(), [computeMatchesOperationID, string, optionsAffectingResults, maxCount, matches, completionHandlerCopy, retainedSelf] { >- >- // If another search has been enqueued in the meantime, ignore this result. >- if (retainedSelf->_nextComputeMatchesOperationID != computeMatchesOperationID) { >- Block_release(completionHandlerCopy); >- return; >- } >- >- retainedSelf->_cachedFindString = string; >- retainedSelf->_cachedFindOptionsAffectingResults = optionsAffectingResults; >- retainedSelf->_cachedFindMaximumCount = maxCount; >- retainedSelf->_cachedFindMatches = matches; >- >- retainedSelf->_nextCachedFindString = nil; >- >- completionHandlerCopy(YES); >- Block_release(completionHandlerCopy); >- }); >- }); >-} >- >-- (void)web_countStringMatches:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount >-{ >- RefPtr<WebKit::WebPageProxy> page = _webView->_page; >- [self _computeMatchesForString:string options:options maxCount:maxCount completionHandler:^(BOOL success) { >- if (!success) >- return; >- page->findClient().didCountStringMatches(page.get(), string, _cachedFindMatches.size()); >- }]; >-} >- >-- (void)_didFindMatch:(UIPDFSelection *)match >-{ >- for (auto& pageInfo : _pages) { >- if (pageInfo.page == match.page) { >- [self _ensureViewForPage:pageInfo]; >- >- [pageInfo.view highlightSearchSelection:match animated:NO]; >- >- _currentFindPageIndex = pageInfo.index; >- _currentFindSelection = match; >- >- CGRect zoomRect = [pageInfo.view convertRectFromPDFPageSpace:match.bounds]; >- if (CGRectIsNull(zoomRect)) >- return; >- >- [self zoom:pageInfo.view.get() to:zoomRect atPoint:CGPointZero kind:kUIPDFObjectKindText]; >- >- return; >- } >- } >-} >- >-- (void)web_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount >-{ >- if (_currentFindSelection) >- [_pages[_currentFindPageIndex].view clearSearchHighlights]; >- >- RetainPtr<UIPDFSelection> previousFindSelection = _currentFindSelection; >- unsigned previousFindPageIndex = 0; >- if (previousFindSelection) { >- previousFindPageIndex = _currentFindPageIndex; >- if (![_cachedFindString isEqualToString:string]) { >- NSUInteger location = [_currentFindSelection startIndex]; >- if (location) >- previousFindSelection = adoptNS([[UIPDFSelection alloc] initWithPage:[_currentFindSelection page] fromIndex:location - 1 toIndex:location]); >- } >- } >- >- NSStringCompareOptions findOptions = stringCompareOptions(options); >- bool backwards = (options & _WKFindOptionsBackwards); >- RefPtr<WebKit::WebPageProxy> page = _webView->_page; >- >- [self _computeMatchesForString:string options:options maxCount:maxCount completionHandler:^(BOOL success) { >- if (!success) >- return; >- >- unsigned pageIndex = previousFindPageIndex; >- for (unsigned i = 0; i < _pages.size(); ++i) { >- UIPDFSelection *match = [_pages[pageIndex].page findString:string fromSelection:(pageIndex == previousFindPageIndex ? previousFindSelection.get() : nil) options:findOptions]; >- >- if (!match) { >- if (!pageIndex && backwards) >- pageIndex = _pages.size() - 1; >- else if (pageIndex == _pages.size() - 1 && !backwards) >- pageIndex = 0; >- else >- pageIndex += backwards ? -1 : 1; >- continue; >- } >- >- [self _didFindMatch:match]; >- >- if (_cachedFindMatches.size() <= maxCount) { >- _currentFindMatchIndex = 0; >- for (const auto& knownMatch : _cachedFindMatches) { >- if (match.stringRange.location == [knownMatch stringRange].location && match.stringRange.length == [knownMatch stringRange].length) { >- page->findClient().didFindString(page.get(), string, { }, _cachedFindMatches.size(), _currentFindMatchIndex, false); >- break; >- } >- _currentFindMatchIndex++; >- } >- } >- >- return; >- } >- >- page->findClient().didFailToFindString(page.get(), string); >- }]; >-} >- >-- (void)web_hideFindUI >-{ >- if (_currentFindSelection) >- [_pages[_currentFindPageIndex].view clearSearchHighlights]; >- >- _currentFindSelection = nullptr; >- _cachedFindString = nullptr; >- _cachedFindMatches.clear(); >-} >- >-#pragma mark UIPDFPageViewDelegate >- >-- (void)zoom:(UIPDFPageView *)pageView to:(CGRect)targetRect atPoint:(CGPoint)origin kind:(UIPDFObjectKind)kind >-{ >- _isStartingZoom = YES; >- >- BOOL isImage = kind == kUIPDFObjectKindGraphic; >- >- if (!isImage) >- targetRect = CGRectInset(targetRect, smartMagnificationElementPadding * targetRect.size.width, smartMagnificationElementPadding * targetRect.size.height); >- >- CGRect rectInDocumentCoordinates = [pageView convertRect:targetRect toView:self]; >- CGPoint originInDocumentCoordinates = [pageView convertPoint:origin toView:self]; >- >- [_webView _zoomToRect:rectInDocumentCoordinates withOrigin:originInDocumentCoordinates fitEntireRect:isImage minimumScale:pdfMinimumZoomScale maximumScale:pdfMaximumZoomScale minimumScrollDistance:0]; >- >- _isStartingZoom = NO; >-} >- >-- (void)resetZoom:(UIPDFPageView *)pageView >-{ >- [self _resetZoomAnimated:YES]; >-} >- >-#pragma mark UIPDFAnnotationControllerDelegate >- >-- (void)annotation:(UIPDFAnnotation *)annotation wasTouchedAtPoint:(CGPoint)point controller:(UIPDFAnnotationController *)controller >-{ >- if (![annotation isKindOfClass:[UIPDFLinkAnnotation class]]) >- return; >- >- UIPDFLinkAnnotation *linkAnnotation = (UIPDFLinkAnnotation *)annotation; >- RetainPtr<NSURL> url = [self _URLForLinkAnnotation:linkAnnotation]; >- if (!url) >- return; >- >- CGPoint documentPoint = [controller.pageView convertPoint:point toView:self]; >- CGPoint screenPoint = [self.window convertPoint:[self convertPoint:documentPoint toView:nil] toWindow:nil]; >- RetainPtr<WKWebView> retainedWebView = _webView; >- >- [self _highlightLinkAnnotation:linkAnnotation forDuration:.2 completionHandler:^{ >- retainedWebView->_page->navigateToPDFLinkWithSimulatedClick([url absoluteString], WebCore::roundedIntPoint(documentPoint), WebCore::roundedIntPoint(screenPoint)); >- }]; >-} >- >-- (void)annotation:(UIPDFAnnotation *)annotation isBeingPressedAtPoint:(CGPoint)point controller:(UIPDFAnnotationController *)controller >-{ >- if (![annotation isKindOfClass:[UIPDFLinkAnnotation class]]) >- return; >- >- UIPDFLinkAnnotation *linkAnnotation = (UIPDFLinkAnnotation *)annotation; >- NSURL *url = [self _URLForLinkAnnotation:linkAnnotation]; >- if (!url) >- return; >- >- _positionInformation.request.point = WebCore::roundedIntPoint([controller.pageView convertPoint:point toView:self]); >- >- _positionInformation.url = url; >- _positionInformation.bounds = WebCore::roundedIntRect([self convertRect:[controller.pageView convertRectFromPDFPageSpace:annotation.Rect] fromView:controller.pageView]); >- >- [self _highlightLinkAnnotation:linkAnnotation forDuration:.75 completionHandler:^{ >- [_actionSheetAssistant showLinkSheet]; >- }]; >-} >- >-#pragma mark WKActionSheetAssistantDelegate >- >-- (Optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant >-{ >- return _positionInformation; >-} >- >-- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant performAction:(WebKit::SheetAction)action >-{ >- if (action != WebKit::SheetAction::Copy) >- return; >- >- NSDictionary *representations = @{ >- (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url, >- (NSString *)kUTTypeURL : (NSURL *)_positionInformation.url >- }; >- >- [UIPasteboard generalPasteboard].items = @[ representations ]; >-} >- >-- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant openElementAtLocation:(CGPoint)location >-{ >- CGPoint screenPoint = [self.window convertPoint:[self convertPoint:location toView:nil] toWindow:nil]; >- _webView->_page->navigateToPDFLinkWithSimulatedClick(_positionInformation.url, WebCore::roundedIntPoint(location), WebCore::roundedIntPoint(screenPoint)); >-} >- >-- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant shareElementWithURL:(NSURL *)url rect:(CGRect)boundingRect >-{ >- _webSelectionAssistant = adoptNS([[UIWKSelectionAssistant alloc] initWithView:self]); >- [_webSelectionAssistant showShareSheetFor:WTF::userVisibleString(url) fromRect:boundingRect]; >- _webSelectionAssistant = nil; >-} >- >-#if HAVE(APP_LINKS) >-- (BOOL)actionSheetAssistant:(WKActionSheetAssistant *)assistant shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element >-{ >- return _webView->_page->uiClient().shouldIncludeAppLinkActionsForElement(element); >-} >-#endif >- >-- (RetainPtr<NSArray>)actionSheetAssistant:(WKActionSheetAssistant *)assistant decideActionsForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr<NSArray>)defaultActions >-{ >- return _webView->_page->uiClient().actionsForElement(element, WTFMove(defaultActions)); >-} >- >-#pragma mark Password protection UI >- >-- (void)_showPasswordEntryField >-{ >- [_webView _showPasswordViewWithDocumentName:_suggestedFilename.get() passwordHandler:[retainedSelf = retainPtr(self), webView = retainPtr(_webView)](NSString *password) { >- if (!CGPDFDocumentUnlockWithPassword(retainedSelf->_cgPDFDocument.get(), password.UTF8String)) { >- [[webView _passwordView] showPasswordFailureAlert]; >- return; >- } >- >- [webView _hidePasswordView]; >- [retainedSelf _didLoadPDFDocument]; >- }]; >-} >- >-- (BOOL)web_isBackground >-{ >- return [self isBackground]; >-} >- >-- (void)_applicationWillEnterForeground >-{ >- [super _applicationWillEnterForeground]; >- // FIXME: Is it really necessary to hide the web content drawing area when a PDF is displayed? >- if (auto drawingArea = _webView->_page->drawingArea()) >- drawingArea->hideContentUntilAnyUpdate(); >-} >- >-@end >- >-#pragma mark Printing >- >-#if !PLATFORM(IOSMAC) >- >-@interface WKLegacyPDFView (_WKWebViewPrintFormatter) <_WKWebViewPrintProvider> >-@end >- >-@implementation WKLegacyPDFView (_WKWebViewPrintFormatter) >- >-- (NSUInteger)_wk_pageCountForPrintFormatter:(_WKWebViewPrintFormatter *)printFormatter >-{ >- CGPDFDocumentRef document = _cgPDFDocument.get(); >- if (!CGPDFDocumentAllowsPrinting(document)) >- return 0; >- >- size_t numberOfPages = CGPDFDocumentGetNumberOfPages(document); >- if (printFormatter.snapshotFirstPage) >- return std::min<NSUInteger>(numberOfPages, 1); >- >- return numberOfPages; >-} >- >-- (CGPDFDocumentRef)_wk_printedDocument >-{ >- return _cgPDFDocument.get(); >-} >- >-@end >- >-#endif // !PLATFORM(IOSMAC) >- >-ALLOW_DEPRECATED_DECLARATIONS_END >- >-#endif // ENABLE(WKLEGACYPDFVIEW) >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 70f12c56a22036275cd81aab2336f75b541fd62e..ee3b373aa6c6eb68d1bee693497b3e9431ff5f01 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -618,7 +618,6 @@ > 2D6AB541192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6AB53F192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h */; }; > 2D6B371B18A967AD0042AE80 /* _WKThumbnailView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 2D6BF12421AF56E1001E79C9 /* PencilKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6BF12221AF56E1001E79C9 /* PencilKitSoftLink.h */; }; >- 2D6CD11B189058A500E5A4A0 /* ViewSnapshotStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D6CD11A189058A500E5A4A0 /* ViewSnapshotStore.cpp */; }; > 2D6CD119189058A500E5A4A0 /* ViewSnapshotStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */; }; > 2D72A1FA212BF46E00517A20 /* RemoteLayerTreeDrawingArea.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */; }; > 2D7303791A7C2B7500F8F487 /* WKPageNavigationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -704,7 +703,6 @@ > 2D9EA30F1A96CBFF002D2807 /* WebPageInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9EA30E1A96CBFF002D2807 /* WebPageInjectedBundleClient.h */; }; > 2DA049B4180CCCD300AAFA9E /* PlatformCALayerRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */; }; > 2DA049B8180CCD0A00AAFA9E /* GraphicsLayerCARemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA049B6180CCD0A00AAFA9E /* GraphicsLayerCARemote.h */; }; >- 2DA1E4FE18C02B6A00DBC929 /* WKLegacyPDFView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA1E4FC18C02B6A00DBC929 /* WKLegacyPDFView.h */; }; > 2DA6731A20C754B1003CB401 /* DynamicViewportSizeUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA6731920C754B1003CB401 /* DynamicViewportSizeUpdate.h */; }; > 2DA944A01884E4F000ED86DB /* WebIOSEventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA944991884E4F000ED86DB /* WebIOSEventFactory.h */; }; > 2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA9449D1884E4F000ED86DB /* GestureTypes.h */; }; >@@ -1572,7 +1570,6 @@ > CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */; }; > CE11AD521CBC482F00681EE5 /* CodeSigning.h in Headers */ = {isa = PBXBuildFile; fileRef = CE11AD511CBC482F00681EE5 /* CodeSigning.h */; }; > CE1A0BD21A48E6C60054EF74 /* AssertionServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */; }; >- CE1A0BD31A48E6C60054EF74 /* CorePDFSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCD1A48E6C60054EF74 /* CorePDFSPI.h */; }; > CE1A0BD51A48E6C60054EF74 /* ManagedConfigurationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */; }; > CE1A0BD61A48E6C60054EF74 /* TCCSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */; }; > CE1A0BD71A48E6C60054EF74 /* TextInputSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */; }; >@@ -2468,7 +2465,6 @@ > 2D1087621D2C641B00B85F82 /* LoadParametersCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadParametersCocoa.mm; sourceTree = "<group>"; }; > 2D125C5C1857EA05003BA3CB /* ViewGestureController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewGestureController.h; sourceTree = "<group>"; }; > 2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewGestureControllerMac.mm; sourceTree = "<group>"; }; >- 2D6CD118189058A500E5A4A0 /* ViewSnapshotStoreMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewSnapshotStoreMac.mm; sourceTree = "<group>"; }; > 2D12DAB420662C73006F00FB /* WKAnimationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAnimationDelegate.h; sourceTree = "<group>"; }; > 2D1B5D5A18586599006C6596 /* ViewGestureController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = ViewGestureController.messages.in; sourceTree = "<group>"; }; > 2D1B5D5B185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ViewGestureControllerMessageReceiver.cpp; path = DerivedSources/WebKit2/ViewGestureControllerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >@@ -2544,6 +2540,7 @@ > 2D6BF12121AF56E1001E79C9 /* PencilKitSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PencilKitSoftLink.mm; path = ios/PencilKitSoftLink.mm; sourceTree = "<group>"; }; > 2D6BF12221AF56E1001E79C9 /* PencilKitSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PencilKitSoftLink.h; path = ios/PencilKitSoftLink.h; sourceTree = "<group>"; }; > 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewSnapshotStore.h; sourceTree = "<group>"; }; >+ 2D6CD118189058A500E5A4A0 /* ViewSnapshotStoreMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewSnapshotStoreMac.mm; sourceTree = "<group>"; }; > 2D6CD11A189058A500E5A4A0 /* ViewSnapshotStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewSnapshotStore.cpp; sourceTree = "<group>"; }; > 2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageNavigationClient.h; sourceTree = "<group>"; }; > 2D790A9C1AD7050D00AB90B3 /* _WKLayoutMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKLayoutMode.h; sourceTree = "<group>"; }; >@@ -2733,8 +2730,6 @@ > 2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCALayerRemote.h; sourceTree = "<group>"; }; > 2DA049B5180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsLayerCARemote.cpp; sourceTree = "<group>"; }; > 2DA049B6180CCD0A00AAFA9E /* GraphicsLayerCARemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerCARemote.h; sourceTree = "<group>"; }; >- 2DA1E4FC18C02B6A00DBC929 /* WKLegacyPDFView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKLegacyPDFView.h; path = ios/WKLegacyPDFView.h; sourceTree = "<group>"; }; >- 2DA1E4FD18C02B6A00DBC929 /* WKLegacyPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKLegacyPDFView.mm; path = ios/WKLegacyPDFView.mm; sourceTree = "<group>"; }; > 2DA6731920C754B1003CB401 /* DynamicViewportSizeUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DynamicViewportSizeUpdate.h; path = ios/DynamicViewportSizeUpdate.h; sourceTree = "<group>"; }; > 2DA7FDCB18F88625008DDED0 /* FindIndicatorOverlayClientIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FindIndicatorOverlayClientIOS.h; path = ios/FindIndicatorOverlayClientIOS.h; sourceTree = "<group>"; }; > 2DA944971884E4F000ED86DB /* NativeWebKeyboardEventIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NativeWebKeyboardEventIOS.mm; path = ios/NativeWebKeyboardEventIOS.mm; sourceTree = "<group>"; }; >@@ -4403,7 +4398,6 @@ > CE11AD4F1CBC47F800681EE5 /* CodeSigning.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CodeSigning.mm; sourceTree = "<group>"; }; > CE11AD511CBC482F00681EE5 /* CodeSigning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeSigning.h; sourceTree = "<group>"; }; > CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssertionServicesSPI.h; sourceTree = "<group>"; }; >- CE1A0BCD1A48E6C60054EF74 /* CorePDFSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePDFSPI.h; sourceTree = "<group>"; }; > CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManagedConfigurationSPI.h; sourceTree = "<group>"; }; > CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCCSPI.h; sourceTree = "<group>"; }; > CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputSPI.h; sourceTree = "<group>"; }; >@@ -5856,8 +5850,6 @@ > A54293A3195A43C6002782C7 /* WKInspectorNodeSearchGestureRecognizer.mm */, > 2DD5E127210ADC7A00DB6012 /* WKKeyboardScrollingAnimator.h */, > 2DD5E126210ADC7A00DB6012 /* WKKeyboardScrollingAnimator.mm */, >- 2DA1E4FC18C02B6A00DBC929 /* WKLegacyPDFView.h */, >- 2DA1E4FD18C02B6A00DBC929 /* WKLegacyPDFView.mm */, > A15EEDE41E301CEE000069B0 /* WKPasswordView.h */, > A15EEDE31E301CEE000069B0 /* WKPasswordView.mm */, > 2D6AB53F192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h */, >@@ -7464,8 +7456,8 @@ > C98C48A41B6FD4C300145103 /* WebMediaSessionFocusManager.h */, > C9C183371B73FD6A007036A7 /* WebMediaSessionFocusManagerClient.cpp */, > C9C183381B73FD6A007036A7 /* WebMediaSessionFocusManagerClient.h */, >+ 2D3EF4401917646300034184 /* WebMemoryPressureHandler.cpp */, > 2D3EF4411917646300034184 /* WebMemoryPressureHandler.h */, >- 2D3EF4401917646300034184 /* WebMemoryPressureHandler.mm */, > 7CCCC8F81A5F50FD008FB0DA /* WebNavigationState.cpp */, > 7CCCC8F91A5F50FD008FB0DA /* WebNavigationState.h */, > BC1DFEA312B31F87005DF730 /* WebOpenPanelResultListenerProxy.cpp */, >@@ -8688,7 +8680,6 @@ > 2DB7667021B5E48A0045DDB1 /* AccessibilitySupportSPI.h */, > CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */, > CDA041F31ACE2105004A13EC /* BackBoardServicesSPI.h */, >- CE1A0BCD1A48E6C60054EF74 /* CorePDFSPI.h */, > 2D4AF0882044C3C4006C8817 /* FrontBoardServicesSPI.h */, > CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */, > A13B3DA1207F39DE0090C58D /* MobileWiFiSPI.h */, >@@ -9031,7 +9022,6 @@ > 37C4E9F6131C6E7E0029BD5A /* config.h in Headers */, > BC032DAB10F437D10058C15A /* Connection.h in Headers */, > 5106D7C418BDBE73000AB166 /* ContextMenuContextData.h in Headers */, >- CE1A0BD31A48E6C60054EF74 /* CorePDFSPI.h in Headers */, > 37C21CAE1E994C0C0029D5F9 /* CorePredictionSPI.h in Headers */, > B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */, > A1FB68271F6E51C100C43F9F /* CrashReporterClientSPI.h in Headers */, >@@ -9771,7 +9761,6 @@ > 2DD5E129210ADC7B00DB6012 /* WKKeyboardScrollingAnimator.h in Headers */, > 51A9E10B1315CD18009E7031 /* WKKeyValueStorageManager.h in Headers */, > 2D790A9F1AD7164900AB90B3 /* WKLayoutMode.h in Headers */, >- 2DA1E4FE18C02B6A00DBC929 /* WKLegacyPDFView.h in Headers */, > 5C5CEC30220911C700D6BBB0 /* WKMain.h in Headers */, > C98C48AA1B6FD5B500145103 /* WKMediaSessionFocusManager.h in Headers */, > C9CD439D1B4B024F00239E33 /* WKMediaSessionMetadata.h in Headers */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194559
:
361848
|
361853
|
361857