+2018-05-15 Dean Jackson <dino@apple.com>
+
+ Update animation when presenting QuickLook
+ https://bugs.webkit.org/show_bug.cgi?id=185648
+ <rdar://problem/39652624>
+
+ Reviewed by Antoine Quint.
+
+ Implement the QuickLook delegate on _WKPreviewControllerDelegate that
+ produces a zoom-like animation when the QLPreviewController appears.
+
+ * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
+ (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
+ * UIProcess/SystemPreviewController.h: Add a reference back to the page, so that
+ the delegate implementation can access the presentingViewController.
+ (WebKit::SystemPreviewController::page):
+
2018-05-14 Dean Jackson <dino@apple.com>
Download and present System Preview
if (_previewController)
_previewController->cancel();
}
+
+- (CGRect)previewController:(QLPreviewController *)controller frameForPreviewItem:(id <QLPreviewItem>)item inSourceView:(UIView * *)view
+{
+ if (!_previewController)
+ return CGRectZero;
+
+ UIViewController *presentingViewController = _previewController->page().uiClient().presentingViewController();
+
+ if (!presentingViewController)
+ return CGRectZero;
+
+ CGRect frame = presentingViewController.view.frame;
+ // Create a smaller rectangle centered in the frame.
+ CGFloat halfWidth = frame.size.width / 2;
+ CGFloat halfHeight = frame.size.height / 2;
+ frame = CGRectMake(CGRectGetMidX(frame) - halfWidth / 2, CGRectGetMidY(frame) - halfHeight / 2, halfWidth, halfHeight);
+ return frame;
+}
+
@end
namespace WebKit {