Remove the custom web page preview code
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Dec 2014 00:13:03 +0000 (00:13 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Dec 2014 00:13:03 +0000 (00:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139894
<rdar://problem/19333074>

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _dismissContentRelativeChildWindows]):
(-[WKView _viewForPreviewingURL:initialFrameSize:]): Deleted.
(-[WKView _titleForPreviewOfURL:]): Deleted.
(-[WKView _setPreviewTitle:]): Deleted.
(-[WKView _setPreviewLoading:]): Deleted.
(-[WKView _setPreviewOverrideImage:]): Deleted.
(-[WKView _finishPreviewingURL:withPreviewView:]): Deleted.
(-[WKView _handleClickInPreviewView:URL:]): Deleted.
(-[WKView _shouldUseStandardQuickLookPreview]): Deleted.
* UIProcess/mac/WKImmediateActionController.h:
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController willDestroyView:]):
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WKImmediateActionController _defaultAnimationController]):
(-[WKImmediateActionController hidePreview]): Deleted.
(-[WKImmediateActionController setPreviewTitle:]): Deleted.
(-[WKImmediateActionController setPreviewLoading:]): Deleted.
(-[WKImmediateActionController setPreviewOverrideImage:]): Deleted.
(-[WKImmediateActionController _animationControllerForCustomPreview]): Deleted.
* UIProcess/mac/WKPagePreviewViewController.h: Removed.
* UIProcess/mac/WKPagePreviewViewController.mm: Removed.
* UIProcess/mac/WKPreviewPopoverAnimationController.h: Removed.
* UIProcess/mac/WKPreviewPopoverAnimationController.mm: Removed.
* WebKit2.xcodeproj/project.pbxproj:
Remove all of the custom web page preview code. Clients that want the custom
preview can implement it by overriding the immediate action.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/mac/WKImmediateActionController.h
Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm
Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h [deleted file]
Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm [deleted file]
Source/WebKit2/UIProcess/mac/WKPreviewPopoverAnimationController.h [deleted file]
Source/WebKit2/UIProcess/mac/WKPreviewPopoverAnimationController.mm [deleted file]
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

index 707e6d82ef7a029c7713899c0e12b55afc4db744..ab3e0e30ec07ee2ba2361eef7f15eeb3803d212b 100644 (file)
@@ -1,3 +1,41 @@
+2014-12-23  Timothy Horton  <timothy_horton@apple.com>
+
+        Remove the custom web page preview code
+        https://bugs.webkit.org/show_bug.cgi?id=139894
+        <rdar://problem/19333074>
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKViewPrivate.h:
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _dismissContentRelativeChildWindows]):
+        (-[WKView _viewForPreviewingURL:initialFrameSize:]): Deleted.
+        (-[WKView _titleForPreviewOfURL:]): Deleted.
+        (-[WKView _setPreviewTitle:]): Deleted.
+        (-[WKView _setPreviewLoading:]): Deleted.
+        (-[WKView _setPreviewOverrideImage:]): Deleted.
+        (-[WKView _finishPreviewingURL:withPreviewView:]): Deleted.
+        (-[WKView _handleClickInPreviewView:URL:]): Deleted.
+        (-[WKView _shouldUseStandardQuickLookPreview]): Deleted.
+        * UIProcess/mac/WKImmediateActionController.h:
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController willDestroyView:]):
+        (-[WKImmediateActionController _clearImmediateActionState]):
+        (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
+        (-[WKImmediateActionController _defaultAnimationController]):
+        (-[WKImmediateActionController hidePreview]): Deleted.
+        (-[WKImmediateActionController setPreviewTitle:]): Deleted.
+        (-[WKImmediateActionController setPreviewLoading:]): Deleted.
+        (-[WKImmediateActionController setPreviewOverrideImage:]): Deleted.
+        (-[WKImmediateActionController _animationControllerForCustomPreview]): Deleted.
+        * UIProcess/mac/WKPagePreviewViewController.h: Removed.
+        * UIProcess/mac/WKPagePreviewViewController.mm: Removed.
+        * UIProcess/mac/WKPreviewPopoverAnimationController.h: Removed.
+        * UIProcess/mac/WKPreviewPopoverAnimationController.mm: Removed.
+        * WebKit2.xcodeproj/project.pbxproj:
+        Remove all of the custom web page preview code. Clients that want the custom
+        preview can implement it by overriding the immediate action.
+
 2014-12-23  Anders Carlsson  <andersca@apple.com>
 
         Add WebProcessProxy::transformHandlesToObjects
index 3b30cedbe93f6edf0a947797ef00282bfe0b7ee2..1c2594018f1a26684a77293494870b950c807790 100644 (file)
 // do something custom, return an object that conforms to the NSImmediateActionAnimationController protocol.
 - (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKImmediateActionType)type userData:(WKTypeRef)userData;
 
-- (NSView *)_viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize;
-- (NSString *)_titleForPreviewOfURL:(NSURL *)url;
-- (void)_setPreviewTitle:(NSString *)previewTitle;
-- (void)_setPreviewLoading:(BOOL)loading;
-- (void)_setPreviewOverrideImage:(NSImage *)image;
-- (void)_finishPreviewingURL:(NSURL *)url withPreviewView:(NSView *)previewView;
-- (void)_handleClickInPreviewView:(NSView *)previewView URL:(NSURL *)url;
-- (BOOL)_shouldUseStandardQuickLookPreview;
-
 - (void)_dismissContentRelativeChildWindows;
 #endif
 
index a50281d0ddb4c3af17badedc80d058c081004f92..b2afdb42d216524ff616564ad361a709896b0694 100644 (file)
@@ -4340,60 +4340,11 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
         [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
 
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [_data->_immediateActionController hidePreview];
-#endif
-
     [self _setTextIndicator:nullptr fadeOut:NO];
 
     static_cast<PageClient&>(*_data->_pageClient).dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
 }
 
-- (NSView *)_viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize
-{
-    return nil;
-}
-
-- (NSString *)_titleForPreviewOfURL:(NSURL *)url
-{
-    return nil;
-}
-
-- (void)_setPreviewTitle:(NSString *)previewTitle
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [_data->_immediateActionController setPreviewTitle:previewTitle];
-#endif
-}
-
-- (void)_setPreviewLoading:(BOOL)loading
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [_data->_immediateActionController setPreviewLoading:loading];
-#endif
-}
-
-- (void)_setPreviewOverrideImage:(NSImage *)image
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [_data->_immediateActionController setPreviewOverrideImage:image];
-#endif
-}
-
-- (void)_finishPreviewingURL:(NSURL *)url withPreviewView:(NSView *)previewView
-{
-}
-
-- (void)_handleClickInPreviewView:(NSView *)previewView URL:(NSURL *)url
-{
-    [[NSWorkspace sharedWorkspace] openURL:url];
-}
-
-- (BOOL)_shouldUseStandardQuickLookPreview
-{
-    return YES;
-}
-
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 
 - (void)_setAutomaticallyAdjustsContentInsets:(BOOL)automaticallyAdjustsContentInsets
