Title: [231797] trunk/Source/WebKit
Revision
231797
Author
[email protected]
Date
2018-05-15 03:36:07 -0700 (Tue, 15 May 2018)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (231796 => 231797)


--- trunk/Source/WebKit/ChangeLog	2018-05-15 10:24:24 UTC (rev 231796)
+++ trunk/Source/WebKit/ChangeLog	2018-05-15 10:36:07 UTC (rev 231797)
@@ -1,3 +1,20 @@
+2018-05-15  Dean Jackson  <[email protected]>
+
+        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  <[email protected]>
 
         Download and present System Preview

Modified: trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm (231796 => 231797)


--- trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm	2018-05-15 10:24:24 UTC (rev 231796)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm	2018-05-15 10:36:07 UTC (rev 231797)
@@ -126,6 +126,25 @@
     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 {

Modified: trunk/Source/WebKit/UIProcess/SystemPreviewController.h (231796 => 231797)


--- trunk/Source/WebKit/UIProcess/SystemPreviewController.h	2018-05-15 10:24:24 UTC (rev 231796)
+++ trunk/Source/WebKit/UIProcess/SystemPreviewController.h	2018-05-15 10:36:07 UTC (rev 231797)
@@ -51,6 +51,8 @@
     void finish(WebCore::URL);
     void cancel();
 
+    WebPageProxy& page() { return m_webPageProxy; }
+
 private:
     WebPageProxy& m_webPageProxy;
 #if USE(QUICK_LOOK)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to