Match HI spec for thumbnail view sizing and location
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2018 23:20:28 +0000 (23:20 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2018 23:20:28 +0000 (23:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186412
<rdar://problem/40226192>

Reviewed by Tim Horton.

Use the computed obscured inset to position the QuickLook
view inside the WKSystemPreviewView.

* UIProcess/ios/WKSystemPreviewView.mm:
(-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
(-[WKSystemPreviewView _layoutThumbnailView]):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm

index 70775ca..087aa82 100644 (file)
@@ -1,3 +1,18 @@
+2018-06-07  Dean Jackson  <dino@apple.com>
+
+        Match HI spec for thumbnail view sizing and location
+        https://bugs.webkit.org/show_bug.cgi?id=186412
+        <rdar://problem/40226192>
+
+        Reviewed by Tim Horton.
+
+        Use the computed obscured inset to position the QuickLook
+        view inside the WKSystemPreviewView.
+
+        * UIProcess/ios/WKSystemPreviewView.mm:
+        (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
+        (-[WKSystemPreviewView _layoutThumbnailView]):
+
 2018-06-07  Tadeu Zagallo  <tzagallo@apple.com>
 
         Don't try to allocate JIT memory if we don't have the JIT entitlement
index 836b369..2e8efda 100644 (file)
@@ -128,7 +128,13 @@ SOFT_LINK_CLASS(AssetViewer, ASVThumbnailView);
 {
     if (_thumbnailView) {
         UIEdgeInsets safeAreaInsets = _webView._computedUnobscuredSafeAreaInset;
-        CGRect layoutFrame = CGRectMake(0, 0, self.frame.size.width - safeAreaInsets.left - safeAreaInsets.right, self.frame.size.height - safeAreaInsets.top - safeAreaInsets.bottom);
+        UIEdgeInsets obscuredAreaInsets = _webView._computedObscuredInset;
+
+        CGRect layoutFrame = UIEdgeInsetsInsetRect(self.frame, safeAreaInsets);
+
+        layoutFrame.size.width -= obscuredAreaInsets.left + obscuredAreaInsets.right;
+        layoutFrame.size.height -= obscuredAreaInsets.top + obscuredAreaInsets.bottom;
+
         [_thumbnailView setFrame:layoutFrame];
         [_thumbnailView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
     }