index f56676f83faa913db361fb66bdcdae7bac29f4ef..212cdb85b1581b080afb2afdf74f7a3fc3db0179 100644 (file)
@@ -45,8 +45,6 @@ enum class ImmediateActionState {
 }
 
 @class DDActionContext;
-@class WKPagePreviewViewController;
-@class WKPreviewPopoverAnimationController;
 @class WKView;
 
 @interface WKImmediateActionController : NSObject <NSImmediateActionGestureRecognizerDelegate> {
@@ -60,12 +58,8 @@ enum class ImmediateActionState {
     _WKImmediateActionType _type;
     NSImmediateActionGestureRecognizer *_immediateActionRecognizer;
 
-    NSPoint _eventLocationInView;
-
     BOOL _hasActivatedActionContext;
     RetainPtr<DDActionContext> _currentActionContext;
-
-    RetainPtr<WKPreviewPopoverAnimationController> _previewAnimationController;
 }
 
 - (instancetype)initWithPage:(WebKit::WebPageProxy&)page view:(WKView *)wkView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
@@ -73,11 +67,6 @@ enum class ImmediateActionState {
 - (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&)hitTestResult userData:(API::Object*)userData;
 - (void)wkView:(WKView *)wkView willHandleMouseDown:(NSEvent *)event;
 
-- (void)setPreviewTitle:(NSString *)previewTitle;
-- (void)hidePreview;
-- (void)setPreviewLoading:(BOOL)loading;
-- (void)setPreviewOverrideImage:(NSImage *)image;
-
 @end
 
 #endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
index 4144d0acfba5a0797560a014029ae59644723e71..9767c980a61c92357a331782a9922a11b4419bad 100644 (file)
@@ -29,8 +29,6 @@
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 
 #import "WKNSURLExtras.h"
-#import "WKPagePreviewViewController.h"
-#import "WKPreviewPopoverAnimationController.h"
 #import "WKViewInternal.h"
 #import "WebPageMessages.h"
 #import "WebPageProxy.h"
@@ -73,8 +71,6 @@ using namespace WebKit;
 
 - (void)willDestroyView:(WKView *)view
 {
-    [_previewAnimationController close];
-
     _page = nullptr;
     _wkView = nil;
     _hitTestResult = ActionMenuHitTestResult();
@@ -98,8 +94,6 @@ using namespace WebKit;
 
 - (void)_clearImmediateActionState
 {
-    [self hidePreview];
-
     _page->clearTextIndicator();
 
     if (_currentActionContext && _hasActivatedActionContext) {
@@ -135,8 +129,7 @@ using namespace WebKit;
 
     [_wkView _dismissContentRelativeChildWindows];
 
-    _eventLocationInView = [immediateActionRecognizer locationInView:immediateActionRecognizer.view];
-    _page->performActionMenuHitTestAtLocation(_eventLocationInView, true);
+    _page->performActionMenuHitTestAtLocation([immediateActionRecognizer locationInView:immediateActionRecognizer.view], true);
 
     _state = ImmediateActionState::Pending;
     immediateActionRecognizer.animationController = nil;
@@ -226,22 +219,10 @@ using namespace WebKit;
     if (!absoluteLinkURL.isEmpty() && WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
         _type = kWKImmediateActionLinkPreview;
 
-        BOOL shouldUseStandardQuickLookPreview = [_wkView _shouldUseStandardQuickLookPreview] && [NSMenuItem respondsToSelector:@selector(standardQuickLookMenuItem)];
-        if (shouldUseStandardQuickLookPreview) {
-            RetainPtr<NSMenuItem> previewLinkItem;
-            RetainPtr<QLPreviewMenuItem> qlPreviewLinkItem;
-            if (shouldUseStandardQuickLookPreview) {
-                qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
-                [qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
-                [qlPreviewLinkItem setDelegate:self];
-            }
-            return (id<NSImmediateActionAnimationController>)qlPreviewLinkItem.get();
-        }
-
-        if (id<NSImmediateActionAnimationController> previewController = [self _animationControllerForCustomPreview])
-            return previewController;
-        return nil;
-
+        RetainPtr<QLPreviewMenuItem> qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
+        [qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
+        [qlPreviewLinkItem setDelegate:self];
+        return (id<NSImmediateActionAnimationController>)qlPreviewLinkItem.get();
     }
 
     if (hitTestResult->isTextNode() || hitTestResult->isOverTextInsideFormControlElement()) {
@@ -277,41 +258,6 @@ using namespace WebKit;
         _immediateActionRecognizer.animationController = defaultAnimationController;
 }
 
-#pragma mark Link Preview action
-
-- (void)hidePreview
-{
-    [_previewAnimationController close];
-}
-
-- (void)setPreviewTitle:(NSString *)previewTitle
-{
-    [_previewAnimationController setPreviewTitle:previewTitle];
-}
-
-- (void)setPreviewLoading:(BOOL)loading
-{
-    [_previewAnimationController setPreviewLoading:loading];
-}
-
-- (void)setPreviewOverrideImage:(NSImage *)image
-{
-    [_previewAnimationController setPreviewOverrideImage:image];
-}
-
-- (id<NSImmediateActionAnimationController>)_animationControllerForCustomPreview
-{
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    RetainPtr<NSURL> url = [NSURL _web_URLWithWTFString:hitTestResult->absoluteLinkURL()];
-
-    if (_hitTestResult.linkTextIndicator)
-        _page->setTextIndicator(_hitTestResult.linkTextIndicator->data(), false);
-
-    _previewAnimationController = adoptNS([[WKPreviewPopoverAnimationController alloc] initWithURL:url.get() view:_wkView page:*_page originRect:hitTestResult->elementBoundingBox() eventLocationInView:_eventLocationInView]);
-
-    return _previewAnimationController.get();
-}
-
 #pragma mark QLPreviewMenuItemDelegate implementation
 
 - (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint
diff --git a/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h b/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h
deleted file mode 100644 (file)
index 8c7c72d..0000000
+++ /dev/null
@@ -1,70 +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.
- */
-
-#ifndef WKPagePreviewViewController_h
-#define WKPagePreviewViewController_h
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#import <wtf/RetainPtr.h>
-
-@class NSString;
-@class NSTextField;
-@class NSURL;
-@class NSView;
-@class WKPagePreviewViewController;
-
-@protocol WKPagePreviewViewControllerDelegate <NSObject>
-- (NSView *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize;
-- (NSString *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController titleForPreviewOfURL:(NSURL *)url;
-- (void)pagePreviewViewControllerWasClicked:(WKPagePreviewViewController *)pagePreviewViewController;
-@end
-
-@interface WKPagePreviewViewController : NSViewController {
-@public
-    NSSize _mainViewSize;
-    RetainPtr<NSURL> _url;
-    RetainPtr<NSView> _previewView;
-    RetainPtr<NSTextField> _titleTextField;
-    RetainPtr<NSString> _previewTitle;
-    RetainPtr<NSProgressIndicator> _spinner;
-    BOOL _loading;
-    id <WKPagePreviewViewControllerDelegate> _delegate;
-    CGFloat _popoverToViewScale;
-}
-
-@property (nonatomic, copy) NSString *previewTitle;
-@property (nonatomic, getter=isLoading) BOOL loading;
-
-- (instancetype)initWithPageURL:(NSURL *)URL mainViewSize:(NSSize)size popoverToViewScale:(CGFloat)scale;
-- (void)replacePreviewWithImage:(NSImage *)image atSize:(NSSize)size;
-
-+ (NSSize)previewPadding;
-
-@end
-
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#endif // WKPagePreviewViewController_h
diff --git a/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm b/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm
deleted file mode 100644 (file)
index e384658..0000000
+++ /dev/null
@@ -1,179 +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.
- */
-
-#import "config.h"
-#import "WKPagePreviewViewController.h"
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-static const CGFloat previewViewInset = 3;
-static const CGFloat previewViewTitleHeight = 34;
-
-@implementation WKPagePreviewViewController
-
-- (instancetype)initWithPageURL:(NSURL *)URL mainViewSize:(NSSize)size popoverToViewScale:(CGFloat)scale
-{
-    if (!(self = [super init]))
-        return nil;
-
-    _url = URL;
-    _mainViewSize = size;
-    _popoverToViewScale = scale;
-
-    return self;
-}
-
-- (NSString *)previewTitle
-{
-    return _previewTitle.get();
-}
-
-- (void)setPreviewTitle:(NSString *)previewTitle
-{
-    if ([_previewTitle isEqualToString:previewTitle])
-        return;
-
-    // Keep a separate copy around in case this is received before the view hierarchy is created.
-    _previewTitle = adoptNS([previewTitle copy]);
-    [_titleTextField setStringValue:previewTitle ? previewTitle : @""];
-}
-
-+ (NSSize)previewPadding
-{
-    return NSMakeSize(2 * previewViewInset, previewViewTitleHeight + 2 * previewViewInset);
-}
-
-- (void)setLoading:(BOOL)loading
-{
-    if (_loading == loading)
-        return;
-
-    _loading = loading;
-
-    [_previewView setHidden:loading];
-
-    if (_loading)
-        [_spinner startAnimation:nil];
-    else
-        [_spinner stopAnimation:nil];
-}
-
-- (BOOL)isLoading
-{
-    return _loading;
-}
-
-- (void)loadView
-{
-    NSRect defaultFrame = NSMakeRect(0, 0, _mainViewSize.width, _mainViewSize.height);
-    _previewView = [_delegate pagePreviewViewController:self viewForPreviewingURL:_url.get() initialFrameSize:defaultFrame.size];
-    ASSERT(_previewView);
-
-    RetainPtr<NSClickGestureRecognizer> clickRecognizer = adoptNS([[NSClickGestureRecognizer alloc] initWithTarget:self action:@selector(_clickRecognized:)]);
-    [_previewView addGestureRecognizer:clickRecognizer.get()];
-
-    NSRect previewFrame = [_previewView frame];
-    NSRect containerFrame = previewFrame;
-    NSSize totalPadding = [[self class] previewPadding];
-    containerFrame.size.width += totalPadding.width;
-    containerFrame.size.height += totalPadding.height;
-    previewFrame = NSOffsetRect(previewFrame, previewViewInset, previewViewInset);
-
-    RetainPtr<NSView> containerView = adoptNS([[NSView alloc] initWithFrame:containerFrame]);
-    [containerView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-    [containerView addSubview:_previewView.get()];
-    [_previewView setFrame:previewFrame];
-    [_previewView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-    [_previewView setHidden:YES];
-
-    _titleTextField = adoptNS([[NSTextField alloc] init]);
-    [_titleTextField setWantsLayer:YES];
-    [_titleTextField setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
-    [_titleTextField setEditable:NO];
-    [_titleTextField setBezeled:NO];
-    [_titleTextField setDrawsBackground:NO];
-    [_titleTextField setAlignment:NSCenterTextAlignment];
-    [_titleTextField setUsesSingleLineMode:YES];
-    [_titleTextField setLineBreakMode:NSLineBreakByTruncatingTail];
-    [_titleTextField setTextColor:[NSColor labelColor]];
-
-    NSString *title = _previewTitle.get();
-    if (!title)
-        title = [_delegate pagePreviewViewController:self titleForPreviewOfURL:_url.get()];
-    if (!title)
-        title = [_url absoluteString];
-
-    [_titleTextField setStringValue:title ? title : @""];
-
-    [_titleTextField sizeToFit];
-    NSSize titleFittingSize = [_titleTextField frame].size;
-    CGFloat textFieldCenteringOffset = (NSMaxY(containerFrame) - NSMaxY(previewFrame) - titleFittingSize.height) / 2;
-
-    NSRect titleFrame = previewFrame;
-    titleFrame.size.height = titleFittingSize.height;
-    titleFrame.origin.y = NSMaxY(previewFrame) + textFieldCenteringOffset;
-    [_titleTextField setFrame:titleFrame];
-    [containerView addSubview:_titleTextField.get()];
-
-    NSSize spinnerSize = NSMakeSize(48, 48);
-    NSRect spinnerFrame = NSMakeRect(NSMidX(containerFrame), NSMidY(containerFrame), 0, 0);
-    spinnerFrame = NSInsetRect(spinnerFrame, -spinnerSize.width * 0.5, -spinnerSize.height * 0.5);
-    spinnerFrame.origin.x = floor(spinnerFrame.origin.x);
-    spinnerFrame.origin.y = floor(spinnerFrame.origin.y);
-
-    _spinner = adoptNS([[NSProgressIndicator alloc] initWithFrame:spinnerFrame]);
-    [_spinner setStyle:NSProgressIndicatorSpinningStyle];
-    [_spinner setDisplayedWhenStopped:NO];
-    [_spinner setAutoresizingMask:NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin];
-    [_spinner setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]];
-    if (_loading)
-        [_spinner startAnimation:nil];
-
-    [containerView addSubview:_spinner.get()];
-
-    // Setting the webView bounds will scale it to 75% of the _mainViewSize.
-    [_previewView setBounds:NSMakeRect(0, 0, _mainViewSize.width / _popoverToViewScale, _mainViewSize.height / _popoverToViewScale)];
-
-    self.view = containerView.get();
-}
-
-- (void)replacePreviewWithImage:(NSImage *)image atSize:(NSSize)size
-{
-    RetainPtr<NSClickGestureRecognizer> clickRecognizer = adoptNS([[NSClickGestureRecognizer alloc] initWithTarget:self action:@selector(_clickRecognized:)]);
-    RetainPtr<NSImageView> imageView = adoptNS([[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)]);
-    [imageView setImage:image];
-    [imageView addGestureRecognizer:clickRecognizer.get()];
-    self.view = imageView.get();
-}
-
-- (void)_clickRecognized:(NSGestureRecognizer *)gestureRecognizer
-{
-    if (gestureRecognizer.state == NSGestureRecognizerStateBegan)
-        [_delegate pagePreviewViewControllerWasClicked:self];
-}
-
-@end
-
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
diff --git a/Source/WebKit2/UIProcess/mac/WKPreviewPopoverAnimationController.h b/Source/WebKit2/UIProcess/mac/WKPreviewPopoverAnimationController.h
deleted file mode 100644 (file)
index d438913..0000000
+++ /dev/null
@@ -1,78 +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.
- */
-
-#ifndef WKPreviewPopoverAnimationController_h
-#define WKPreviewPopoverAnimationController_h
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
-#import <wtf/Forward.h>
-#import <wtf/RetainPtr.h>
-
-namespace WebKit {
-class WebPageProxy;
-};
-
-@class NSImmediateActionGestureRecognizer;
-@class NSPopoverAnimationController;
-@class NSString;
-@class NSURL;
-@class WKPagePreviewViewController;
-@class WKView;
-
-@interface WKPreviewPopoverAnimationController : NSObject <NSImmediateActionAnimationController> {
-    bool _shouldShowPreviewWhenLoaded;
-    bool _hasFinishedLoading;
-
-    WKView *_wkView;
-    RetainPtr<NSURL> _url;
-    WebKit::WebPageProxy* _page;
-
-    RetainPtr<NSPopover> _previewPopover;
-    NSRect _popoverOriginRect;
-    RetainPtr<WKPagePreviewViewController> _previewViewController;
-    NSPoint _eventLocationInView;
-
-    RetainPtr<NSPopoverAnimationController> _popoverAnimationController;
-
-    NSImmediateActionGestureRecognizer *_recognizer;
-    bool _didCompleteAnimation;
-    RetainPtr<NSTimer> _previewWatchdogTimer;
-}
-
-- (instancetype)initWithURL:(NSURL *)url view:(WKView *)wkView page:(WebKit::WebPageProxy&)page originRect:(NSRect)originRect eventLocationInView:(NSPoint)eventLocationInView;
-- (void)close;
-
-- (void)setPreviewTitle:(NSString *)previewTitle;
-- (void)setPreviewLoading:(BOOL)loading;
-- (void)setPreviewOverrideImage:(NSImage *)image;
-
-@end
-
-
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#endif // WKPreviewPopoverAnimationController_h
diff --git a/Source/WebKit2/UIProcess/mac/WKPreviewPopoverAnimationController.mm b/Source/WebKit2/UIProcess/mac/WKPreviewPopoverAnimationController.mm
deleted file mode 100644 (file)
index f105341..0000000
+++ /dev/null
@@ -1,367 +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.
- */
-
-#import "config.h"
-#import "WKPreviewPopoverAnimationController.h"
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#import "WKPagePreviewViewController.h"
-#import "WKViewInternal.h"
-#import "WebPageProxy.h"
-#import <WebCore/FloatRect.h>
-#import <WebCore/GeometryUtilities.h>
-#import <WebCore/NSPopoverSPI.h>
-#import <algorithm>
-
-using namespace WebCore;
-using namespace WebKit;
-
-@interface WKPreviewPopoverAnimationController () <WKPagePreviewViewControllerDelegate, NSPopoverDelegate>
-@end
-
-static const CGFloat preferredPopoverToViewScale = 0.75;
-
-@implementation WKPreviewPopoverAnimationController
-
-+ (bool)_shouldImmediatelyShowPreview
-{
-    static bool shouldImmediatelyShowPreview;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        shouldImmediatelyShowPreview = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitShouldImmediatelyShowPreview"];
-    });
-    return shouldImmediatelyShowPreview;
-}
-
-- (instancetype)initWithURL:(NSURL *)url view:(WKView *)wkView page:(WebPageProxy&)page originRect:(NSRect)originRect eventLocationInView:(NSPoint)eventLocationInView
-{
-    self = [super init];
-
-    if (!self)
-        return nil;
-
-    _url = url;
-    _wkView = wkView;
-    _page = &page;
-    _popoverOriginRect = originRect;
-
-    // FIXME: We should be able to get this from the recognizer.
-    _eventLocationInView = eventLocationInView;
-
-    return self;
-}
-
-- (void)close
-{
-    [self _hidePreview];
-
-    _wkView = nil;
-    _page = nullptr;
-}
-
-- (void)setPreviewLoading:(BOOL)loading
-{
-    [_previewViewController setLoading:loading];
-    _hasFinishedLoading = !loading;
-    if (!loading && _shouldShowPreviewWhenLoaded)
-        [self _showPreview];
-}
-
-- (void)setPreviewOverrideImage:(NSImage *)image
-{
-    NSSize imageSize = image.size;
-    NSSize scaledImageSize;
-    if ([_previewPopover isShown]) {
-        NSSize currentPopoverContentSize = [_previewPopover contentSize];
-        float scale = std::min(std::min<float>(currentPopoverContentSize.width / imageSize.width, 1.0), std::min<float>(currentPopoverContentSize.height / imageSize.height, 1.0));
-        scaledImageSize = NSMakeSize(imageSize.width * scale, imageSize.height * scale);
-    } else
-        scaledImageSize = [self _preferredPopoverSizeWithPreviewPadding:[WKPagePreviewViewController previewPadding] forTargetSize:imageSize];
-
-    [_previewPopover setContentSize:scaledImageSize];
-    [_previewViewController replacePreviewWithImage:image atSize:scaledImageSize];
-}
-
-- (void)_hidePreview
-{
-    if (_page)
-        _page->clearTextIndicator();
-
-    if (_previewViewController) {
-        _previewViewController->_delegate = nil;
-        [_wkView _finishPreviewingURL:_previewViewController->_url.get() withPreviewView:_previewViewController->_previewView.get()];
-        _previewViewController = nil;
-    }
-
-    [_previewPopover close];
-    [_previewPopover setDelegate:nil];
-    _previewPopover = nil;
-}
-
-- (void)setPreviewTitle:(NSString *)previewTitle
-{
-    [_previewViewController setPreviewTitle:previewTitle];
-}
-
-- (void)_createPreviewPopover
-{
-    NSSize previewPadding = [WKPagePreviewViewController previewPadding];
-    NSSize popoverSize = [self _preferredPopoverSizeWithPreviewPadding:previewPadding forTargetSize:[self _targetSizeForPagePreview]];
-    CGFloat actualPopoverToViewScale = popoverSize.width / NSWidth(_wkView.bounds);
-    popoverSize.width += previewPadding.width;
-    popoverSize.height += previewPadding.height;
-
-    _previewViewController = adoptNS([[WKPagePreviewViewController alloc] initWithPageURL:_url.get() mainViewSize:_wkView.bounds.size popoverToViewScale:actualPopoverToViewScale]);
-    _previewViewController->_delegate = self;
-    [_previewViewController setLoading:YES];
-    [_previewViewController loadView];
-
-    _previewPopover = adoptNS([[NSPopover alloc] init]);
-    [_previewPopover setBehavior:NSPopoverBehaviorTransient];
-    [_previewPopover setContentSize:popoverSize];
-    [_previewPopover setContentViewController:_previewViewController.get()];
-    [_previewPopover setDelegate:self];
-    [_previewPopover setPositioningOptions:NSPopoverPositioningOptionKeepTopStable];
-}
-
-- (void)_showPreview
-{
-    _shouldShowPreviewWhenLoaded = false;
-    [_previewWatchdogTimer invalidate];
-    _previewWatchdogTimer = nil;
-
-    Class nsPopoverAnimationControllerClass = NSClassFromString(@"NSPopoverAnimationController");
-    if (nsPopoverAnimationControllerClass) {
-        _popoverAnimationController = [nsPopoverAnimationControllerClass popoverAnimationControllerWithPopover:_previewPopover.get()];
-        [_popoverAnimationController setPreferredEdge:NSMaxYEdge];
-        [_popoverAnimationController setAnchorView:_wkView];
-        [_popoverAnimationController setPositioningRect:_popoverOriginRect];
-
-        [_popoverAnimationController recognizerWillBeginAnimation:_recognizer];
-
-        if (_didCompleteAnimation)
-            [_popoverAnimationController recognizerDidCompleteAnimation:_recognizer];
-        else
-            [_popoverAnimationController recognizerDidUpdateAnimation:_recognizer];
-    }
-}
-
-static bool targetSizeFitsInAvailableSpace(NSSize targetSize, NSSize availableSpace)
-{
-    return targetSize.width <= availableSpace.width && targetSize.height <= availableSpace.height;
-}
-
-- (NSSize)largestPopoverSize
-{
-    NSSize screenSize = _wkView.window.screen.frame.size;
-
-    if (screenSize.width == 1280 && screenSize.height == 800)
-        return NSMakeSize(1240, 674);
-
-    if (screenSize.width == 1366 && screenSize.height == 768)
-        return NSMakeSize(1264, 642);
-
-    if (screenSize.width == 1440 && screenSize.height == 900)
-        return NSMakeSize(1264, 760);
-
-    if (screenSize.width == 1680 && screenSize.height == 1050)
-        return NSMakeSize(1324, 910);
-
-    return NSMakeSize(1324, 940);
-}
-
-- (NSSize)_targetSizeForPagePreview
-{
-    NSRect wkViewBounds = _wkView.bounds;
-    return NSMakeSize(NSWidth(wkViewBounds) * preferredPopoverToViewScale, NSHeight(wkViewBounds) * preferredPopoverToViewScale);
-}
-
-- (NSSize)_effectivePaddingWithPreviewPadding:(NSSize)previewPadding
-{
-    static const NSSize screenPadding = NSMakeSize(40, 40);
-    NSSize effectivePadding = NSMakeSize(screenPadding.width + previewPadding.width, screenPadding.height + previewPadding.height);
-    return effectivePadding;
-}
-
-- (NSSize)_maxSpaceAvailableOnYEdgeForOriginRect:(NSRect)originRect withScreenRect:(NSRect)screenRect previewPadding:(NSSize)previewPadding
-{
-    CGFloat availableSpaceAbove = NSMaxY(screenRect) - NSMaxY(originRect);
-    CGFloat availableSpaceBelow = NSMinY(originRect) - NSMinY(screenRect);
-    NSSize effectivePadding = [self _effectivePaddingWithPreviewPadding:previewPadding];
-    CGFloat maxAvailableVerticalSpace = fmax(availableSpaceAbove, availableSpaceBelow) - effectivePadding.height;
-    return NSMakeSize(screenRect.size.width - effectivePadding.height, maxAvailableVerticalSpace);
-}
-
-- (NSSize)_maxSpaceAvailableOnXEdgeForOriginRect:(NSRect)originRect withScreenRect:(NSRect)screenRect previewPadding:(NSSize)previewPadding
-{
-    CGFloat availableSpaceAtLeft = NSMinX(originRect) - NSMinX(screenRect);
-    CGFloat availableSpaceAtRight = NSMaxX(screenRect) - NSMaxX(originRect);
-    NSSize effectivePadding = [self _effectivePaddingWithPreviewPadding:previewPadding];
-    CGFloat maxAvailableHorizontalSpace = fmax(availableSpaceAtLeft, availableSpaceAtRight) - effectivePadding.width;
-    return NSMakeSize(maxAvailableHorizontalSpace, screenRect.size.height - effectivePadding.width);
-}
-
-- (NSSize)_preferredPopoverSizeWithPreviewPadding:(NSSize)previewPadding forTargetSize:(NSSize)targetSize
-{
-    static const NSSize smallestPopoverSize = NSMakeSize(500, 500);
-
-    NSWindow *window = _wkView.window;
-    NSRect originScreenRect = [window convertRectToScreen:[_wkView convertRect:_popoverOriginRect toView:nil]];
-    NSRect screenFrame = window.screen.visibleFrame;
-
-    NSSize largestPopoverSize = [self largestPopoverSize];
-
-    NSSize maxSpaceAvailableOnYEdge = [self _maxSpaceAvailableOnYEdgeForOriginRect:originScreenRect withScreenRect:screenFrame previewPadding:previewPadding];
-    if (targetSizeFitsInAvailableSpace(targetSize, maxSpaceAvailableOnYEdge) && targetSizeFitsInAvailableSpace(targetSize, largestPopoverSize))
-        return targetSize;
-
-    NSSize maxSpaceAvailableOnXEdge = [self _maxSpaceAvailableOnXEdgeForOriginRect:originScreenRect withScreenRect:screenFrame previewPadding:previewPadding];
-    if (targetSizeFitsInAvailableSpace(targetSize, maxSpaceAvailableOnXEdge) && targetSizeFitsInAvailableSpace(targetSize, largestPopoverSize))
-        return targetSize;
-
-    // If the originScreenRect is very large, then it's possible that we have negative available space once the screen padding
-    // was taken into account. If that is the case, give up not on not trying to obscure the origin URL.
-    if ((maxSpaceAvailableOnYEdge.width < 0 || maxSpaceAvailableOnYEdge.height < 0) && (maxSpaceAvailableOnXEdge.width < 0 || maxSpaceAvailableOnXEdge.height < 0)) {
-        _popoverOriginRect.origin = _eventLocationInView;
-        _popoverOriginRect.size = NSMakeSize(1, 1);
-        originScreenRect = [window convertRectToScreen:[_wkView convertRect:_popoverOriginRect toView:nil]];
-        maxSpaceAvailableOnYEdge = [self _maxSpaceAvailableOnYEdgeForOriginRect:originScreenRect withScreenRect:screenFrame previewPadding:previewPadding];
-        maxSpaceAvailableOnXEdge = [self _maxSpaceAvailableOnXEdgeForOriginRect:originScreenRect withScreenRect:screenFrame previewPadding:previewPadding];
-    }
-
-    // Adjust the maximum space available if it is larger than the largest popover size.
-    if (maxSpaceAvailableOnYEdge.width > largestPopoverSize.width && maxSpaceAvailableOnYEdge.height > largestPopoverSize.height)
-        maxSpaceAvailableOnYEdge = largestPopoverSize;
-    if (maxSpaceAvailableOnXEdge.width > largestPopoverSize.width && maxSpaceAvailableOnXEdge.height > largestPopoverSize.height)
-        maxSpaceAvailableOnXEdge = largestPopoverSize;
-
-    // If the target size doesn't fit anywhere, we'll find the largest rect that does fit that also maintains the original view's aspect ratio.
-    CGFloat aspectRatio = targetSize.width / targetSize.height;
-    FloatRect maxVerticalTargetSizePreservingAspectRatioRect = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(FloatPoint(), FloatSize(maxSpaceAvailableOnYEdge)));
-    FloatRect maxHorizontalTargetSizePreservingAspectRatioRect = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(FloatPoint(), FloatSize(maxSpaceAvailableOnXEdge)));
-
-    NSSize maxVerticalTargetSizePreservingAspectRatio = NSMakeSize(maxVerticalTargetSizePreservingAspectRatioRect.width(), maxVerticalTargetSizePreservingAspectRatioRect.height());
-    NSSize maxHortizontalTargetSizePreservingAspectRatio = NSMakeSize(maxHorizontalTargetSizePreservingAspectRatioRect.width(), maxHorizontalTargetSizePreservingAspectRatioRect.height());
-
-    NSSize computedTargetSize;
-    if ((maxVerticalTargetSizePreservingAspectRatio.width * maxVerticalTargetSizePreservingAspectRatio.height) > (maxHortizontalTargetSizePreservingAspectRatio.width * maxHortizontalTargetSizePreservingAspectRatio.height))
-        computedTargetSize = maxVerticalTargetSizePreservingAspectRatio;
-    else
-        computedTargetSize = maxHortizontalTargetSizePreservingAspectRatio;
-
-    // Now make sure what we've computed isn't too small.
-    if (computedTargetSize.width < smallestPopoverSize.width && computedTargetSize.height < smallestPopoverSize.height) {
-        float limitWidth = smallestPopoverSize.width > computedTargetSize.width ? smallestPopoverSize.width : computedTargetSize.width;
-        float limitHeight = smallestPopoverSize.height > computedTargetSize.height ? smallestPopoverSize.height : computedTargetSize.height;
-        FloatRect targetRectLargerThanMinSize = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(0, 0, limitWidth, limitHeight));
-        computedTargetSize = NSMakeSize(targetRectLargerThanMinSize.size().width(), targetRectLargerThanMinSize.size().height());
-
-        // If our orignal computedTargetSize was so small that we had to get here and make a new computedTargetSize that is
-        // larger than the minimum, then the elementBoundingBox of the _hitTestResult is probably huge. So we should use
-        // the event origin as the popover origin in this case and not worry about obscuring the _hitTestResult.
-        _popoverOriginRect.origin = _eventLocationInView;
-        _popoverOriginRect.size = NSMakeSize(1, 1);
-    }
-    
-    return computedTargetSize;
-}
-
-- (void)_previewWatchdogTimerFired:(NSTimer *)timer
-{
-    [self _showPreview];
-    _previewWatchdogTimer = nil;
-}
-
-#pragma mark NSImmediateActionAnimationController
-
-- (void)recognizerWillBeginAnimation:(NSImmediateActionGestureRecognizer *)recognizer
-{
-    _recognizer = recognizer;
-    _didCompleteAnimation = false;
-    [self _createPreviewPopover];
-
-    if ([self.class _shouldImmediatelyShowPreview])
-        [self _showPreview];
-    else {
-        _shouldShowPreviewWhenLoaded = true;
-        _previewWatchdogTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(_previewWatchdogTimerFired:) userInfo:nil repeats:NO];
-    }
-}
-
-- (void)recognizerDidUpdateAnimation:(NSImmediateActionGestureRecognizer *)recognizer
-{
-    [_popoverAnimationController recognizerDidUpdateAnimation:recognizer];
-}
-
-- (void)recognizerDidCancelAnimation:(NSImmediateActionGestureRecognizer *)recognizer
-{
-    [self _hidePreview];
-
-    [_popoverAnimationController recognizerDidCancelAnimation:recognizer];
-}
-
-- (void)recognizerDidCompleteAnimation:(NSImmediateActionGestureRecognizer *)recognizer
-{
-    _didCompleteAnimation = true;
-    [_popoverAnimationController recognizerDidCompleteAnimation:recognizer];
-}
-
-- (void)recognizerDidDismissAnimation:(NSImmediateActionGestureRecognizer *)recognizer
-{
-    [self _hidePreview];
-
-    [_popoverAnimationController recognizerDidDismissAnimation:recognizer];
-}
-
-#pragma mark WKPagePreviewViewControllerDelegate
-
-- (NSView *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize
-{
-    return [_wkView _viewForPreviewingURL:url initialFrameSize:initialFrameSize];
-}
-
-- (NSString *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController titleForPreviewOfURL:(NSURL *)url
-{
-    return [_wkView _titleForPreviewOfURL:url];
-}
-
-- (void)pagePreviewViewControllerWasClicked:(WKPagePreviewViewController *)pagePreviewViewController
-{
-    if (NSURL *url = pagePreviewViewController->_url.get())
-        [_wkView _handleClickInPreviewView:pagePreviewViewController->_previewView.get() URL:url];
-}
-
-#pragma mark NSPopoverDelegate
-
-- (void)popoverWillClose:(NSNotification *)notification
-{
-    [self _hidePreview];
-}
-
-@end
-
-
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
index c79e24c582936d609a4217a63450d342504969f6..1801770f09129e1b577d9814d7f07d9db464830f 100644 (file)
                29D55DF2161BF9F10031A2E3 /* WebPageGroupProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */; };
                2D0730A219F9C7DA00E9D9C4 /* WKActionMenuController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D0730A019F9C7DA00E9D9C4 /* WKActionMenuController.mm */; };
                2D0730A319F9C7DA00E9D9C4 /* WKActionMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0730A119F9C7DA00E9D9C4 /* WKActionMenuController.h */; };
-               2D0B8ACA1A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0B8AC81A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.h */; };
-               2D0B8ACB1A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D0B8AC91A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.mm */; };
                2D125C5E1857EA05003BA3CB /* ViewGestureController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D125C5C1857EA05003BA3CB /* ViewGestureController.h */; };
                2D125C5F1857EA05003BA3CB /* ViewGestureControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */; };
                2D1B5D5D185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D1B5D5B185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp */; };
                2DDF731618E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DDF731418E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm */; };
                2DE6943D18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */; };
                2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */; };
-               2DEB34711A3987AB0030E2BA /* WKPagePreviewViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DEB346F1A3987AB0030E2BA /* WKPagePreviewViewController.h */; };
-               2DEB34721A3987AB0030E2BA /* WKPagePreviewViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB34701A3987AB0030E2BA /* WKPagePreviewViewController.mm */; };
                2DF9593B18A42412009785A1 /* ViewGestureControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */; };
                31099973146C75A20029DEB9 /* WebNotificationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31099971146C759B0029DEB9 /* WebNotificationClient.cpp */; };
                310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31099968146C71F50029DEB9 /* WebNotificationClient.h */; };
                29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupProxyMessages.h; sourceTree = "<group>"; };
                2D0730A019F9C7DA00E9D9C4 /* WKActionMenuController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKActionMenuController.mm; sourceTree = "<group>"; };
                2D0730A119F9C7DA00E9D9C4 /* WKActionMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKActionMenuController.h; sourceTree = "<group>"; };
-               2D0B8AC81A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreviewPopoverAnimationController.h; sourceTree = "<group>"; };
-               2D0B8AC91A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPreviewPopoverAnimationController.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>"; };
                2D1B5D5A18586599006C6596 /* ViewGestureController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = ViewGestureController.messages.in; sourceTree = "<group>"; };
                2DDF731418E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerBackingStoreCollection.mm; sourceTree = "<group>"; };
                2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmartMagnificationControllerMessageReceiver.cpp; sourceTree = "<group>"; };
                2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmartMagnificationControllerMessages.h; sourceTree = "<group>"; };
-               2DEB346F1A3987AB0030E2BA /* WKPagePreviewViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPagePreviewViewController.h; sourceTree = "<group>"; };
-               2DEB34701A3987AB0030E2BA /* WKPagePreviewViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPagePreviewViewController.mm; sourceTree = "<group>"; };
                2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ViewGestureControllerIOS.mm; path = ios/ViewGestureControllerIOS.mm; sourceTree = "<group>"; };
                31099968146C71F50029DEB9 /* WebNotificationClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebNotificationClient.h; sourceTree = "<group>"; };
                31099971146C759B0029DEB9 /* WebNotificationClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationClient.cpp; sourceTree = "<group>"; };
                                CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */,
                                9321D5851A38EE3C008052BE /* WKImmediateActionController.h */,
                                9321D5871A38EE74008052BE /* WKImmediateActionController.mm */,
-                               2DEB346F1A3987AB0030E2BA /* WKPagePreviewViewController.h */,
-                               2DEB34701A3987AB0030E2BA /* WKPagePreviewViewController.mm */,
-                               2D0B8AC81A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.h */,
-                               2D0B8AC91A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.mm */,
                                0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */,
                                0FCB4E5D18BBE3D9000FCFC9 /* WKPrintingView.mm */,
                                0FCB4E5E18BBE3D9000FCFC9 /* WKTextInputWindowController.h */,
                                93BDEB01171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h in Headers */,
                                1AB8A1EE18400ACB00E9AE69 /* WKPagePolicyClient.h in Headers */,
                                373CEAD81859553F008C363D /* WKPagePolicyClientInternal.h in Headers */,
-                               2DEB34711A3987AB0030E2BA /* WKPagePreviewViewController.h in Headers */,
                                BC177465118B9FF4007D9E9A /* WKPagePrivate.h in Headers */,
                                BCE17B7E1381F1170012A641 /* WKPagePrivateMac.h in Headers */,
                                1AB8A1F218400B6200E9AE69 /* WKPageUIClient.h in Headers */,
                                7C8EB11718DB6A19007917C2 /* WKPreferencesPrivate.h in Headers */,
                                BCD597D0112B56AC00EC8C23 /* WKPreferencesRef.h in Headers */,
                                762B748D120BC75C00819339 /* WKPreferencesRefPrivate.h in Headers */,
-                               2D0B8ACA1A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.h in Headers */,
                                0FCB4E6618BBE3D9000FCFC9 /* WKPrintingView.h in Headers */,
                                BCBAACEB145225E30053F82F /* WKProcessGroup.h in Headers */,
                                BCBAACED145225E30053F82F /* WKProcessGroupPrivate.h in Headers */,
                                755422BD18062BB20046F6A8 /* WKOriginDataManager.cpp in Sources */,
                                BCD597D6112B56DC00EC8C23 /* WKPage.cpp in Sources */,
                                BC7B633812A45ABA00D174A4 /* WKPageGroup.cpp in Sources */,
-                               2DEB34721A3987AB0030E2BA /* WKPagePreviewViewController.mm in Sources */,
                                BCE17B7D1381F1170012A641 /* WKPagePrivateMac.cpp in Sources */,
                                2D6AB542192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.mm in Sources */,
                                2DA1E4FF18C02B6A00DBC929 /* WKPDFView.mm in Sources */,
                                1AC86FF3130B46D3002C1257 /* WKPluginSiteDataManager.cpp in Sources */,
                                BCD597D1112B56AC00EC8C23 /* WKPreferences.cpp in Sources */,
                                1AFDD3191891CA1200153970 /* WKPreferences.mm in Sources */,
-                               2D0B8ACB1A42A39C006D7FC8 /* WKPreviewPopoverAnimationController.mm in Sources */,
                                0FCB4E6718BBE3D9000FCFC9 /* WKPrintingView.mm in Sources */,
                                BCBAACEC145225E30053F82F /* WKProcessGroup.mm in Sources */,
                                1A158419189044F50017616C /* WKProcessPool.mm in Sources */,